Skip to content

Commit

Permalink
Issue #323: adjust handling of appVersion.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
terrillmoore committed Nov 22, 2021
1 parent 2b29527 commit 9bb72a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/CatenaBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {};
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/lib/CatenaBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9bb72a6

Please sign in to comment.