From 9bb72a6f252dc0dce9e70e2e97b83115c772cb64 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Mon, 22 Nov 2021 06:02:54 +0100 Subject: [PATCH] Issue #323: adjust handling of appVersion. We don't want to have to tunnel the appVersion through all the constructors, so McciCatena::Catena::Catena() calls new protected McciCatena::Catena::setAppVersion(), exported by CatenaBase, after all the other constructors are done. --- src/CatenaBase.h | 16 ++++++++++++++-- src/lib/CatenaBase.cpp | 3 +-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/CatenaBase.h b/src/CatenaBase.h index 8f6355a..282d202 100644 --- a/src/CatenaBase.h +++ b/src/CatenaBase.h @@ -236,7 +236,7 @@ class CatenaBase { public: /// \brief The constructor for the common behavior of any `Catena`-like object. - CatenaBase(Version_t v = Version_t(0)); + CatenaBase(); /// \brief the destructor; virtual because this is a base class. virtual ~CatenaBase() {}; @@ -674,7 +674,19 @@ class CatenaBase /// static CatenaBase *pCatenaBase; + /// \brief get the application version + Version_t getAppVersion() const + { + return this->m_appVersion; + } + protected: + /// \brief set the application version + void setAppVersion(Version_t v) + { + this->m_appVersion = v; + } + /// \brief register the well-known system commands virtual void registerCommands(void); @@ -731,7 +743,7 @@ class CatenaBase private: uint32_t m_OperatingFlags; ///< the operating flags const CATENA_PLATFORM * m_pPlatform; ///< the platform pointer - Version_t m_appVersion; ///< the application version + Version_t m_appVersion {0}; ///< the application version // internal methods diff --git a/src/lib/CatenaBase.cpp b/src/lib/CatenaBase.cpp index dfcf155..9b331ea 100644 --- a/src/lib/CatenaBase.cpp +++ b/src/lib/CatenaBase.cpp @@ -23,9 +23,8 @@ using namespace McciCatena; CatenaBase *CatenaBase::pCatenaBase; /* the constructor */ -CatenaBase::CatenaBase(Version_t v) +CatenaBase::CatenaBase() { - this->m_appVersion = v; pCatenaBase = this; }