mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 12:15:29 +08:00
Move Math constants into class (to be consistent with other constants), tested against minGW / gcc 4.7.2 and fixed various issues (mainly initializer lists, unused variables). BlackMisc compiles now in MinGW, but still issues (especially with qDebug() friend methods)
This commit is contained in:
@@ -20,14 +20,13 @@ namespace PhysicalQuantities
|
||||
{
|
||||
/*!
|
||||
* \brief A physical quantity such as "5m", "20s", "1500ft/s"
|
||||
* \author KWB
|
||||
*/
|
||||
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
|
||||
{
|
||||
|
||||
private:
|
||||
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
|
||||
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?
|
||||
|
||||
@@ -383,6 +382,33 @@ public:
|
||||
*/
|
||||
PQ operator -(const PQ &otherQuantity) const;
|
||||
|
||||
/*!
|
||||
* \brief Quantity value <= epsilon
|
||||
* \return
|
||||
*/
|
||||
bool isZeroEpsilon() const
|
||||
{
|
||||
if (this->m_isIntegerBaseValue) return this->m_unitValueI == 0;
|
||||
return this->m_unit.isEpsilon(this->m_unitValueD);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Value >= 0 epsilon considered
|
||||
* \return
|
||||
*/
|
||||
bool isGreaterOrEqualZeroEpsilon() const
|
||||
{
|
||||
return this->isZeroEpsilon() || this->m_unitValueD > 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Value <= 0 epsilon considered
|
||||
* \return
|
||||
*/
|
||||
bool isLessOrEqualZeroEpsilon() const
|
||||
{
|
||||
return this->isZeroEpsilon() || this->m_unitValueD < 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user