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 const Version s_ver( std::string(poolSchemaVersionLabel), -1 );
13  return s_ver;
14 }
15 
17  static const Version s_ver = fromString( std::string( thisSchemaVersionLabel ));
18  return s_ver;
19 }
20 
22  if ( source == poolSchemaVersionLabel ) return poolSchemaVersion();
23  Version ver;
24  ver.m_label = source;
26  char* p = (char*)tmp.c_str();
27  ::sscanf(p, fmt, &ver.m_main, &ver.m_release, &ver.m_patch );
28  return ver;
29 }
30 
32  m_label(""),
33  m_main( -999 ),
34  m_release( 0 ),
35  m_patch( 0 ){
36 }
37 
39  m_label( label ),
40  m_main( id ),
41  m_release( 0 ),
42  m_patch( 0 ){
43 }
44 
46  m_label( rhs.m_label ),
47  m_main( rhs.m_main ),
48  m_release( rhs.m_release ),
49  m_patch( rhs.m_patch ){
50 }
51 
53  m_label = rhs.m_label;
54  m_main = rhs.m_main;
55  m_release = rhs.m_release;
56  m_patch = rhs.m_patch;
57  return *this;
58 }
59 
60 bool ora::Version::operator==( const Version& rhs ) const {
61  return m_main == rhs.m_main && m_release == rhs.m_release && m_patch == rhs.m_patch;
62 }
63 
64 bool ora::Version::operator!=( const Version& rhs ) const{
65  return !operator==( rhs );
66 }
67 
68 bool ora::Version::operator>( const Version& rhs ) const {
69  if( m_main > rhs.m_main ) return true;
70  if( m_main == rhs.m_main ){
71  if( m_release > rhs.m_release ) return true;
72  if( m_release == rhs.m_release ){
73  if(m_patch > rhs.m_patch ) return true;
74  }
75  }
76  return false;
77 }
78 
79 bool ora::Version::operator<( const Version& rhs ) const {
80  if( m_main < rhs.m_main ) return true;
81  if( m_main == rhs.m_main ){
82  if( m_release < rhs.m_release ) return true;
83  if( m_release == rhs.m_release ){
84  if(m_patch < rhs.m_patch ) return true;
85  }
86  }
87  return false;
88 }
89 
90 bool ora::Version::operator>=( const Version& rhs ) const {
91  if( m_main >= rhs.m_main ) return true;
92  if( m_main == rhs.m_main ){
93  if( m_release >= rhs.m_release ) return true;
94  if( m_release == rhs.m_release ){
95  if(m_patch >= rhs.m_patch ) return true;
96  }
97  }
98  return false;
99 }
100 
101 bool ora::Version::operator<=( const Version& rhs ) const {
102  if( m_main <= rhs.m_main ) return true;
103  if( m_main == rhs.m_main ){
104  if( m_release <= rhs.m_release ) return true;
105  if( m_release == rhs.m_release ){
106  if(m_patch <= rhs.m_patch ) return true;
107  }
108  }
109  return false;
110 }
111 
113  return m_label;
114 }
115 
116 void ora::Version::toOutputStream( std::ostream& os ) const {
117  os << m_label;
118 }
119 
int m_release
Definition: Version.h:37
static Version fromString(const std::string &versionString)
Definition: Version.cc:21
static const Version & thisSchemaVersion()
Definition: Version.cc:16
Version & operator=(const Version &rhs)
Definition: Version.cc:52
int m_main
Definition: Version.h:36
bool operator>(const Version &rhs) const
Definition: Version.cc:68
void toOutputStream(std::ostream &os) const
Definition: Version.cc:116
bool operator<(const Version &rhs) const
Definition: Version.cc:79
static const char * fmt
Definition: Version.cc:9
std::string m_label
Definition: Version.h:35
bool operator!=(const Version &rhs) const
Definition: Version.cc:64
std::string poolSchemaVersion()
bool operator<=(const Version &rhs) const
Definition: Version.cc:101
static const char * thisSchemaVersionLabel
Definition: Version.cc:6
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
static const Version & poolSchemaVersion()
Definition: Version.cc:11
bool operator==(const Version &rhs) const
Definition: Version.cc:60
static const char * poolSchemaVersionLabel
Definition: Version.cc:8
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
pat::CandKinResolution::Parametrization fromString(const std::string &name)
Convert a name into a parametrization code.
int m_patch
Definition: Version.h:38
bool operator>=(const Version &rhs) const
Definition: Version.cc:90
std::string toString() const
Definition: Version.cc:112
static std::string const source
Definition: EdmProvDump.cc:42