GLStats  0.1.0
version.h
1 
2 /* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef GLSTATS_VERSION_H
19 #define GLSTATS_VERSION_H
20 
21 #include <GLStats/api.h>
22 #include <GLStats/types.h>
23 #include <string>
24 
25 namespace GLStats
26 {
27  // GLStats version macros and functions
29 # define GLSTATS_VERSION_MAJOR 0
30 
32 # define GLSTATS_VERSION_MINOR 1
33 
35 # define GLSTATS_VERSION_PATCH 0
36 
38 # define GLSTATS_VERSION_ABI 100
39 
41 # define GLSTATS_VERSION_GT( MAJOR, MINOR, PATCH ) \
42  ( (GLSTATS_VERSION_MAJOR>MAJOR) || \
43  (GLSTATS_VERSION_MAJOR==MAJOR && \
44  (GLSTATS_VERSION_MINOR>MINOR || \
45  (GLSTATS_VERSION_MINOR==MINOR && GLSTATS_VERSION_PATCH>PATCH))))
46 
48 # define GLSTATS_VERSION_GE( MAJOR, MINOR, PATCH ) \
49  ( (GLSTATS_VERSION_MAJOR>MAJOR) || \
50  (GLSTATS_VERSION_MAJOR==MAJOR && \
51  (GLSTATS_VERSION_MINOR>MINOR || \
52  (GLSTATS_VERSION_MINOR==MINOR && GLSTATS_VERSION_PATCH>=PATCH))))
53 
55 # define GLSTATS_VERSION_LT( MAJOR, MINOR, PATCH ) \
56  ( (GLSTATS_VERSION_MAJOR<MAJOR) || \
57  (GLSTATS_VERSION_MAJOR==MAJOR && \
58  (GLSTATS_VERSION_MINOR<MINOR || \
59  (GLSTATS_VERSION_MINOR==MINOR && GLSTATS_VERSION_PATCH<PATCH))))
60 
62 # define GLSTATS_VERSION_LE( MAJOR, MINOR, PATCH ) \
63  ( (GLSTATS_VERSION_MAJOR<MAJOR) || \
64  (GLSTATS_VERSION_MAJOR==MAJOR && \
65  (GLSTATS_VERSION_MINOR<MINOR || \
66  (GLSTATS_VERSION_MINOR==MINOR && GLSTATS_VERSION_PATCH<=PATCH))))
67 
69  class GLSTATS_API Version
70  {
71  public:
73  static uint32_t getMajor();
74 
76  static uint32_t getMinor();
77 
79  static uint32_t getPatch();
80 
82  static std::string getRevision();
83 
85  static uint32_t getABI();
86 
88  static uint32_t getInt();
89 
91  static float getFloat();
92 
97  static std::string getString();
98 
103  static bool check()
104  {
105  return getMajor()==GLSTATS_VERSION_MAJOR &&
106  getMinor()==GLSTATS_VERSION_MINOR;
107  }
108  };
109 }
110 
111 #endif //GLSTATS_VERSION_H