CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Version.cc
Go to the documentation of this file.
2 //
3 #include <cstdio>
4 #include <cstring>
5 
6 static const char* thisSchemaVersionLabel = "1.1.0";
7 
8 static const char* poolSchemaVersionLabel = "POOL";
9 static const char* fmt = "%3d.%3d.%3d";
10 
12  static Version s_ver;
14  s_ver.m_main = -1;
15  return s_ver;
16 }
17 
19  static Version s_ver;
21  return s_ver;
22 }
23 
25  if ( source == poolSchemaVersionLabel ) return poolSchemaVersion();
26  Version ver;
27  ver.m_label = source;
29  char* p = (char*)tmp.c_str();
30  ::sscanf(p, fmt, &ver.m_main, &ver.m_release, &ver.m_patch );
31  return ver;
32 }
33 
35  m_label(""),
36  m_main( -999 ),
37  m_release( 0 ),
38  m_patch( 0 ){
39 }
40 
42  m_label( rhs.m_label ),
43  m_main( rhs.m_main ),
44  m_release( rhs.m_release ),
45  m_patch( rhs.m_patch ){
46 }
47 
49  m_label = rhs.m_label;
50  m_main = rhs.m_main;
51  m_release = rhs.m_release;
52  m_patch = rhs.m_patch;
53  return *this;
54 }
55 
56 bool ora::Version::operator==( const Version& rhs ) const {
57  return m_main == rhs.m_main && m_release == rhs.m_release && m_patch == rhs.m_patch;
58 }
59 
60 bool ora::Version::operator!=( const Version& rhs ) const{
61  return !operator==( rhs );
62 }
63 
64 bool ora::Version::operator>( const Version& rhs ) const {
65  if( m_main > rhs.m_main ) return true;
66  if( m_main == rhs.m_main ){
67  if( m_release > rhs.m_release ) return true;
68  if( m_release == rhs.m_release ){
69  if(m_patch > rhs.m_patch ) return true;
70  }
71  }
72  return false;
73 }
74 
75 bool ora::Version::operator<( const Version& rhs ) const {
76  if( m_main < rhs.m_main ) return true;
77  if( m_main == rhs.m_main ){
78  if( m_release < rhs.m_release ) return true;
79  if( m_release == rhs.m_release ){
80  if(m_patch < rhs.m_patch ) return true;
81  }
82  }
83  return false;
84 }
85 
86 bool ora::Version::operator>=( const Version& rhs ) const {
87  if( m_main >= rhs.m_main ) return true;
88  if( m_main == rhs.m_main ){
89  if( m_release >= rhs.m_release ) return true;
90  if( m_release == rhs.m_release ){
91  if(m_patch >= rhs.m_patch ) return true;
92  }
93  }
94  return false;
95 }
96 
97 bool ora::Version::operator<=( const Version& rhs ) const {
98  if( m_main <= rhs.m_main ) return true;
99  if( m_main == rhs.m_main ){
100  if( m_release <= rhs.m_release ) return true;
101  if( m_release == rhs.m_release ){
102  if(m_patch <= rhs.m_patch ) return true;
103  }
104  }
105  return false;
106 }
107 
109  return m_label;
110 }
111 
112 void ora::Version::toOutputStream( std::ostream& os ) const {
113  os << m_label;
114 }
115 
int m_release
Definition: Version.h:36
static Version fromString(const std::string &versionString)
Definition: Version.cc:24
Version & operator=(const Version &rhs)
Definition: Version.cc:48
int m_main
Definition: Version.h:35
bool operator==(const CaloTower &t1, const CaloTower &t2)
Definition: CaloTower.h:211
bool operator>(const Version &rhs) const
Definition: Version.cc:64
void toOutputStream(std::ostream &os) const
Definition: Version.cc:112
bool operator<(const Version &rhs) const
Definition: Version.cc:75
static const char * fmt
Definition: Version.cc:9
std::string m_label
Definition: Version.h:34
bool operator!=(const Version &rhs) const
Definition: Version.cc:60
std::string poolSchemaVersion()
bool operator<=(const Version &rhs) const
Definition: Version.cc:97
static const char * thisSchemaVersionLabel
Definition: Version.cc:6
bool operator==(const Version &rhs) const
Definition: Version.cc:56
static const char * poolSchemaVersionLabel
Definition: Version.cc:8
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static Version & poolSchemaVersion()
Definition: Version.cc:11
pat::CandKinResolution::Parametrization fromString(const std::string &name)
Convert a name into a parametrization code.
int m_patch
Definition: Version.h:37
bool operator>=(const Version &rhs) const
Definition: Version.cc:86
std::string toString() const
Definition: Version.cc:108
static Version & thisSchemaVersion()
Definition: Version.cc:18