mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
Fixed Doxygen comments
This commit is contained in:
@@ -13,7 +13,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Own implementation for streaming
|
||||
*/
|
||||
QString CAltitude::stringForStreamingOperator() const
|
||||
@@ -22,7 +22,7 @@ QString CAltitude::stringForStreamingOperator() const
|
||||
return s.append(this->m_msl ? " MSL" : " AGL");
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment
|
||||
*/
|
||||
CAltitude& CAltitude::operator =(const CAltitude &otherAltitude)
|
||||
@@ -34,7 +34,7 @@ CAltitude& CAltitude::operator =(const CAltitude &otherAltitude)
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CAltitude::operator ==(const CAltitude &otherAltitude)
|
||||
@@ -42,7 +42,7 @@ bool CAltitude::operator ==(const CAltitude &otherAltitude)
|
||||
return otherAltitude.m_msl == this->m_msl && CLength::operator ==(otherAltitude);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CAltitude::operator !=(const CAltitude &otherAltitude)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Aviation
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief Altitude as used in aviation, can be AGL or MSL Altitude
|
||||
* \brief Altitude as used in aviation, can be AGL or MSL altitude
|
||||
* \remarks Intentionally allowing +/- CLength , and >= / <= CLength.
|
||||
*/
|
||||
class CAltitude : public BlackMisc::PhysicalQuantities::CLength
|
||||
@@ -49,10 +49,11 @@ public:
|
||||
CAltitude(int value, bool msl, const BlackMisc::PhysicalQuantities::CLengthUnit &unit) : CLength(value, unit), m_msl(msl) {}
|
||||
/*!
|
||||
* \brief Constructor by CLength
|
||||
* \param Altitude
|
||||
* \param altitude
|
||||
* \param msl
|
||||
*/
|
||||
CAltitude(BlackMisc::PhysicalQuantities::CLength altitude, bool msl) : BlackMisc::PhysicalQuantities::CLength(), m_msl(msl) {
|
||||
CAltitude(BlackMisc::PhysicalQuantities::CLength altitude, bool msl) : BlackMisc::PhysicalQuantities::CLength(), m_msl(msl)
|
||||
{
|
||||
BlackMisc::PhysicalQuantities::CLength::operator =(altitude);
|
||||
}
|
||||
/*!
|
||||
@@ -62,19 +63,19 @@ public:
|
||||
CAltitude(const CAltitude &otherAltitude) : BlackMisc::PhysicalQuantities::CLength(otherAltitude), m_msl(otherAltitude.m_msl) {}
|
||||
/*!
|
||||
* \brief Assignment operator =
|
||||
* \param otherQuantity
|
||||
* \param otherAltitude
|
||||
* @return
|
||||
*/
|
||||
CAltitude &operator =(const CAltitude &otherAltitude);
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherAltitude
|
||||
* @return
|
||||
*/
|
||||
bool operator ==(const CAltitude &otherAltitude);
|
||||
/*!
|
||||
* \brief Unequal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherAltitude
|
||||
* @return
|
||||
*/
|
||||
bool operator !=(const CAltitude &otherAltitude);
|
||||
@@ -82,14 +83,16 @@ public:
|
||||
* \brief AGL Above ground level?
|
||||
* \return
|
||||
*/
|
||||
bool isAboveGroundLevel() const {
|
||||
bool isAboveGroundLevel() const
|
||||
{
|
||||
return !this->m_msl;
|
||||
}
|
||||
/*!
|
||||
* \brief MSL Mean sea level?
|
||||
* \return
|
||||
*/
|
||||
bool isMeanSeaLevel() const {
|
||||
bool isMeanSeaLevel() const
|
||||
{
|
||||
return this->m_msl;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Own implementation for streaming
|
||||
*/
|
||||
QString CHeading::stringForStreamingOperator() const
|
||||
@@ -22,7 +22,7 @@ QString CHeading::stringForStreamingOperator() const
|
||||
return s.append(this->m_magnetic ? " magnetic" : " true");
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment
|
||||
*/
|
||||
CHeading& CHeading::operator =(const CHeading &otherHeading)
|
||||
@@ -34,7 +34,7 @@ CHeading& CHeading::operator =(const CHeading &otherHeading)
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CHeading::operator ==(const CHeading &otherHeading)
|
||||
@@ -42,7 +42,7 @@ bool CHeading::operator ==(const CHeading &otherHeading)
|
||||
return otherHeading.m_magnetic == this->m_magnetic && CAngle::operator ==(otherHeading);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CHeading::operator !=(const CHeading &otherHeading)
|
||||
|
||||
@@ -61,19 +61,19 @@ public:
|
||||
CHeading(const CHeading &otherHeading) : CAngle(otherHeading), m_magnetic(otherHeading.m_magnetic) {}
|
||||
/*!
|
||||
* \brief Assignment operator =
|
||||
* \param otherQuantity
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
CHeading &operator =(const CHeading &otherHeading);
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
bool operator ==(const CHeading &otherHeading);
|
||||
/*!
|
||||
* \brief Unequal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
bool operator !=(const CHeading &otherHeading);
|
||||
|
||||
@@ -24,7 +24,8 @@ private:
|
||||
* \param f
|
||||
* \return
|
||||
*/
|
||||
bool isValidFrequency(CFrequency f) const {
|
||||
bool isValidFrequency(CFrequency f) const
|
||||
{
|
||||
double fr = f.valueRounded(CFrequencyUnit::kHz(), this->m_digits);
|
||||
return fr >= 190.0 && fr <= 1750.0;
|
||||
}
|
||||
@@ -38,7 +39,8 @@ private:
|
||||
*
|
||||
*/
|
||||
CAdfSystem(bool validate, const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency, int digits = 3):
|
||||
CModulator(name, activeFrequency, standbyFrequency, digits) {
|
||||
CModulator(name, activeFrequency, standbyFrequency, digits)
|
||||
{
|
||||
this->validate(validate);
|
||||
}
|
||||
|
||||
@@ -47,20 +49,23 @@ protected:
|
||||
* \brief Are the set values valid / in range?
|
||||
* \return
|
||||
*/
|
||||
bool validValues() const {
|
||||
bool validValues() const
|
||||
{
|
||||
if (this->isDefaultValue()) return true; // special case
|
||||
return
|
||||
(this->isValidFrequency(this->getFrequencyActive()) &&
|
||||
(this->isValidFrequency(this->getFrequencyStandby());
|
||||
(this->isValidFrequency(this->getFrequencyStandby())));
|
||||
}
|
||||
/*!
|
||||
* \brief Validate values by assert and exception
|
||||
* \param strict
|
||||
* \throws std::range_error
|
||||
* \remarks Cannot be virtualsince already used in constructor
|
||||
* \return
|
||||
*/
|
||||
bool validate(bool strict = true) const {
|
||||
|
||||
/*!
|
||||
* \brief Validate values by assert and exception
|
||||
* \param strict
|
||||
* \throws std::range_error
|
||||
* \remarks Cannot be virtualsince already used in constructor
|
||||
* \return
|
||||
*/
|
||||
bool validate(bool strict = true) const
|
||||
{
|
||||
if (this->isDefaultValue()) return true;
|
||||
bool valid = this->validValues();
|
||||
if (!strict) return valid;
|
||||
@@ -86,14 +91,16 @@ public:
|
||||
* \param digits
|
||||
*/
|
||||
CAdfSystem(const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency = CModulator::FrequencyNotSet(), int digits = 3):
|
||||
CModulator(name, activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency, digits) {
|
||||
CModulator(name, activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency, digits)
|
||||
{
|
||||
this->validate(true);
|
||||
}
|
||||
/*!
|
||||
* \brief Set active frequency
|
||||
* \param frequencyKHz
|
||||
*/
|
||||
void setFrequencyActiveKHz(double frequencyKHz) {
|
||||
void setFrequencyActiveKHz(double frequencyKHz)
|
||||
{
|
||||
CModulator::setFrequencyActiveKHz(frequencyKHz);
|
||||
this->validate(true);
|
||||
}
|
||||
@@ -101,7 +108,8 @@ public:
|
||||
* \brief Set standby frequency
|
||||
* \param frequencyKHz
|
||||
*/
|
||||
void setFrequencyActiveKHz(double frequencyKHz) {
|
||||
void setFrequencyActiveKHz(double frequencyKHz)
|
||||
{
|
||||
CModulator::setFrequencyStandbyKHz(frequencyKHz);
|
||||
this->validate(true);
|
||||
}
|
||||
@@ -110,7 +118,8 @@ public:
|
||||
* \param otherSystem
|
||||
* \return
|
||||
*/
|
||||
CAdfSystem& operator =(const CAdfSystem &otherSystem) {
|
||||
CAdfSystem &operator =(const CAdfSystem &otherSystem)
|
||||
{
|
||||
CModulator::operator =(otherSystem);
|
||||
return (*this);
|
||||
}
|
||||
@@ -119,7 +128,8 @@ public:
|
||||
* \param otherSystem
|
||||
* \return
|
||||
*/
|
||||
bool operator ==(const CAdfSystem &otherSystem) const {
|
||||
bool operator ==(const CAdfSystem &otherSystem) const
|
||||
{
|
||||
return CModulator::operator ==(otherSystem);
|
||||
}
|
||||
/*!
|
||||
@@ -127,7 +137,8 @@ public:
|
||||
* \param otherSystem
|
||||
* \return
|
||||
*/
|
||||
bool operator !=(const CAdfSystem &otherSystem) const {
|
||||
bool operator !=(const CAdfSystem &otherSystem) const
|
||||
{
|
||||
return CModulator::operator !=(otherSystem);
|
||||
}
|
||||
|
||||
@@ -140,7 +151,8 @@ public:
|
||||
* \param standbyFrequencyKHz
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdfSystem(CAdfSystem &adfSystem, const QString &name, double activeFrequencyKHz, double standbyFrequencyKHz = -1) {
|
||||
static bool tryGetAdfSystem(CAdfSystem &adfSystem, const QString &name, double activeFrequencyKHz, double standbyFrequencyKHz = -1)
|
||||
{
|
||||
adfSystem = CAdfSystem(false, name, CFrequency(activeFrequencyKHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyKHz < 0 ? activeFrequencyKHz : standbyFrequencyKHz, CFrequencyUnit::MHz()));
|
||||
bool s;
|
||||
if (!(s = adfSystem.validate(false))) adfSystem = CAdfSystem(); // reset to default
|
||||
@@ -156,7 +168,8 @@ public:
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdfSystem(CAdfSystem &adfSystem, const QString &name, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
static bool tryGetAdfSystem(CAdfSystem &adfSystem, const QString &name, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet())
|
||||
{
|
||||
adfSystem = CAdfSystem(false, name, activeFrequency, standbyFrequency);
|
||||
bool s;
|
||||
if (!(s = adfSystem.validate(false))) adfSystem = CAdfSystem(); // reset to default
|
||||
@@ -168,7 +181,8 @@ public:
|
||||
* \param standbyFrequencyKHz
|
||||
* \return
|
||||
*/
|
||||
static CAdfSystem GetAdf1System(double activeFrequencyKHz, double standbyFrequencyKHz = -1) {
|
||||
static CAdfSystem GetAdf1System(double activeFrequencyKHz, double standbyFrequencyKHz = -1)
|
||||
{
|
||||
return CAdfSystem(CModulator::NameCom1(), CFrequency(activeFrequencyKHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyKHz < 0 ? activeFrequencyKHz : standbyFrequencyKHz, CFrequencyUnit::MHz()));
|
||||
}
|
||||
/*!
|
||||
@@ -177,7 +191,8 @@ public:
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
*/
|
||||
static CAdfSystem GetAdf1System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
static CAdfSystem GetAdf1System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet())
|
||||
{
|
||||
return CAdfSystem(CModulator::NameCom1(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
|
||||
}
|
||||
/*!
|
||||
@@ -187,7 +202,8 @@ public:
|
||||
* \param standbyFrequencyKHz
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdf1Unit(CAdfSystem &adfSystem, double activeFrequencyKHz, double standbyFrequencyKHz = -1) {
|
||||
static bool tryGetAdf1Unit(CAdfSystem &adfSystem, double activeFrequencyKHz, double standbyFrequencyKHz = -1)
|
||||
{
|
||||
return CAdfSystem::tryGetAdfSystem(adfSystem, CModulator::NameCom1(), activeFrequencyKHz, standbyFrequencyKHz);
|
||||
}
|
||||
/*!
|
||||
@@ -197,7 +213,8 @@ public:
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdf1Unit(CAdfSystem &adfSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
static bool tryGetAdf1Unit(CAdfSystem &adfSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet())
|
||||
{
|
||||
return CAdfSystem::tryGetAdfSystem(adfSystem, CModulator::NameCom1(), activeFrequency, standbyFrequency);
|
||||
}
|
||||
/*!
|
||||
@@ -206,7 +223,8 @@ public:
|
||||
* \param standbyFrequencyKHz
|
||||
* \return
|
||||
*/
|
||||
static CAdfSystem GetAdf2System(double activeFrequencyKHz, double standbyFrequencyKHz = -1) {
|
||||
static CAdfSystem GetAdf2System(double activeFrequencyKHz, double standbyFrequencyKHz = -1)
|
||||
{
|
||||
return CAdfSystem(CModulator::NameCom2(), CFrequency(activeFrequencyKHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyKHz < 0 ? activeFrequencyKHz : standbyFrequencyKHz, CFrequencyUnit::MHz()));
|
||||
}
|
||||
/*!
|
||||
@@ -215,7 +233,8 @@ public:
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
*/
|
||||
static CAdfSystem GetAdf2System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
static CAdfSystem GetAdf2System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet())
|
||||
{
|
||||
return CAdfSystem(CModulator::NameCom2(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
|
||||
}
|
||||
/*!
|
||||
@@ -225,7 +244,8 @@ public:
|
||||
* \param standbyFrequencyKHz
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdf2System(CAdfSystem &adfSystem, double activeFrequencyKHz, double standbyFrequencyKHz = -1) {
|
||||
static bool tryGetAdf2System(CAdfSystem &adfSystem, double activeFrequencyKHz, double standbyFrequencyKHz = -1)
|
||||
{
|
||||
return CAdfSystem::tryGetAdfSystem(adfSystem, CModulator::NameCom2(), activeFrequencyKHz, standbyFrequencyKHz);
|
||||
}
|
||||
/*!
|
||||
@@ -235,7 +255,8 @@ public:
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetAdf2System(CAdfSystem &adfSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
static bool tryGetAdf2System(CAdfSystem &adfSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet())
|
||||
{
|
||||
return CAdfSystem::tryGetAdfSystem(adfSystem, CModulator::NameCom2(), activeFrequency, standbyFrequency);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Toggle standby <-> active
|
||||
*/
|
||||
template <class AVIO> void CModulator<AVIO>::toggleActiveStandby()
|
||||
@@ -25,7 +25,7 @@ template <class AVIO> void CModulator<AVIO>::toggleActiveStandby()
|
||||
this->m_frequencyStandby = a;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* String representation
|
||||
*/
|
||||
template <class AVIO> QString CModulator<AVIO>::stringForStreamingOperator() const
|
||||
@@ -36,7 +36,7 @@ template <class AVIO> QString CModulator<AVIO>::stringForStreamingOperator() con
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment operator =
|
||||
*/
|
||||
template <class AVIO> CModulator<AVIO>& CModulator<AVIO>::operator=(const CModulator<AVIO> &otherModulator)
|
||||
@@ -50,7 +50,7 @@ template <class AVIO> CModulator<AVIO>& CModulator<AVIO>::operator=(const CModul
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal operator ==
|
||||
*/
|
||||
template <class AVIO> bool CModulator<AVIO>::operator ==(const CModulator<AVIO> &otherModulator) const
|
||||
@@ -61,7 +61,7 @@ template <class AVIO> bool CModulator<AVIO>::operator ==(const CModulator<AVIO>
|
||||
this->m_frequencyStandby == otherModulator.m_frequencyStandby);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal operator !=
|
||||
*/
|
||||
template <class AVIO> bool CModulator<AVIO>::operator !=(const CModulator<AVIO> &otherModulator) const
|
||||
|
||||
@@ -40,6 +40,7 @@ protected:
|
||||
* \param name
|
||||
* \param activeFrequency
|
||||
* \param standbyFrequency
|
||||
* \param digits
|
||||
*/
|
||||
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits) :
|
||||
m_frequencyActive(activeFrequency),
|
||||
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
}
|
||||
/*!
|
||||
* \brief Try to get NAV unit
|
||||
* \param comSystem
|
||||
* \param navSystem
|
||||
* \param activeFrequency
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
/*!
|
||||
* \brief Try to get NAV unit
|
||||
* \param comSystem
|
||||
* \param navSystem
|
||||
* \param activeFrequency
|
||||
* \param standbyFrequency
|
||||
* \return
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
* \brief Constructor
|
||||
* \param name
|
||||
* \param transponderCode
|
||||
* \param transponderMode
|
||||
*/
|
||||
CTransponder(const QString &name, qint32 transponderCode, TransponderMode transponderMode) :
|
||||
CAvionicsBase(name), m_transponderCode(transponderCode), m_transponderMode(transponderMode) {
|
||||
@@ -108,6 +109,7 @@ public:
|
||||
* \brief Constructor
|
||||
* \param name
|
||||
* \param transponderCode
|
||||
* \param transponderMode
|
||||
*/
|
||||
CTransponder(const QString &name, const QString &transponderCode, TransponderMode transponderMode) :
|
||||
CAvionicsBase(name), m_transponderCode(0), m_transponderMode(transponderMode) {
|
||||
@@ -226,8 +228,8 @@ public:
|
||||
* has been sucessfully created, otherwise returns a default object.
|
||||
* \param transponder
|
||||
* \param name
|
||||
* \param activeFrequency
|
||||
* \param standbyFrequency
|
||||
* \param transponderCode
|
||||
* \param mode
|
||||
* \return
|
||||
*/
|
||||
static bool tryGetTransponder(CTransponder &transponder, const QString &name, const QString &transponderCode, TransponderMode mode) {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Own implementation for streaming
|
||||
*/
|
||||
QString CTrack::stringForStreamingOperator() const
|
||||
@@ -22,7 +22,7 @@ QString CTrack::stringForStreamingOperator() const
|
||||
return s.append(this->m_magnetic ? " magnetic" : " true");
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment
|
||||
*/
|
||||
CTrack& CTrack::operator =(const CTrack &otherTrack)
|
||||
@@ -34,7 +34,7 @@ CTrack& CTrack::operator =(const CTrack &otherTrack)
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CTrack::operator ==(const CTrack &otherTrack)
|
||||
@@ -42,7 +42,7 @@ bool CTrack::operator ==(const CTrack &otherTrack)
|
||||
return otherTrack.m_magnetic == this->m_magnetic && CAngle::operator ==(otherTrack);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CTrack::operator !=(const CTrack &otherTrack)
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
CTrack(int value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : BlackMisc::PhysicalQuantities::CAngle(value, unit), m_magnetic(magnetic) {}
|
||||
/*!
|
||||
* \brief Constructor by CAngle
|
||||
* \param Track
|
||||
* \param track
|
||||
* \param magnetic
|
||||
*/
|
||||
CTrack(BlackMisc::PhysicalQuantities::CAngle track, bool magnetic) : BlackMisc::PhysicalQuantities::CAngle(), m_magnetic(magnetic) {
|
||||
@@ -63,19 +63,19 @@ public:
|
||||
CTrack(const CTrack &otherTrack) : BlackMisc::PhysicalQuantities::CAngle(otherTrack), m_magnetic(otherTrack.m_magnetic) {}
|
||||
/*!
|
||||
* \brief Assignment operator =
|
||||
* \param otherQuantity
|
||||
* \param otherTrack
|
||||
* @return
|
||||
*/
|
||||
CTrack &operator =(const CTrack &otherTrack);
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherTrack
|
||||
* @return
|
||||
*/
|
||||
bool operator ==(const CTrack &otherTrack);
|
||||
/*!
|
||||
* \brief Unequal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherTrack
|
||||
* @return
|
||||
*/
|
||||
bool operator !=(const CTrack &otherTrack);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAviationVerticalPositions::CAviationVerticalPositions() :
|
||||
@@ -25,7 +25,7 @@ CAviationVerticalPositions::CAviationVerticalPositions() :
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAviationVerticalPositions::CAviationVerticalPositions(const CAltitude &altitude, const CLength &elevation, const CLength &height) :
|
||||
@@ -34,7 +34,7 @@ CAviationVerticalPositions::CAviationVerticalPositions(const CAltitude &altitude
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Copy constructor
|
||||
*/
|
||||
CAviationVerticalPositions::CAviationVerticalPositions(const CAviationVerticalPositions &otherPosition) :
|
||||
@@ -43,7 +43,7 @@ CAviationVerticalPositions::CAviationVerticalPositions(const CAviationVerticalPo
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment
|
||||
*/
|
||||
CAviationVerticalPositions &CAviationVerticalPositions::operator =(const CAviationVerticalPositions &otherPositions)
|
||||
@@ -55,7 +55,7 @@ CAviationVerticalPositions &CAviationVerticalPositions::operator =(const CAviati
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal operator
|
||||
*/
|
||||
bool CAviationVerticalPositions::operator ==(const CAviationVerticalPositions &otherPositions)
|
||||
@@ -65,7 +65,7 @@ bool CAviationVerticalPositions::operator ==(const CAviationVerticalPositions &o
|
||||
this->m_height == otherPositions.m_height;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Unequal operator
|
||||
*/
|
||||
bool CAviationVerticalPositions::operator !=(const CAviationVerticalPositions &otherPositions)
|
||||
@@ -73,7 +73,7 @@ bool CAviationVerticalPositions::operator !=(const CAviationVerticalPositions &o
|
||||
return !(*this == otherPositions);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* String representation for streaming
|
||||
*/
|
||||
QString CAviationVerticalPositions::stringForStreamingOperator() const
|
||||
@@ -87,7 +87,7 @@ QString CAviationVerticalPositions::stringForStreamingOperator() const
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Factory by elevation and altitude
|
||||
*/
|
||||
CAviationVerticalPositions CAviationVerticalPositions::fromAltitudeAndElevationInFt(double altitudeMslFt, double elevationFt)
|
||||
@@ -98,7 +98,7 @@ CAviationVerticalPositions CAviationVerticalPositions::fromAltitudeAndElevationI
|
||||
return CAviationVerticalPositions(a, e, h);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Factory by elevation and altitude
|
||||
*/
|
||||
CAviationVerticalPositions CAviationVerticalPositions::fromAltitudeAndElevationInM(double altitudeMslM, double elevationM)
|
||||
@@ -109,7 +109,7 @@ CAviationVerticalPositions CAviationVerticalPositions::fromAltitudeAndElevationI
|
||||
return CAviationVerticalPositions(a, e, h);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Stream for log message
|
||||
*/
|
||||
CLogMessage operator <<(CLogMessage log, const CAviationVerticalPositions &positions)
|
||||
@@ -118,7 +118,7 @@ CLogMessage operator <<(CLogMessage log, const CAviationVerticalPositions &posit
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Stream for qDebug
|
||||
*/
|
||||
QDebug operator <<(QDebug d, const CAviationVerticalPositions &positions)
|
||||
|
||||
@@ -22,7 +22,7 @@ class CAviationVerticalPositions
|
||||
/*!
|
||||
* \brief Stream << overload to be used in debugging messages
|
||||
* \param d
|
||||
* \param unit
|
||||
* \param positions
|
||||
* \return
|
||||
*/
|
||||
friend QDebug operator<<(QDebug d, const CAviationVerticalPositions &positions);
|
||||
@@ -31,7 +31,7 @@ class CAviationVerticalPositions
|
||||
* Stream operator for log messages
|
||||
* \brief operator <<
|
||||
* \param log
|
||||
* \param unit
|
||||
* \param positions
|
||||
* \return
|
||||
*/
|
||||
friend CLogMessage operator<<(CLogMessage log, const CAviationVerticalPositions &positions);
|
||||
@@ -67,19 +67,19 @@ public:
|
||||
CAviationVerticalPositions(const CAviationVerticalPositions &otherPosition);
|
||||
/*!
|
||||
* \brief Assignment operator =
|
||||
* \param otherQuantity
|
||||
* \param otherPositions
|
||||
* @return
|
||||
*/
|
||||
CAviationVerticalPositions &operator =(const CAviationVerticalPositions &otherPositions);
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherPositions
|
||||
* @return
|
||||
*/
|
||||
bool operator ==(const CAviationVerticalPositions &otherPositions);
|
||||
/*!
|
||||
* \brief Unequal operator ==
|
||||
* \param otherQuantity
|
||||
* \param otherPositions
|
||||
* @return
|
||||
*/
|
||||
bool operator !=(const CAviationVerticalPositions &otherPositions);
|
||||
@@ -87,21 +87,24 @@ public:
|
||||
* \brief Height
|
||||
* \return
|
||||
*/
|
||||
BlackMisc::PhysicalQuantities::CLength getHeight() const {
|
||||
BlackMisc::PhysicalQuantities::CLength getHeight() const
|
||||
{
|
||||
return this->m_height;
|
||||
}
|
||||
/*!
|
||||
* \brief Elevation
|
||||
* \return
|
||||
*/
|
||||
BlackMisc::PhysicalQuantities::CLength getElevation() const {
|
||||
BlackMisc::PhysicalQuantities::CLength getElevation() const
|
||||
{
|
||||
return this->m_elevation;
|
||||
}
|
||||
/*!
|
||||
* \brief Altitude
|
||||
* \return
|
||||
*/
|
||||
CAltitude getAltitude()const {
|
||||
CAltitude getAltitude()const
|
||||
{
|
||||
return this->m_altitude;
|
||||
}
|
||||
/*!
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
#ifndef BLACKMISC_H
|
||||
#define BLACKMISC_H
|
||||
#ifndef BLACKMISC_NAMESPACES_H
|
||||
#define BLACKMISC_NAMESPACES_H
|
||||
|
||||
// just a dummy header, namespace documentation will go here
|
||||
/*! \file */
|
||||
|
||||
/**
|
||||
* @namespace Aviation
|
||||
* Aviation and Avionics classes such as CHeading or CTransponder
|
||||
/*!
|
||||
* \namespace BlackMisc::Aviation
|
||||
* \brief Aviation and Avionics classes such as CHeading or CTransponder .
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::PhysicalQuantities
|
||||
* \brief Classes for physical quantities and units such as length, mass, speed.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BlackMisc
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
/*!
|
||||
* \brief Physical unit degree
|
||||
* \brief Physical unit angle (radians, degrees)
|
||||
* \author KWB
|
||||
*/
|
||||
class CAngle : public CPhysicalQuantity<CAngleUnit, CAngle>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace PhysicalQuantities
|
||||
// --- Mulitplier --------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CMeasurementPrefix::CMeasurementPrefix(const QString &name, const QString &unitName, double factor):
|
||||
@@ -23,7 +23,7 @@ CMeasurementPrefix::CMeasurementPrefix(const QString &name, const QString &unitN
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CMeasurementPrefix::CMeasurementPrefix(const CMeasurementPrefix &otherMultiplier) :
|
||||
@@ -32,7 +32,7 @@ CMeasurementPrefix::CMeasurementPrefix(const CMeasurementPrefix &otherMultiplier
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assignment operator
|
||||
*/
|
||||
CMeasurementPrefix& CMeasurementPrefix::operator=(const CMeasurementPrefix &otherMultiplier)
|
||||
@@ -45,7 +45,7 @@ CMeasurementPrefix& CMeasurementPrefix::operator=(const CMeasurementPrefix &othe
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CMeasurementPrefix::operator ==(const CMeasurementPrefix &otherMultiplier) const
|
||||
@@ -54,7 +54,7 @@ bool CMeasurementPrefix::operator ==(const CMeasurementPrefix &otherMultiplier)
|
||||
return this->m_factor == otherMultiplier.m_factor && this->m_name == otherMultiplier.m_name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Not equal
|
||||
*/
|
||||
bool CMeasurementPrefix::operator !=(const CMeasurementPrefix &otherMultiplier) const
|
||||
@@ -62,7 +62,7 @@ bool CMeasurementPrefix::operator !=(const CMeasurementPrefix &otherMultiplier)
|
||||
return !(*this == otherMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Greater?
|
||||
*/
|
||||
bool CMeasurementPrefix::operator >(const CMeasurementPrefix &otherMultiplier) const
|
||||
@@ -70,7 +70,7 @@ bool CMeasurementPrefix::operator >(const CMeasurementPrefix &otherMultiplier) c
|
||||
return this->m_factor > otherMultiplier.m_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Less?
|
||||
*/
|
||||
bool CMeasurementPrefix::operator <(const CMeasurementPrefix &otherMultiplier) const
|
||||
@@ -78,7 +78,7 @@ bool CMeasurementPrefix::operator <(const CMeasurementPrefix &otherMultiplier) c
|
||||
return this->m_factor < otherMultiplier.m_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Stream to debug
|
||||
*/
|
||||
QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier)
|
||||
@@ -87,7 +87,7 @@ QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier)
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Log to debug
|
||||
*/
|
||||
CLogMessage operator<<(CLogMessage log, const CMeasurementPrefix &multiplier)
|
||||
@@ -100,7 +100,7 @@ CLogMessage operator<<(CLogMessage log, const CMeasurementPrefix &multiplier)
|
||||
// --- Measurement unit --------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CMeasurementUnit::CMeasurementUnit(const QString &name, const QString &unitName, const QString &type, bool isSIUnit, bool isSIBaseUnit,
|
||||
@@ -124,7 +124,7 @@ CMeasurementUnit::CMeasurementUnit(const CMeasurementUnit &otherUnit):
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment operator
|
||||
*/
|
||||
CMeasurementUnit &CMeasurementUnit::operator =(const CMeasurementUnit &otherUnit)
|
||||
@@ -144,7 +144,7 @@ CMeasurementUnit &CMeasurementUnit::operator =(const CMeasurementUnit &otherUnit
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal operator
|
||||
*/
|
||||
bool CMeasurementUnit::operator ==(const CMeasurementUnit &otherUnit) const
|
||||
@@ -155,7 +155,7 @@ bool CMeasurementUnit::operator ==(const CMeasurementUnit &otherUnit) const
|
||||
&& this->m_isSiUnit == otherUnit.m_isSiUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Stream to debug
|
||||
*/
|
||||
QDebug operator <<(QDebug d, const CMeasurementUnit &unit)
|
||||
@@ -164,7 +164,7 @@ QDebug operator <<(QDebug d, const CMeasurementUnit &unit)
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Stream to log
|
||||
*/
|
||||
CLogMessage operator<<(CLogMessage log, const CMeasurementUnit &unit)
|
||||
@@ -173,7 +173,7 @@ CLogMessage operator<<(CLogMessage log, const CMeasurementUnit &unit)
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Unequal operator
|
||||
*/
|
||||
bool CMeasurementUnit::operator !=(const CMeasurementUnit &otherUnit) const
|
||||
@@ -181,7 +181,7 @@ bool CMeasurementUnit::operator !=(const CMeasurementUnit &otherUnit) const
|
||||
return !(otherUnit == *this);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Conversion factor from unit x to y
|
||||
*/
|
||||
double CMeasurementUnit::conversionToUnit(double value, const CMeasurementUnit &to) const
|
||||
@@ -191,7 +191,7 @@ double CMeasurementUnit::conversionToUnit(double value, const CMeasurementUnit &
|
||||
return to.convertFromSiConversionUnit(siValue);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Value to QString with unit, e.g. "5.00m"
|
||||
* @return
|
||||
*/
|
||||
@@ -200,7 +200,7 @@ QString CMeasurementUnit::valueRoundedWithUnit(double value, int digits) const
|
||||
return this->toQStringRounded(value, digits).append(this->getUnitName());
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Value rounded
|
||||
*/
|
||||
double CMeasurementUnit::valueRounded(double value, int digits) const
|
||||
@@ -209,7 +209,7 @@ double CMeasurementUnit::valueRounded(double value, int digits) const
|
||||
return CMeasurementUnit::round(value, digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Rounded to QString
|
||||
*/
|
||||
QString CMeasurementUnit::toQStringRounded(double value, int digits) const
|
||||
@@ -220,7 +220,7 @@ QString CMeasurementUnit::toQStringRounded(double value, int digits) const
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Round utility method
|
||||
*/
|
||||
double CMeasurementUnit::round(double value, int digits)
|
||||
@@ -232,7 +232,7 @@ double CMeasurementUnit::round(double value, int digits)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Epsilon rounding
|
||||
*/
|
||||
double CMeasurementUnit::epsilonRounding(double value) const
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*!
|
||||
* Typical prefixes (multipliers) such as kilo, mega, hecto.
|
||||
* \brief Typical prefixes (multipliers) such as kilo, mega, hecto.
|
||||
* See <a href="http://www.poynton.com/notes/units/index.html">here</a> for an overview.
|
||||
* Use the static values such CMeasurementMultiplier::k() as to specify values.
|
||||
* \author KWB
|
||||
@@ -32,8 +32,7 @@ class CMeasurementPrefix
|
||||
*/
|
||||
friend QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier);
|
||||
/*!
|
||||
* Stream operator for log messages
|
||||
* \brief operator <<
|
||||
* \brief Stream operator << for log messages
|
||||
* \param log
|
||||
* \param multiplier
|
||||
* \return
|
||||
@@ -197,8 +196,8 @@ public:
|
||||
// --- Unit
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Base class for all units, such as meter, hertz.
|
||||
/*!
|
||||
* \brief Base class for all units, such as meter, hertz.
|
||||
*/
|
||||
class CMeasurementUnit
|
||||
{
|
||||
@@ -212,8 +211,7 @@ class CMeasurementUnit
|
||||
friend QDebug operator<<(QDebug d, const CMeasurementUnit &unit);
|
||||
|
||||
/*!
|
||||
* Stream operator for log messages
|
||||
* \brief operator <<
|
||||
* \brief Stream operator << for log messages
|
||||
* \param log
|
||||
* \param unit
|
||||
* \return
|
||||
@@ -236,8 +234,8 @@ private:
|
||||
double m_epsilon; //!< values with differences below epsilon are the equal
|
||||
qint32 m_displayDigits; //!< standard rounding for string conversions
|
||||
CMeasurementPrefix m_multiplier; //!< multiplier (kilo, Mega)
|
||||
UnitConverter m_toSiConverter;
|
||||
UnitConverter m_fromSiConverter;
|
||||
UnitConverter m_toSiConverter; //! allows an arbitrary conversion method as per object
|
||||
UnitConverter m_fromSiConverter; //! allows an arbitrary conversion method as per object
|
||||
|
||||
protected:
|
||||
|
||||
@@ -245,12 +243,15 @@ protected:
|
||||
* Constructor by parameter
|
||||
* \param name
|
||||
* \param unitName
|
||||
* \param isSIUnit
|
||||
* \param isSIBaseUnit
|
||||
* \param type
|
||||
* \param isSiUnit
|
||||
* \param isSiBaseUnit
|
||||
* \param conversionFactorToSI
|
||||
* \param multiplier
|
||||
* \param displayDigits
|
||||
* \param epsilon
|
||||
* \param toSiConverter
|
||||
* \param fromSiConverter
|
||||
*/
|
||||
CMeasurementUnit(const QString &name, const QString &unitName, const QString &type, bool isSiUnit, bool isSiBaseUnit, double conversionFactorToSI = 1,
|
||||
const CMeasurementPrefix &multiplier = CMeasurementPrefix::None(), qint32 displayDigits = 2,
|
||||
@@ -285,7 +286,7 @@ protected:
|
||||
}
|
||||
/*!
|
||||
* \brief Value from SI conversion unit to this unit.
|
||||
* Standard implementaion is simply factor based.
|
||||
* Standard implementation is simply factor based.
|
||||
* \param value
|
||||
* \return
|
||||
*/
|
||||
@@ -348,7 +349,6 @@ public:
|
||||
QString getType() const {
|
||||
return this->m_type;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Given value to conversion SI conversion unit (e.g. meter, hertz).
|
||||
* Standard implementation is simply factor based.
|
||||
@@ -412,6 +412,7 @@ public:
|
||||
}
|
||||
/*!
|
||||
* \brief Factor to convert to given unit
|
||||
* \param value
|
||||
* \param to
|
||||
* \return
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
/*!
|
||||
* \brief Physical quantities constants
|
||||
*/
|
||||
class CPhysicalQuantitiesConstants
|
||||
{
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BlackMisc
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor by integer
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(qint32 baseValue, const MU &unit, const MU &siConversionUnit) :
|
||||
@@ -19,7 +19,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(qint3
|
||||
this->setUnitValue(baseValue);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor by double
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(double baseValue, const MU &unit, const MU &siConversionUnit) :
|
||||
@@ -28,7 +28,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(doubl
|
||||
this->setUnitValue(baseValue);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Copy constructor
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(const CPhysicalQuantity &otherQuantity) :
|
||||
@@ -46,7 +46,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::~CPhysicalQuantity()
|
||||
// void
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Equal operator ==
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator ==(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -73,7 +73,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator ==(const
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Not equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator !=(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -82,7 +82,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator !=(const
|
||||
return !(*this == otherQuantity);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigment operator =
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ>& CPhysicalQuantity<MU, PQ>::operator=(const CPhysicalQuantity<MU, PQ> &otherQuantity)
|
||||
@@ -100,7 +100,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ>& CPhysicalQuantity<MU, P
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Plus operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator +=(const CPhysicalQuantity<MU, PQ> &otherQuantity)
|
||||
@@ -120,7 +120,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, P
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Plus operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator +(const PQ &otherQuantity) const
|
||||
@@ -131,7 +131,7 @@ template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator +(const PQ
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Explicit plus
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::addUnitValue(double value)
|
||||
@@ -139,7 +139,7 @@ template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::addUnitValue(doubl
|
||||
this->setUnitValue(this->m_unitValueD + value);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Explicit minus
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::substractUnitValue(double value)
|
||||
@@ -147,7 +147,7 @@ template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::substractUnitValue
|
||||
this->setUnitValue(this->m_unitValueD - value);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Minus operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator -=(const CPhysicalQuantity<MU, PQ> &otherQuantity)
|
||||
@@ -167,7 +167,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, P
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Minus operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator -(const PQ &otherQuantity) const
|
||||
@@ -178,7 +178,7 @@ template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator -(const PQ
|
||||
return minus;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Multiply operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator *=(double multiply)
|
||||
@@ -187,7 +187,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, P
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Multiply operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator *(double multiply) const
|
||||
@@ -198,7 +198,7 @@ template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator *(double mu
|
||||
return times;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Divide operator /=
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator /=(double divide)
|
||||
@@ -207,7 +207,7 @@ template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, P
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Divide operator /
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator /(double divide) const
|
||||
@@ -218,7 +218,7 @@ template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator /(double di
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Less operator <
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -228,7 +228,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <(const C
|
||||
return (diff < 0 && abs(diff) >= this->m_unit.getEpsilon());
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Greater than
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -237,7 +237,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >(const C
|
||||
return otherQuantity < *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Greater / Equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >=(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -246,7 +246,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >=(const
|
||||
return !(*this < otherQuantity);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Less equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <=(const CPhysicalQuantity<MU, PQ> &otherQuantity) const
|
||||
@@ -255,7 +255,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <=(const
|
||||
return !(*this > otherQuantity);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Switch to another unit
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::switchUnit(const MU &newUnit)
|
||||
@@ -268,7 +268,7 @@ template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::switchUnit(const M
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Init by integer
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setUnitValue(qint32 baseValue)
|
||||
@@ -279,7 +279,7 @@ template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setUnitValue(qint3
|
||||
this->setConversionSiUnitValue();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Init by double
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setUnitValue(double baseValue)
|
||||
@@ -290,7 +290,7 @@ template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setUnitValue(doubl
|
||||
this->setConversionSiUnitValue();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set SI value
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setConversionSiUnitValue()
|
||||
@@ -299,7 +299,7 @@ template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setConversionSiUni
|
||||
this->m_convertedSiUnitValueD = si;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Round
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::unitValueToDoubleRounded(int digits) const
|
||||
@@ -307,7 +307,7 @@ template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::unitValueToDoubl
|
||||
return this->m_unit.valueRounded(this->m_unitValueD, digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Rounded value to QString
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueToQStringRounded(int digits) const
|
||||
@@ -315,7 +315,7 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueToQStr
|
||||
return this->m_unit.toQStringRounded(this->m_unitValueD, digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Rounded with unit
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueRoundedWithUnit(int digits) const
|
||||
@@ -323,7 +323,7 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::unitValueRounde
|
||||
return this->m_unit.valueRoundedWithUnit(this->m_unitValueD, digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Rounded SI value to QString
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValueToQStringRounded(int digits) const
|
||||
@@ -332,7 +332,7 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValu
|
||||
return this->m_conversionSiUnit.toQStringRounded(this->m_convertedSiUnitValueD, digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* SI base unit value with unit
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValueRoundedWithUnit(int digits) const
|
||||
@@ -341,7 +341,7 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertedSiValu
|
||||
return this->convertedSiValueToQStringRounded(digits).append(this->m_conversionSiUnit.getUnitName());
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Value rounded in unit
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::valueRoundedWithUnit(const MU &unit, int digits) const
|
||||
@@ -351,7 +351,7 @@ template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::valueRoundedWit
|
||||
return unit.valueRoundedWithUnit(this->value(unit), digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Value rounded in unit
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::valueRounded(const MU &unit, int digits) const
|
||||
@@ -359,7 +359,7 @@ template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::valueRounded(con
|
||||
return unit.valueRounded(this->value(unit), digits);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Value in unit
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::value(const MU &unit) const
|
||||
@@ -370,7 +370,7 @@ template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::value(const MU &
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Round utility method
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::convertedSiValueToDoubleRounded(int digits) const
|
||||
|
||||
@@ -72,21 +72,19 @@ protected:
|
||||
* \brief Constructor with int
|
||||
* \param baseValue
|
||||
* \param unit
|
||||
* \param siBaseUnit
|
||||
* \param unitConverter
|
||||
* \param siConversionUnit
|
||||
*/
|
||||
CPhysicalQuantity(qint32 baseValue, const MU &unit, const MU &siConversionUnit);
|
||||
/*!
|
||||
* \brief Constructor with double
|
||||
* \param baseValue
|
||||
* \param unit
|
||||
* \param siBaseUnit
|
||||
* \param siConversionUnit
|
||||
*/
|
||||
CPhysicalQuantity(double baseValue, const MU &unit, const MU &siConversionUnit);
|
||||
/*!
|
||||
* \brief Init by integer
|
||||
* \param baseValue
|
||||
* \param unitConverter
|
||||
*/
|
||||
void setUnitValue(qint32 baseValue);
|
||||
/*!
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*!
|
||||
* Speed class, e.g. "m/s", "NM/h", "km/h", "ft/s"
|
||||
* \brief Speed class, e.g. "m/s", "NM/h", "km/h", "ft/s"
|
||||
* \author KWB
|
||||
*/
|
||||
class CSpeed : public CPhysicalQuantity<CSpeedUnit, CSpeed>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*!
|
||||
* Time class, e.g. "ms", "hour", "s", "day"
|
||||
* \brief Time class, e.g. "ms", "hour", "s", "day"
|
||||
* \author KWB
|
||||
*/
|
||||
class CTime : public CPhysicalQuantity<CTimeUnit, CTime>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BlackMisc
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/**
|
||||
/*
|
||||
* Convert to SI
|
||||
*/
|
||||
double CTemperatureUnit::conversionToSiConversionUnit(double value) const
|
||||
@@ -20,7 +20,7 @@ double CTemperatureUnit::conversionToSiConversionUnit(double value) const
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Convert from SI
|
||||
*/
|
||||
double CTemperatureUnit::conversionFromSiConversionUnit(double value) const
|
||||
@@ -30,7 +30,7 @@ double CTemperatureUnit::conversionFromSiConversionUnit(double value) const
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Convert from SI
|
||||
*/
|
||||
double CAngleUnit::conversionSexagesimalFromSi(const CMeasurementUnit &angleUnit, double value)
|
||||
@@ -47,7 +47,7 @@ double CAngleUnit::conversionSexagesimalFromSi(const CMeasurementUnit &angleUnit
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Convert to SI
|
||||
*/
|
||||
double CAngleUnit::conversionSexagesimalToSi(const CMeasurementUnit &, double value)
|
||||
@@ -63,7 +63,7 @@ double CAngleUnit::conversionSexagesimalToSi(const CMeasurementUnit &, double va
|
||||
return v / 180.0 * M_PI;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Rounded to QString
|
||||
*/
|
||||
QString CAngleUnit::toQStringRounded(double value, int digits) const
|
||||
|
||||
@@ -18,8 +18,7 @@ namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*!
|
||||
* Specialized class for distance units (meter, foot, nautical miles).
|
||||
* \author KWB, MS
|
||||
* \brief Specialized class for distance units (meter, foot, nautical miles).
|
||||
*/
|
||||
class CLengthUnit : public CMeasurementUnit
|
||||
{
|
||||
@@ -36,18 +35,25 @@ private:
|
||||
* \param epsilon
|
||||
*/
|
||||
CLengthUnit(const QString &name, const QString &unitName, bool isSIUnit, bool isSIBaseUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
||||
CMeasurementUnit(name, unitName, "distance", isSIUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {
|
||||
CMeasurementUnit(name, unitName, "distance", isSIUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon)
|
||||
{
|
||||
// void
|
||||
}
|
||||
public:
|
||||
CLengthUnit(const CLengthUnit &otherUnit) : CMeasurementUnit(otherUnit) {
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherUnit
|
||||
*/
|
||||
CLengthUnit(const CLengthUnit &otherUnit) : CMeasurementUnit(otherUnit)
|
||||
{
|
||||
// void
|
||||
}
|
||||
/*!
|
||||
* \brief Meter m
|
||||
* \return
|
||||
*/
|
||||
static const CLengthUnit& m() {
|
||||
static const CLengthUnit &m()
|
||||
{
|
||||
static CLengthUnit m("meter", "m", true, true);
|
||||
return m;
|
||||
}
|
||||
@@ -55,7 +61,8 @@ public:
|
||||
* \brief Nautical miles NM
|
||||
* \return
|
||||
*/
|
||||
static const CLengthUnit& NM() {
|
||||
static const CLengthUnit &NM()
|
||||
{
|
||||
static CLengthUnit NM("nautical miles", "NM", false, false, 1000.0 * 1.85200, CMeasurementPrefix::One(), 3);
|
||||
return NM;
|
||||
}
|
||||
@@ -63,7 +70,8 @@ public:
|
||||
* \brief Foot ft
|
||||
* \return
|
||||
*/
|
||||
static const CLengthUnit& ft() {
|
||||
static const CLengthUnit &ft()
|
||||
{
|
||||
static CLengthUnit ft("foot", "ft", false, false, 0.3048, CMeasurementPrefix::One(), 0);
|
||||
return ft;
|
||||
}
|
||||
@@ -71,7 +79,8 @@ public:
|
||||
* \brief Kilometer km
|
||||
* \return
|
||||
*/
|
||||
static const CLengthUnit& km() {
|
||||
static const CLengthUnit &km()
|
||||
{
|
||||
static CLengthUnit km("kilometer", "km", true, false, CMeasurementPrefix::k().getFactor(), CMeasurementPrefix::k(), 3);
|
||||
return km;
|
||||
}
|
||||
@@ -79,14 +88,15 @@ public:
|
||||
* \brief Centimeter cm
|
||||
* \return
|
||||
*/
|
||||
static const CLengthUnit& cm() {
|
||||
static const CLengthUnit &cm()
|
||||
{
|
||||
static CLengthUnit cm("centimeter", "cm", true, false, CMeasurementPrefix::c().getFactor(), CMeasurementPrefix::c(), 1);
|
||||
return cm;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for angles (degrees, radian).
|
||||
* \brief Specialized class for angles (degrees, radian).
|
||||
* \author KWB, MS
|
||||
*/
|
||||
class CAngleUnit : public CMeasurementUnit
|
||||
@@ -106,7 +116,8 @@ private:
|
||||
const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2,
|
||||
double epsilon = 1E-9, UnitConverter converterToSi = nullptr, UnitConverter converterFromSi = nullptr) :
|
||||
CMeasurementUnit(name, unitName, "angle", isSIUnit, false, conversionFactorToSI,
|
||||
mulitplier, displayDigits, epsilon, converterToSi, converterFromSi) {
|
||||
mulitplier, displayDigits, epsilon, converterToSi, converterFromSi)
|
||||
{
|
||||
// void
|
||||
}
|
||||
/*!
|
||||
@@ -139,7 +150,8 @@ public:
|
||||
* \brief Radians
|
||||
* \return
|
||||
*/
|
||||
static const CAngleUnit& rad() {
|
||||
static const CAngleUnit &rad()
|
||||
{
|
||||
static CAngleUnit rad("radian", "rad", true);
|
||||
return rad;
|
||||
}
|
||||
@@ -147,7 +159,8 @@ public:
|
||||
* \brief Degrees
|
||||
* \return
|
||||
*/
|
||||
static const CAngleUnit& deg() {
|
||||
static const CAngleUnit °()
|
||||
{
|
||||
static CAngleUnit deg("degree", "°", false, M_PI / 180);
|
||||
return deg;
|
||||
}
|
||||
@@ -155,14 +168,15 @@ public:
|
||||
* \brief Sexagesimal degree (degree, minute, seconds)
|
||||
* \return
|
||||
*/
|
||||
static const CAngleUnit& sexagesimalDeg() {
|
||||
static const CAngleUnit &sexagesimalDeg()
|
||||
{
|
||||
static CAngleUnit deg("segadecimal degree", "°", false, M_PI / 180,
|
||||
CMeasurementPrefix::One(), 0, 1E-9, CAngleUnit::conversionSexagesimalToSi, CAngleUnit::conversionSexagesimalFromSi); return deg;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
||||
* \brief Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
||||
* \author KWB, MS
|
||||
*/
|
||||
class CFrequencyUnit : public CMeasurementUnit
|
||||
@@ -182,14 +196,20 @@ private:
|
||||
CFrequencyUnit(const QString &name, const QString &unitName, bool isSIUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
||||
CMeasurementUnit(name, unitName, "frequency", isSIUnit, false, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
||||
public:
|
||||
CFrequencyUnit(const CFrequencyUnit &otherUnit) : CMeasurementUnit(otherUnit) {
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherUnit
|
||||
*/
|
||||
CFrequencyUnit(const CFrequencyUnit &otherUnit) : CMeasurementUnit(otherUnit)
|
||||
{
|
||||
// void
|
||||
}
|
||||
/*!
|
||||
* \brief Hertz
|
||||
* \return
|
||||
*/
|
||||
static const CFrequencyUnit& Hz() {
|
||||
static const CFrequencyUnit &Hz()
|
||||
{
|
||||
static CFrequencyUnit Hz("hertz", "Hz", true);
|
||||
return Hz;
|
||||
}
|
||||
@@ -197,7 +217,8 @@ public:
|
||||
* \brief Kilohertz
|
||||
* \return
|
||||
*/
|
||||
static const CFrequencyUnit& kHz() {
|
||||
static const CFrequencyUnit &kHz()
|
||||
{
|
||||
static CFrequencyUnit kHz("kilohertz", "kHz", true, CMeasurementPrefix::k().getFactor(), CMeasurementPrefix::k(), 1);
|
||||
return kHz;
|
||||
}
|
||||
@@ -205,7 +226,8 @@ public:
|
||||
* \brief Megahertz
|
||||
* \return
|
||||
*/
|
||||
static const CFrequencyUnit& MHz() {
|
||||
static const CFrequencyUnit &MHz()
|
||||
{
|
||||
static CFrequencyUnit MHz("megahertz", "MHz", false, CMeasurementPrefix::M().getFactor(), CMeasurementPrefix::M(), 2);
|
||||
return MHz;
|
||||
}
|
||||
@@ -213,14 +235,15 @@ public:
|
||||
* \brief Gigahertz
|
||||
* \return
|
||||
*/
|
||||
static const CFrequencyUnit& GHz() {
|
||||
static const CFrequencyUnit &GHz()
|
||||
{
|
||||
static CFrequencyUnit GHz("gigahertz", "GHz", true, CMeasurementPrefix::G().getFactor(), CMeasurementPrefix::G(), 2);
|
||||
return GHz;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for mass units (kg, lbs).
|
||||
* \brief Specialized class for mass units (kg, lbs).
|
||||
* \author KWB, MS
|
||||
*/
|
||||
class CMassUnit : public CMeasurementUnit
|
||||
@@ -240,14 +263,20 @@ private:
|
||||
CMassUnit(const QString &name, const QString &unitName, bool isSIUnit, bool isSIBaseUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
||||
CMeasurementUnit(name, unitName, "mass", isSIUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
||||
public:
|
||||
CMassUnit(const CMassUnit &otherUnit) : CMeasurementUnit(otherUnit) {
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherUnit
|
||||
*/
|
||||
CMassUnit(const CMassUnit &otherUnit) : CMeasurementUnit(otherUnit)
|
||||
{
|
||||
// void
|
||||
}
|
||||
/*!
|
||||
* \brief Kilogram, SI base unit
|
||||
* \return
|
||||
*/
|
||||
static const CMassUnit& kg() {
|
||||
static const CMassUnit &kg()
|
||||
{
|
||||
static CMassUnit kg("kilogram", "kg", true, true, 1.0, CMeasurementPrefix::k(), 1);
|
||||
return kg;
|
||||
}
|
||||
@@ -255,7 +284,8 @@ public:
|
||||
* \brief Gram, SI unit
|
||||
* \return
|
||||
*/
|
||||
static const CMassUnit& g() {
|
||||
static const CMassUnit &g()
|
||||
{
|
||||
static CMassUnit g("gram", "g", true, false, 1.0 / 1000.0, CMeasurementPrefix::One(), 0);
|
||||
return g;
|
||||
}
|
||||
@@ -263,7 +293,8 @@ public:
|
||||
* \brief Tonne, aka metric tonne (1000kg)
|
||||
* \return
|
||||
*/
|
||||
static const CMassUnit& t() {
|
||||
static const CMassUnit &t()
|
||||
{
|
||||
static CMassUnit t("tonne", "t", false, false, 1000.0, CMeasurementPrefix::One(), 3);
|
||||
return t;
|
||||
}
|
||||
@@ -271,14 +302,15 @@ public:
|
||||
* \brief Pound, aka mass pound
|
||||
* \return
|
||||
*/
|
||||
static const CMassUnit& lb() {
|
||||
static const CMassUnit &lb()
|
||||
{
|
||||
static CMassUnit lbs("pound", "lb", false, false, 0.45359237, CMeasurementPrefix::One(), 1);
|
||||
return lbs;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for pressure (psi, hPa, bar).
|
||||
* \brief Specialized class for pressure (psi, hPa, bar).
|
||||
* \author KWB, MS
|
||||
*/
|
||||
class CPressureUnit : public CMeasurementUnit
|
||||
@@ -302,14 +334,16 @@ public:
|
||||
* \brief Copy constructor
|
||||
* \param otherUnit
|
||||
*/
|
||||
CPressureUnit(const CPressureUnit &otherUnit) : CMeasurementUnit(otherUnit) {
|
||||
CPressureUnit(const CPressureUnit &otherUnit) : CMeasurementUnit(otherUnit)
|
||||
{
|
||||
// void
|
||||
}
|
||||
/*!
|
||||
* \brief Pascal
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& Pa() {
|
||||
static const CPressureUnit &Pa()
|
||||
{
|
||||
static CPressureUnit Pa("pascal", "Pa", true);
|
||||
return Pa;
|
||||
}
|
||||
@@ -317,7 +351,8 @@ public:
|
||||
* \brief Hectopascal
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& hPa() {
|
||||
static const CPressureUnit &hPa()
|
||||
{
|
||||
static CPressureUnit hPa("hectopascal", "hPa", true, CMeasurementPrefix::h().getFactor(), CMeasurementPrefix::h());
|
||||
return hPa;
|
||||
}
|
||||
@@ -325,7 +360,8 @@ public:
|
||||
* \brief Pounds per square inch
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& psi() {
|
||||
static const CPressureUnit &psi()
|
||||
{
|
||||
static CPressureUnit psi("pounds per square inch", "psi", false, 6894.8, CMeasurementPrefix::One(), 2);
|
||||
return psi;
|
||||
}
|
||||
@@ -333,7 +369,8 @@ public:
|
||||
* \brief Bar
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& bar() {
|
||||
static const CPressureUnit &bar()
|
||||
{
|
||||
static CPressureUnit bar("bar", "bar", false, 1E5);
|
||||
return bar;
|
||||
}
|
||||
@@ -341,7 +378,8 @@ public:
|
||||
* \brief Millibar, actually the same as hPa
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& mbar() {
|
||||
static const CPressureUnit &mbar()
|
||||
{
|
||||
static CPressureUnit bar("bar", "bar", false, 1E2);
|
||||
return bar;
|
||||
}
|
||||
@@ -349,7 +387,8 @@ public:
|
||||
* \brief Inch of mercury at 0°C
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& inHg() {
|
||||
static const CPressureUnit &inHg()
|
||||
{
|
||||
static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);
|
||||
return inhg;
|
||||
}
|
||||
@@ -357,14 +396,15 @@ public:
|
||||
* \brief Inch of mercury for flight level 29,92inHg = 1013,25mbar = 1013,25hPa
|
||||
* \return
|
||||
*/
|
||||
static const CPressureUnit& inHgFL() {
|
||||
static const CPressureUnit &inHgFL()
|
||||
{
|
||||
static CPressureUnit inhg("Inch of mercury ", "inHg", false, 3386.5307486631);
|
||||
return inhg;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for temperatur units (kelvin, centidegree).
|
||||
* \brief Specialized class for temperatur units (kelvin, centidegree).
|
||||
* \author KWB
|
||||
*/
|
||||
class CTemperatureUnit : public CMeasurementUnit
|
||||
@@ -408,7 +448,8 @@ public:
|
||||
/*!
|
||||
* Assigment operator
|
||||
*/
|
||||
CTemperatureUnit &CTemperatureUnit::operator =(const CTemperatureUnit &otherUnit) {
|
||||
CTemperatureUnit &CTemperatureUnit::operator =(const CTemperatureUnit &otherUnit)
|
||||
{
|
||||
if (this == &otherUnit) return *this; // Same object? Yes, so skip assignment, and just return *this
|
||||
CMeasurementUnit::operator = (otherUnit);
|
||||
this->m_conversionOffsetToSi = otherUnit.m_conversionOffsetToSi;
|
||||
@@ -418,7 +459,8 @@ public:
|
||||
* \brief Kelvin
|
||||
* \return
|
||||
*/
|
||||
static const CTemperatureUnit& K() {
|
||||
static const CTemperatureUnit &K()
|
||||
{
|
||||
static CTemperatureUnit K("Kelvin", "K", true, true);
|
||||
return K;
|
||||
}
|
||||
@@ -426,7 +468,8 @@ public:
|
||||
* \brief Centigrade C
|
||||
* \return
|
||||
*/
|
||||
static const CTemperatureUnit& C() {
|
||||
static const CTemperatureUnit &C()
|
||||
{
|
||||
static CTemperatureUnit C("centigrade", "°C", false, false, 1.0, 273.15);
|
||||
return C;
|
||||
}
|
||||
@@ -434,14 +477,15 @@ public:
|
||||
* \brief Fahrenheit F
|
||||
* \return
|
||||
*/
|
||||
static const CTemperatureUnit& F() {
|
||||
static const CTemperatureUnit &F()
|
||||
{
|
||||
static CTemperatureUnit F("Fahrenheit", "°F", false, false, 5.0 / 9.0, 459.67);
|
||||
return F;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for speed units (m/s, ft/s, NM/h).
|
||||
* \brief Specialized class for speed units (m/s, ft/s, NM/h).
|
||||
* \author KWB
|
||||
*/
|
||||
class CSpeedUnit : public CMeasurementUnit
|
||||
@@ -471,7 +515,8 @@ public:
|
||||
* \brief Meter/second m/s
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& m_s() {
|
||||
static const CSpeedUnit &m_s()
|
||||
{
|
||||
static CSpeedUnit ms("meters/second", "m/s", true, false);
|
||||
return ms;
|
||||
}
|
||||
@@ -479,7 +524,8 @@ public:
|
||||
* \brief Knots
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& kts() {
|
||||
static const CSpeedUnit &kts()
|
||||
{
|
||||
static CSpeedUnit kts("knot", "kts", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
||||
return kts;
|
||||
}
|
||||
@@ -487,7 +533,8 @@ public:
|
||||
* \brief Nautical miles per hour NM/h (same as kts)
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& NM_h() {
|
||||
static const CSpeedUnit &NM_h()
|
||||
{
|
||||
static CSpeedUnit NMh("nautical miles/hour", "NM/h", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
||||
return NMh;
|
||||
}
|
||||
@@ -495,7 +542,8 @@ public:
|
||||
* \brief Feet/second ft/s
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& ft_s() {
|
||||
static const CSpeedUnit &ft_s()
|
||||
{
|
||||
static CSpeedUnit fts("feet/seconds", "ft/s", false, false, 0.3048, CMeasurementPrefix::One(), 0);
|
||||
return fts;
|
||||
}
|
||||
@@ -503,7 +551,8 @@ public:
|
||||
* \brief Feet/min ft/min
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& ft_min() {
|
||||
static const CSpeedUnit &ft_min()
|
||||
{
|
||||
static CSpeedUnit ftmin("feet/minute", "ft/min", false, false, 0.3048 / 60.0, CMeasurementPrefix::One(), 0);
|
||||
return ftmin;
|
||||
}
|
||||
@@ -511,14 +560,15 @@ public:
|
||||
* \brief Kilometer/hour km/h
|
||||
* \return
|
||||
*/
|
||||
static const CSpeedUnit& km_h() {
|
||||
static const CSpeedUnit &km_h()
|
||||
{
|
||||
static CSpeedUnit kmh("kilometers/hour", "km/h", false, false, 1.0 / 3.6, CMeasurementPrefix::One(), 1);
|
||||
return kmh;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specialized class for time units (ms, hour, min).
|
||||
* \brief Specialized class for time units (ms, hour, min).
|
||||
* \author KWB
|
||||
*/
|
||||
class CTimeUnit : public CMeasurementUnit
|
||||
@@ -548,7 +598,8 @@ public:
|
||||
* \brief Second s
|
||||
* \return
|
||||
*/
|
||||
static const CTimeUnit& s() {
|
||||
static const CTimeUnit &s()
|
||||
{
|
||||
static CTimeUnit s("second", "s", true, true, 1, CMeasurementPrefix::None(), 1);
|
||||
return s;
|
||||
}
|
||||
@@ -556,7 +607,8 @@ public:
|
||||
* \brief Millisecond ms
|
||||
* \return
|
||||
*/
|
||||
static const CTimeUnit& ms() {
|
||||
static const CTimeUnit &ms()
|
||||
{
|
||||
static CTimeUnit ms("millisecond", "ms", true, false, 1E-03, CMeasurementPrefix::m(), 0);
|
||||
return ms;
|
||||
}
|
||||
@@ -564,7 +616,8 @@ public:
|
||||
* \brief Hour
|
||||
* \return
|
||||
*/
|
||||
static const CTimeUnit& h() {
|
||||
static const CTimeUnit &h()
|
||||
{
|
||||
static CTimeUnit h("hour", "h", false, false, 3600, CMeasurementPrefix::None(), 1);
|
||||
return h;
|
||||
}
|
||||
@@ -572,7 +625,8 @@ public:
|
||||
* \brief Minute
|
||||
* \return
|
||||
*/
|
||||
static const CTimeUnit& min() {
|
||||
static const CTimeUnit &min()
|
||||
{
|
||||
static CTimeUnit min("minute", "min", false, false, 60, CMeasurementPrefix::None(), 2);
|
||||
return min;
|
||||
}
|
||||
@@ -580,7 +634,8 @@ public:
|
||||
* \brief Day
|
||||
* \return
|
||||
*/
|
||||
static const CTimeUnit& d() {
|
||||
static const CTimeUnit &d()
|
||||
{
|
||||
static CTimeUnit day("day", "d", false, false, 3600 * 24, CMeasurementPrefix::None(), 1);
|
||||
return day;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user