improved version.h
This commit is contained in:
parent
7ca6d1a695
commit
45b51f9ac8
@ -2,8 +2,8 @@
|
|||||||
#define FSFW_VERSION_H_
|
#define FSFW_VERSION_H_
|
||||||
|
|
||||||
// Versioning is kept in project CMakeLists.txt file
|
// Versioning is kept in project CMakeLists.txt file
|
||||||
#define FSFW_VERSION @FSFW_VERSION@
|
#define FSFW_VERSION_MAJOR @FSFW_VERSION@
|
||||||
#define FSFW_SUBVERSION @FSFW_SUBVERSION@
|
#define FSFW_VERSION_MINOR @FSFW_SUBVERSION@
|
||||||
#define FSFW_REVISION @FSFW_REVISION@
|
#define FSFW_VERSION_REVISION @FSFW_REVISION@
|
||||||
|
|
||||||
#endif /* FSFW_VERSION_H_ */
|
#endif /* FSFW_VERSION_H_ */
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
|
||||||
void fsfw::getVersion(Version& v) {
|
const fsfw::Version fsfw::FSFW_VERSION = {FSFW_VERSION_MAJOR, FSFW_VERSION_MINOR,
|
||||||
v.major = FSFW_VERSION;
|
FSFW_VERSION_REVISION};
|
||||||
v.minor = FSFW_SUBVERSION;
|
|
||||||
v.revision = FSFW_REVISION;
|
fsfw::Version::Version(uint32_t major, uint32_t minor, uint32_t revision)
|
||||||
}
|
: major(major), minor(minor), revision(revision) {}
|
||||||
|
|
||||||
|
void fsfw::getVersion(Version& version) {}
|
||||||
|
@ -5,14 +5,35 @@
|
|||||||
|
|
||||||
namespace fsfw {
|
namespace fsfw {
|
||||||
|
|
||||||
struct Version {
|
class Version {
|
||||||
|
public:
|
||||||
|
Version(uint32_t major, uint32_t minor, uint32_t revision);
|
||||||
uint32_t major = 0;
|
uint32_t major = 0;
|
||||||
uint32_t minor = 0;
|
uint32_t minor = 0;
|
||||||
uint32_t revision = 0;
|
uint32_t revision = 0;
|
||||||
|
|
||||||
|
friend bool operator==(const Version& v1, const Version& v2) {
|
||||||
|
return (v1.major == v2.major and v1.minor == v2.minor and v1.revision == v2.revision);
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator!=(const Version& v1, const Version& v2) { return not(v1 == v2); }
|
||||||
|
|
||||||
|
friend bool operator<(const Version& v1, const Version& v2) {
|
||||||
|
return ((v1.major < v2.major) or (v1.major == v2.major and v1.minor < v2.minor) or
|
||||||
|
(v1.major == v2.major and v1.minor == v2.minor and v1.revision < v2.revision));
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator>(const Version& v1, const Version& v2) { return not(v1 < v2); }
|
||||||
|
|
||||||
|
friend bool operator<=(const Version& v1, const Version& v2) { return ((v1 == v2) or (v1 < v2)); }
|
||||||
|
|
||||||
|
friend bool operator>=(const Version& v1, const Version& v2) { return ((v1 == v2) or (v1 > v2)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const fsfw::Version FSFW_VERSION;
|
||||||
|
|
||||||
void getVersion(Version& version);
|
void getVersion(Version& version);
|
||||||
|
|
||||||
}
|
} // namespace fsfw
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_VERSION_H_ */
|
#endif /* FSFW_SRC_FSFW_VERSION_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user