Evita  0.16
evVersion.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evVersion_h
25 #define __evVersion_h
26 
27 
28 #include "evCommon.h"
29 #include "evDataObject.h"
30 
31 
32 #define EVSYSTEMNAME "The EVITA System"
33 #define EVMAJORVERSION 0
34 #define EVMINORVERSION 16
35 #define EVDATE "16-jul-2016"
36 #define EVSYSTEMCOPYRIGHT "Copyright (C) 2000-2016 Team Evita"
37 #define EVMAGICNUMBER "Evita"
38 
39 
40 class evVersion : public evDataObject
41 {
42 public:
43  evVersion(void);
44  evVersion(const int major_version, const int minor_version);
45  evVersion(const char *version_string);
46  evVersion(const evVersion &version);
47 
48  virtual ~evVersion(void);
49 
50  void SetVersion(const int major_version, const int minor_version);
51  void GetVersion(int &major_version, int &minor_version) const;
52 
53  evVersion operator = (const evVersion &version);
54  int operator == (const evVersion &version) const;
55  int operator != (const evVersion &version) const;
56  int operator < (const evVersion &version) const;
57  int operator <= (const evVersion &version) const;
58  int operator > (const evVersion &version) const;
59  int operator >= (const evVersion &version) const;
60 
61 protected:
62 
63 private:
66 };
67 
68 
69 extern const evVersion evCurrentVersion;
70 
71 
73 {
74  this->MajorVersion = 0;
75  this->MinorVersion = 0;
76 }
77 
78 
79 inline evVersion::evVersion(const int major_version, const int minor_version)
80 {
81  this->SetVersion(major_version, minor_version);
82 }
83 
84 
85 inline evVersion::evVersion(const char *version_string)
86 {
87  int major_version, minor_version;
88 
89  sscanf(version_string, "%d.%d",
90  &major_version, &minor_version);
91 
92  this->SetVersion(major_version, minor_version);
93 
94 }
95 
96 
97 inline evVersion::evVersion(const evVersion &version)
98 {
99  this->SetVersion(version.MajorVersion,
100  version.MinorVersion);
101 }
102 
103 
105 {
106 }
107 
108 
109 inline void evVersion::SetVersion(const int major_version,
110  const int minor_version)
111 {
112  this->MajorVersion = major_version;
113  this->MinorVersion = minor_version;
114 }
115 
116 
117 inline void evVersion::GetVersion(int &major_version,
118  int &minor_version) const
119 {
120  major_version = this->MajorVersion;
121  minor_version = this->MinorVersion;
122 }
123 
124 
126 {
127  this->SetVersion(version.MajorVersion,
128  version.MinorVersion);
129 
130  return(*this);
131 }
132 
133 
134 inline int evVersion::operator == (const evVersion &version) const
135 {
136  return((this->MajorVersion == version.MajorVersion) &&
137  (this->MinorVersion == version.MinorVersion));
138 }
139 
140 
141 inline int evVersion::operator != (const evVersion &version) const
142 {
143  return(!(*this == version));
144 }
145 
146 
147 inline int evVersion::operator < (const evVersion &version) const
148 {
149  if (this->MajorVersion < version.MajorVersion)
150  return(1);
151  if (this->MajorVersion > version.MajorVersion)
152  return(0);
153  return(this->MinorVersion < version.MinorVersion);
154 }
155 
156 
157 inline int evVersion::operator <= (const evVersion &version) const
158 {
159  return((*this == version) || (*this < version));
160 }
161 
162 
163 inline int evVersion::operator > (const evVersion &version) const
164 {
165  return(!(*this <= version));
166 }
167 
168 
169 inline int evVersion::operator >= (const evVersion &version) const
170 {
171  return(!(*this < version));
172 }
173 
174 
175 #endif
int operator>=(const evVersion &version) const
Definition: evVersion.h:169
virtual ~evVersion(void)
Definition: evVersion.h:104
evVersion(void)
Definition: evVersion.h:72
int operator>(const evVersion &version) const
Definition: evVersion.h:163
int operator==(const evVersion &version) const
Definition: evVersion.h:134
Definition: evDataObject.h:31
Definition: evVersion.h:40
void SetVersion(const int major_version, const int minor_version)
Definition: evVersion.h:109
int operator<(const evVersion &version) const
Definition: evVersion.h:147
int operator!=(const evVersion &version) const
Definition: evVersion.h:141
void GetVersion(int &major_version, int &minor_version) const
Definition: evVersion.h:117
const evVersion evCurrentVersion
int MajorVersion
Definition: evVersion.h:64
evVersion operator=(const evVersion &version)
Definition: evVersion.h:125
int operator<=(const evVersion &version) const
Definition: evVersion.h:157
int MinorVersion
Definition: evVersion.h:65