12#include "VersionInfo.h"
14#include <boost/format.hpp>
30 int configPatch{
appConfig().
get<
int>(
"Application/configPatchVersion")};
32 ScalarOutput<int> majorVersion{
this,
"majorVersion",
"",
"Major version of the application"};
33 ScalarOutput<int> minorVersion{
this,
"minorVersion",
"",
"Minor version of the application"};
34 ScalarOutput<int> patchVersion{
this,
"patchVersion",
"",
"Patch version of the application"};
35 ScalarOutput<std::string> fullVersion{
36 this,
"fullVersion",
"",
"Full version of the application with configuration patch"};
38 void mainLoop()
override {}
40 void prepare()
override;
43 void operator=(
const VersionInfoProvider&) =
delete;
45 void operator=(VersionInfoProvider&&) =
delete;
50 inline void VersionInfoProvider::prepare() {
51 majorVersion = VersionInfo::major;
52 minorVersion = VersionInfo::minor;
53 patchVersion = VersionInfo::applicationPatch;
54 boost::format fmt = boost::format(
"%02d.%02d.%02d-%02d") %
static_cast<int>(majorVersion) %
55 static_cast<int>(minorVersion) %
static_cast<int>(patchVersion) % configPatch;
56 fullVersion = fmt.str();
61 :
ApplicationModule(owner,
"Application",
"Module to publish version information") {
63 throw logic_error(
"An application can only have one VersionInfoprovider.");
ApplicationModule * getVersionInfoProvider()
void setVersionInfoProvider(ApplicationModule *provider)
const T & get(std::string variableName) const
Get value for given configuration variable.
static ConfigReader & appConfig()
Obtain the ConfigReader instance of the application.
EntityOwner * getOwner() const
void writeAll(bool includeReturnChannels=false)
Just call write() on all writable variables in the group.
This module can be added to applications to provide version information from the CMakeLists....
~VersionInfoProvider() override
VersionInfoProvider(Application *owner)
InvalidityTracer application module.