Update FSFW #45

Merged
meierj merged 26 commits from mueller/master into eive/develop 2022-03-25 14:56:19 +01:00
3 changed files with 34 additions and 10 deletions
Showing only changes of commit 9509847b84 - Show all commits

View File

@ -2,8 +2,8 @@
#define FSFW_VERSION_H_
// Versioning is kept in project CMakeLists.txt file
#define FSFW_VERSION @FSFW_VERSION@
#define FSFW_SUBVERSION @FSFW_SUBVERSION@
#define FSFW_REVISION @FSFW_REVISION@
#define FSFW_VERSION_MAJOR @FSFW_VERSION@
#define FSFW_VERSION_MINOR @FSFW_SUBVERSION@
#define FSFW_VERSION_REVISION @FSFW_REVISION@
#endif /* FSFW_VERSION_H_ */

View File

@ -1,8 +1,11 @@
#include "version.h"
#include "fsfw/FSFWVersion.h"
void fsfw::getVersion(Version& v) {
v.major = FSFW_VERSION;
v.minor = FSFW_SUBVERSION;
v.revision = FSFW_REVISION;
}
const fsfw::Version fsfw::FSFW_VERSION = {FSFW_VERSION_MAJOR, FSFW_VERSION_MINOR,
FSFW_VERSION_REVISION};
fsfw::Version::Version(uint32_t major, uint32_t minor, uint32_t revision)
: major(major), minor(minor), revision(revision) {}
void fsfw::getVersion(Version& version) {}

View File

@ -5,14 +5,35 @@
namespace fsfw {
struct Version {
class Version {
public:
Version(uint32_t major, uint32_t minor, uint32_t revision);
uint32_t major = 0;
uint32_t minor = 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);
}
} // namespace fsfw
#endif /* FSFW_SRC_FSFW_VERSION_H_ */