mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 20:25:29 +08:00
Virtual destructor for polymorphic classes, const correctness, removed virtual method call in constructor
This commit is contained in:
@@ -10,6 +10,14 @@ namespace BlackMisc {
|
||||
* \author KWB
|
||||
*/
|
||||
class CPressureUnit : public CMeasurementUnit {
|
||||
friend class CPressure;
|
||||
private:
|
||||
/*!
|
||||
* Downcast copy constructor, allows to implement methods in base class
|
||||
* and cast unit
|
||||
* \param otherUnit
|
||||
*/
|
||||
CPressureUnit(const CMeasurementUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
||||
public:
|
||||
/*!
|
||||
* Constructor
|
||||
@@ -24,46 +32,41 @@ public:
|
||||
*/
|
||||
CPressureUnit(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) {}
|
||||
/*!
|
||||
* Downcast copy constructor, allows to implement methods in base class
|
||||
* \param otherUnit
|
||||
*/
|
||||
CPressureUnit(const CMeasurementUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
||||
/*!
|
||||
* \brief Pascal
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& Pa() { static CPressureUnit Pa("pascal", "Pa", true); return Pa;}
|
||||
static const CPressureUnit& Pa() { static CPressureUnit Pa("pascal", "Pa", true); return Pa;}
|
||||
/*!
|
||||
* \brief Hectopascal
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& hPa() { static CPressureUnit hPa("hectopascal", "hPa", true, CMeasurementPrefix::h().getFactor(), CMeasurementPrefix::h()); return hPa;}
|
||||
static const CPressureUnit& hPa() { static CPressureUnit hPa("hectopascal", "hPa", true, CMeasurementPrefix::h().getFactor(), CMeasurementPrefix::h()); return hPa;}
|
||||
/*!
|
||||
* \brief Pounds per square inch
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& psi() { static CPressureUnit psi("pounds per square inch", "psi", false, 6894.8, CMeasurementPrefix::One(), 2); return psi;}
|
||||
static const CPressureUnit& psi() { static CPressureUnit psi("pounds per square inch", "psi", false, 6894.8, CMeasurementPrefix::One(), 2); return psi;}
|
||||
/*!
|
||||
* \brief Bar
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& bar() { static CPressureUnit bar("bar", "bar", false, 1E5);return bar;}
|
||||
static const CPressureUnit& bar() { static CPressureUnit bar("bar", "bar", false, 1E5);return bar;}
|
||||
/*!
|
||||
* \brief Millibar, actually the same as hPa
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& mbar() { static CPressureUnit bar("bar", "bar", false, 1E2);return bar;}
|
||||
static const CPressureUnit& mbar() { static CPressureUnit bar("bar", "bar", false, 1E2);return bar;}
|
||||
/*!
|
||||
* \brief Inch of mercury at 0°C
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& inHg() { static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);return inhg;}
|
||||
static const CPressureUnit& inHg() { static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);return inhg;}
|
||||
/*!
|
||||
* \brief Inch of mercury for flight level 29,92inHg = 1013,25mbar = 1013,25hPa
|
||||
* \return
|
||||
*/
|
||||
static CPressureUnit& inHgFL() { static CPressureUnit inhg("Inch of mercury ", "inHg", false, 3386.5307486631);return inhg;}
|
||||
static const CPressureUnit& inHgFL() { static CPressureUnit inhg("Inch of mercury ", "inHg", false, 3386.5307486631);return inhg;}
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -93,16 +96,20 @@ public:
|
||||
* \param unit
|
||||
*/
|
||||
CPressure(double value, const CPressureUnit &unit = CPressureUnit::Pa());
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
*/
|
||||
virtual ~CPressure();
|
||||
/*!
|
||||
* \brief Unit of the distance
|
||||
* \return
|
||||
*/
|
||||
CPressureUnit getUnit() const { return this->_unit; }
|
||||
CPressureUnit getUnit() const { return this->_pUnit; }
|
||||
/*!
|
||||
* \brief Conversion SI unit
|
||||
* \return
|
||||
*/
|
||||
CPressureUnit getConversionSiUnit() const { return this->_conversionSiUnit; }
|
||||
CPressureUnit getConversionSiUnit() const { return this->_pConversionSiUnit; }
|
||||
};
|
||||
} // namespace blackCore
|
||||
#endif // PQPRESSURE_H
|
||||
|
||||
Reference in New Issue
Block a user