CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

ora::Version Class Reference

#include <Version.h>

List of all members.

Public Member Functions

bool operator!= (const Version &rhs) const
bool operator< (const Version &rhs) const
bool operator<= (const Version &rhs) const
Versionoperator= (const Version &rhs)
bool operator== (const Version &rhs) const
bool operator> (const Version &rhs) const
bool operator>= (const Version &rhs) const
void toOutputStream (std::ostream &os) const
std::string toString () const
 Version (const Version &rhs)
 Version ()
 ~Version ()

Static Public Member Functions

static Version fromString (const std::string &versionString)
static VersionpoolSchemaVersion ()
static VersionthisSchemaVersion ()

Private Attributes

std::string m_label
int m_main
int m_patch
int m_release

Detailed Description

Definition at line 9 of file Version.h.


Constructor & Destructor Documentation

Version::Version ( )

Definition at line 34 of file Version.cc.

                   :
  m_label(""),
  m_main( -999 ),
  m_release( 0 ),
  m_patch( 0 ){
}
ora::Version::~Version ( ) [inline]

Definition at line 18 of file Version.h.

              {
    }
Version::Version ( const Version rhs)

Definition at line 41 of file Version.cc.

                                       :
  m_label( rhs.m_label ),
  m_main( rhs.m_main ),
  m_release( rhs.m_release ),
  m_patch( rhs.m_patch ){
}

Member Function Documentation

ora::Version Version::fromString ( const std::string &  versionString) [static]

Definition at line 24 of file Version.cc.

References fmt, m_label, m_main, m_patch, m_release, AlCaHLTBitMon_ParallelJobs::p, ora::poolSchemaVersion(), poolSchemaVersionLabel, LaserTracksInput_cfi::source, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by ora::Database::schemaVersion().

                                                          {
  if ( source == poolSchemaVersionLabel ) return poolSchemaVersion();
  Version ver;
  ver.m_label = source;
  std::string tmp = source;
  char* p = (char*)tmp.c_str();
  ::sscanf(p, fmt, &ver.m_main, &ver.m_release, &ver.m_patch );
  return ver;
}
bool Version::operator!= ( const Version rhs) const

Definition at line 60 of file Version.cc.

References operator==().

                                                     {
  return !operator==( rhs );
}
bool Version::operator< ( const Version rhs) const

Definition at line 75 of file Version.cc.

References m_main, m_patch, and m_release.

                                                     {
  if( m_main < rhs.m_main ) return true;
  if( m_main == rhs.m_main ){
    if( m_release < rhs.m_release ) return true;
    if( m_release == rhs.m_release ){
      if(m_patch < rhs.m_patch ) return true;
    }
  }
  return false;
}
bool Version::operator<= ( const Version rhs) const

Definition at line 97 of file Version.cc.

References m_main, m_patch, and m_release.

                                                      {
  if( m_main <= rhs.m_main ) return true;
  if( m_main == rhs.m_main ){
    if( m_release <= rhs.m_release ) return true;
    if( m_release == rhs.m_release ){
      if(m_patch <= rhs.m_patch ) return true;
    }
  }
  return false;
}
ora::Version & Version::operator= ( const Version rhs)

Definition at line 48 of file Version.cc.

References m_label, m_main, m_patch, and m_release.

                                                     {
  m_label = rhs.m_label;
  m_main = rhs.m_main;
  m_release = rhs.m_release;
  m_patch = rhs.m_patch;
  return *this;
}
bool Version::operator== ( const Version rhs) const

Definition at line 56 of file Version.cc.

References m_main, m_patch, and m_release.

                                                      {
  return m_main == rhs.m_main && m_release == rhs.m_release && m_patch == rhs.m_patch;
}
bool Version::operator> ( const Version rhs) const

Definition at line 64 of file Version.cc.

References m_main, m_patch, and m_release.

                                                     {
  if( m_main > rhs.m_main ) return true;
  if( m_main == rhs.m_main ){
    if( m_release > rhs.m_release ) return true;
    if( m_release == rhs.m_release ){
      if(m_patch > rhs.m_patch ) return true;
    }
  }
  return false;
}
bool Version::operator>= ( const Version rhs) const

Definition at line 86 of file Version.cc.

References m_main, m_patch, and m_release.

                                                      {
  if( m_main >= rhs.m_main ) return true;
  if( m_main == rhs.m_main ){
    if( m_release >= rhs.m_release ) return true;
    if( m_release == rhs.m_release ){
      if(m_patch >= rhs.m_patch ) return true;
    }
  }
  return false;
}
ora::Version & Version::poolSchemaVersion ( ) [static]

Definition at line 11 of file Version.cc.

References m_label, m_main, poolSchemaVersionLabel, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by cond::DbSession::isOldSchema().

                                         {
  static Version s_ver;
  s_ver.m_label = std::string(poolSchemaVersionLabel);
  s_ver.m_main = -1;
  return s_ver;
}
ora::Version & Version::thisSchemaVersion ( ) [static]
void Version::toOutputStream ( std::ostream &  os) const

Definition at line 112 of file Version.cc.

Referenced by operator<<().

                                                      {
  os << m_label;
}
std::string Version::toString ( ) const

Definition at line 108 of file Version.cc.

                                     {
  return m_label;
}

Member Data Documentation

std::string ora::Version::m_label [private]

Definition at line 34 of file Version.h.

Referenced by fromString(), operator=(), and poolSchemaVersion().

int ora::Version::m_main [private]
int ora::Version::m_patch [private]

Definition at line 37 of file Version.h.

Referenced by fromString(), operator<(), operator<=(), operator=(), operator==(), operator>(), and operator>=().

int ora::Version::m_release [private]

Definition at line 36 of file Version.h.

Referenced by fromString(), operator<(), operator<=(), operator=(), operator==(), operator>(), and operator>=().