mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
Merge with MS "private instead of protected in CRTP" changes
This commit is contained in:
@@ -20,17 +20,7 @@ namespace Math
|
|||||||
*/
|
*/
|
||||||
template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CBaseStreamStringifier<ImplMatrix>
|
template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CBaseStreamStringifier<ImplMatrix>
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
protected:
|
|
||||||
// no bug, Qt expects columns rows
|
|
||||||
QGenericMatrix<Columns, Rows, double> m_matrix; //!< backing data
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Conversion to string
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
QString stringForConverter() const;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Easy access to derived class (CRTP template parameter)
|
* \brief Easy access to derived class (CRTP template parameter)
|
||||||
* \return
|
* \return
|
||||||
@@ -49,6 +39,16 @@ protected:
|
|||||||
return static_cast<ImplMatrix *>(this);
|
return static_cast<ImplMatrix *>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// no bug, Qt expects columns rows
|
||||||
|
QGenericMatrix<Columns, Rows, double> m_matrix; //!< backing data
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Conversion to string
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
QString stringForConverter() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief Default constructor
|
* \brief Default constructor
|
||||||
|
|||||||
@@ -23,6 +23,26 @@ class CMatrix3x1; // forward declaration
|
|||||||
*/
|
*/
|
||||||
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier<ImplVector>
|
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier<ImplVector>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*!
|
||||||
|
* \brief Easy access to derived class (CRTP template parameter)
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
ImplVector const *derived() const
|
||||||
|
{
|
||||||
|
return static_cast<ImplVector const *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Easy access to derived class (CRTP template parameter)
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
ImplVector *derived()
|
||||||
|
{
|
||||||
|
return static_cast<ImplVector *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// using own value since Qt QVector3D stores internally as float
|
// using own value since Qt QVector3D stores internally as float
|
||||||
@@ -61,24 +81,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual QString stringForConverter() const;
|
virtual QString stringForConverter() const;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Easy access to derived class (CRTP template parameter)
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
ImplVector const *derived() const
|
|
||||||
{
|
|
||||||
return static_cast<ImplVector const *>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Easy access to derived class (CRTP template parameter)
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
ImplVector *derived()
|
|
||||||
{
|
|
||||||
return static_cast<ImplVector *>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// getter and setters are implemented in the derived classes
|
// getter and setters are implemented in the derived classes
|
||||||
|
|||||||
@@ -23,13 +23,30 @@ namespace PhysicalQuantities
|
|||||||
*/
|
*/
|
||||||
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
|
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_unitValueD; //!< value backed by double
|
double m_unitValueD; //!< value backed by double
|
||||||
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
|
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
|
||||||
double m_convertedSiUnitValueD; //!< SI unit value
|
double m_convertedSiUnitValueD; //!< SI unit value
|
||||||
bool m_isIntegerBaseValue; //!< flag integer? / double?
|
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:
|
protected:
|
||||||
MU m_unit; //!< unit
|
MU m_unit; //!< unit
|
||||||
MU m_conversionSiUnit; //!< corresponding SI base unit
|
MU m_conversionSiUnit; //!< corresponding SI base unit
|
||||||
@@ -59,24 +76,6 @@ protected:
|
|||||||
return this->unitValueRoundedWithUnit(-1);
|
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
|
* \brief Init by integer
|
||||||
* \param baseValue
|
* \param baseValue
|
||||||
|
|||||||
Reference in New Issue
Block a user