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;
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.");