added tests
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
#ifndef FSFW_SRC_FSFW_VERSION_H_
|
||||
#define FSFW_SRC_FSFW_VERSION_H_
|
||||
|
||||
#include "fsfw/FSFW.h"
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
namespace fsfw {
|
||||
|
||||
@ -28,6 +34,28 @@ class Version {
|
||||
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)); }
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
/**
|
||||
* Print format to given ostream using format "major.minor.revision"
|
||||
* @param os
|
||||
* @param v
|
||||
* @return
|
||||
*/
|
||||
friend std::ostream& operator<<(std::ostream& os, const Version& v) {
|
||||
os << v.major << "." << v.minor << "." << v.revision;
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get version as format "major.minor.revision"
|
||||
* @param str
|
||||
* @param maxLen
|
||||
*/
|
||||
void getVersion(char* str, size_t maxLen) const {
|
||||
snprintf(str, maxLen, "%d.%d.%d", major, minor, revision);
|
||||
}
|
||||
};
|
||||
|
||||
extern const fsfw::Version FSFW_VERSION;
|
||||
|
Reference in New Issue
Block a user