mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
Ref T261, utility functions in value classes
* set offset values * do not change PQs if PQ is null * sorted by callsign
This commit is contained in:
committed by
Roland Winklmeier
parent
3f4cb7529c
commit
8e3b55b4ca
@@ -143,6 +143,7 @@ namespace BlackMisc
|
||||
template <class MU, class PQ>
|
||||
const PQ &CPhysicalQuantity<MU, PQ>::makePositive()
|
||||
{
|
||||
if (this->isNull() || m_value == 0) { return *this->derived(); }
|
||||
if (m_value < 0) { m_value *= -1.0; }
|
||||
return *this->derived();
|
||||
}
|
||||
@@ -150,6 +151,7 @@ namespace BlackMisc
|
||||
template <class MU, class PQ>
|
||||
const PQ &CPhysicalQuantity<MU, PQ>::makeNegative()
|
||||
{
|
||||
if (this->isNull() || m_value == 0) { return *this->derived(); }
|
||||
if (m_value > 0) { m_value *= -1.0; }
|
||||
return *this->derived();
|
||||
}
|
||||
@@ -157,6 +159,7 @@ namespace BlackMisc
|
||||
template<class MU, class PQ>
|
||||
PQ CPhysicalQuantity<MU, PQ>::abs() const
|
||||
{
|
||||
if (this->isNull() || m_value == 0) { return *this->derived(); }
|
||||
if (m_value >= 0) { return *this->derived(); }
|
||||
PQ copy(*this->derived());
|
||||
return copy.makePositive();
|
||||
|
||||
Reference in New Issue
Block a user