fsfw/src/fsfw/version.h

38 lines
1.1 KiB
C
Raw Normal View History

2022-03-08 10:05:18 +01:00
#ifndef FSFW_SRC_FSFW_VERSION_H_
#define FSFW_SRC_FSFW_VERSION_H_
#include <cstdint>
namespace fsfw {
2022-03-09 19:05:07 +01:00
class Version {
public:
Version(uint32_t major, uint32_t minor, uint32_t revision);
2022-03-08 10:05:18 +01:00
uint32_t major = 0;
uint32_t minor = 0;
uint32_t revision = 0;
2022-03-09 19:05:07 +01:00
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)); }
2022-03-08 10:05:18 +01:00
};
2022-03-09 19:05:07 +01:00
extern const fsfw::Version FSFW_VERSION;
} // namespace fsfw
2022-03-08 10:05:18 +01:00
#endif /* FSFW_SRC_FSFW_VERSION_H_ */