Origen V93K SMT7 Library
 All Classes Namespaces Files Functions Variables Typedefs Macros
version.hpp
Go to the documentation of this file.
1 #ifndef ORIGEN_UTILS_VERSION_INCLUDED
2 #define ORIGEN_UTILS_VERSION_INCLUDED
3 
4 // GCC adds these macros by default, which clobbers our functions
5 // of the same name
6 #if (defined(__GNUC__) || defined(__GNUG__)) && \
7  !(defined(__clang__) || defined(__INTEL_COMPILER))
8 // Not exactly sure the version that this becomes a problem, but for
9 // now this fixes the build on the V93K production system
10 #if (__GNUC_MINOR__ > 1)
11 #ifdef major
12 #undef major
13 #endif
14 #ifdef minor
15 #undef minor
16 #endif
17 #endif
18 #endif
19 
20 #include <string>
21 #include <vector>
22 using namespace std;
23 
24 namespace Origen {
25 namespace Utils {
26 
27 // The version class provides an easy way to create conditions based
28 // on the version of a library.
29 //
30 // An instance of the class is returned by Origen.version and which
31 // reflects the current version of the Origen library.
32 //
33 // if (Origen.version < "1.1.0") {
34 // // Do something
35 // }
36 //
37 // if (Origen.version.major() == 2) {
38 // // Do something
39 // }
40 class Version {
41  private:
42  vector<int> parse(string ver);
43  int _major;
44  int _minor;
45  int _tiny;
46 
47  public:
48  int major();
49  int minor();
50  int tiny();
51  Version(string ver);
52  bool operator==(string rhs);
53  bool operator!=(string rhs);
54  bool operator<(string rhs);
55  bool operator<=(string rhs);
56  bool operator>(string rhs);
57  bool operator>=(string rhs);
58  string str();
59 };
60 }
61 }
62 
63 #endif
Definition: version.hpp:40