Merge branch 'mueller/version-getter-upstream' into mueller/master

This commit is contained in:
Robin Müller 2022-03-10 09:59:18 +01:00
commit 17262a1da9
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 12 additions and 5 deletions

View File

@ -1,12 +1,22 @@
#include "version.h" #include "version.h"
#include "fsfw/FSFWVersion.h" #include "fsfw/FSFWVersion.h"
#include <cstdio>
#ifdef major
#undef major #undef major
#endif
#ifdef minor
#undef minor #undef minor
#endif
const fsfw::Version fsfw::FSFW_VERSION = {FSFW_VERSION_MAJOR, FSFW_VERSION_MINOR, const fsfw::Version fsfw::FSFW_VERSION = {FSFW_VERSION_MAJOR, FSFW_VERSION_MINOR,
FSFW_VERSION_REVISION}; FSFW_VERSION_REVISION};
fsfw::Version::Version(uint32_t major, uint32_t minor, uint32_t revision) fsfw::Version::Version(uint32_t major, uint32_t minor, uint32_t revision)
: major(major), minor(minor), revision(revision) {} : major(major), minor(minor), revision(revision) {}
void fsfw::Version::getVersion(char* str, size_t maxLen) const {
snprintf(str, maxLen, "%d.%d.%d", major, minor, revision);
}

View File

@ -7,7 +7,6 @@
#include <iostream> #include <iostream>
#endif #endif
#include <cstdint> #include <cstdint>
#include <cstdio>
namespace fsfw { namespace fsfw {
@ -53,9 +52,7 @@ class Version {
* @param str * @param str
* @param maxLen * @param maxLen
*/ */
void getVersion(char* str, size_t maxLen) const { void getVersion(char* str, size_t maxLen) const;
snprintf(str, maxLen, "%d.%d.%d", major, minor, revision);
}
}; };
extern const fsfw::Version FSFW_VERSION; extern const fsfw::Version FSFW_VERSION;