COPASI API  4.16.103
CVersion.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2012 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CVersion
17  *
18  * (C) Pedro Mendes 2001
19  */
20 
21 #ifndef COPASI_CVersion
22 #define COPASI_CVersion
23 
24 #include <set>
25 
26 #include "copasi.h"
27 
28 class CVersion
29 {
30  // Attributes
31 private:
32  /**
33  * Major version number.
34  * (4 for first COPASI release)
35  */
37 
38  /**
39  * Minor version number.
40  * (changes with releases that are mostly bug fixes)
41  */
43 
44  /**
45  * The monotonously increasing build number
46  */
48 
49  /**
50  * Boolean value indicating whether mBuild is describing the
51  * current state of the sources.
52  */
54 
55  /**
56  * Comment appended to the version string
57  */
58  std::string mComment;
59 
60  /**
61  * Creator who compiled this version for official unmodified sources
62  * it is copasi.org
63  */
64  std::string mCreator;
65 
66  /**
67  * Version string.
68  */
69  std::string mVersion;
70 
71  /**
72  * The list of compatible builds
73  */
74  std::set< C_INT32 > mCompatible;
75 
76  // Operations
77 
78  /**
79  * Constructor with four arguments.
80  */
81  CVersion(C_INT32 major,
82  C_INT32 minor,
83  C_INT32 build,
84  const bool & sourcesModified,
85  const std::string & comment,
86  const std::string & creator);
87 
88 public:
89  /**
90  * Default constructor.
91  * This creates a version object without any version info.
92  */
93  CVersion();
94 
95  /**
96  * Destructor.
97  */
98  ~CVersion();
99 
100  /**
101  * Returns the major version number.
102  * @return mMajor
103  * @see mMajor
104  */
105  C_INT32 getVersionMajor() const;
106 
107  /**
108  * Returns the minor version number.
109  * @return mMinor
110  * @see mMinor
111  */
112  C_INT32 getVersionMinor() const;
113 
114  /**
115  * Returns the development version number.
116  * @return mBuild
117  * @see mBuild
118  */
119  C_INT32 getVersionDevel() const;
120 
121  /**
122  * Retrieve the whether the source code is modified compared to the official build
123  * @return const bool & isSourceModified
124  */
125  const bool & isSourceModified() const;
126 
127  /**
128  * Returns a string with the full version number.
129  * @return mVersion
130  * @see mVersion
131  */
132  const std::string & getVersion() const;
133 
134  /**
135  * Sets a version number
136  * @param const C_INT32 & major
137  * @param const C_INT32 & minor
138  * @param const C_INT32 & build
139  * @param const bool & sourcesModified
140  * @param const std::string & comment
141  * @param const std::string & creator
142  */
143  void setVersion(const C_INT32 & major,
144  const C_INT32 & minor,
145  const C_INT32 & devel,
146  const bool & sourcesModified,
147  const std::string & comment = "",
148  const std::string & creator = "");
149 
150  /**
151  * Compare Versions
152  * @param const CVersion & version
153  * @return bool isCompatible
154  */
155  bool isCompatible(const CVersion & version) const;
156 
157 private:
158  /**
159  * Creates the version string.
160  */
161  void setString();
162 
163 public:
164  static const CVersion VERSION;
165 };
166 
167 #endif // COPASI_CVersion
void setString()
Definition: CVersion.cpp:144
std::string mVersion
Definition: CVersion.h:69
C_INT32 mMinor
Definition: CVersion.h:42
std::string mCreator
Definition: CVersion.h:64
CVersion()
Definition: CVersion.cpp:66
C_INT32 mBuild
Definition: CVersion.h:47
const bool & isSourceModified() const
Definition: CVersion.cpp:134
bool isCompatible(const CVersion &version) const
Definition: CVersion.cpp:82
C_INT32 getVersionMajor() const
Definition: CVersion.cpp:119
void setVersion(const C_INT32 &major, const C_INT32 &minor, const C_INT32 &devel, const bool &sourcesModified, const std::string &comment="", const std::string &creator="")
Definition: CVersion.cpp:102
~CVersion()
Definition: CVersion.cpp:79
C_INT32 mMajor
Definition: CVersion.h:36
#define C_INT32
Definition: copasi.h:90
std::set< C_INT32 > mCompatible
Definition: CVersion.h:74
C_INT32 getVersionMinor() const
Definition: CVersion.cpp:124
C_INT32 getVersionDevel() const
Definition: CVersion.cpp:129
const std::string & getVersion() const
Definition: CVersion.cpp:139
std::string mComment
Definition: CVersion.h:58
bool mSourcesModified
Definition: CVersion.h:53
static const CVersion VERSION
Definition: CVersion.h:164