made derived() private instead of protected in CRTP

This commit is contained in:
Mathew Sutcliffe
2013-04-30 20:12:47 +01:00
parent ad6ac0186b
commit e5afc2c627
3 changed files with 48 additions and 48 deletions

View File

@@ -23,13 +23,30 @@ namespace PhysicalQuantities
*/
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
{
private:
double m_unitValueD; //!< value backed by double
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
double m_convertedSiUnitValueD; //!< SI unit value
bool m_isIntegerBaseValue; //!< flag integer? / double?
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
PQ const* derived() const
{
return static_cast<PQ const *>(this);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
PQ* derived()
{
return static_cast<PQ *>(this);
}
protected:
MU m_unit; //!< unit
MU m_conversionSiUnit; //!< corresponding SI base unit
@@ -59,24 +76,6 @@ protected:
return this->unitValueRoundedWithUnit(-1);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
PQ const* derived() const
{
return static_cast<PQ const *>(this);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
* \return
*/
PQ* derived()
{
return static_cast<PQ *>(this);
}
/*!
* \brief Init by integer
* \param baseValue