Added legal header, changed include guards to contain namespace prefix e.g BLACKMISC_XYZ_H

This commit is contained in:
Klaus Basan
2013-04-10 00:50:25 +02:00
parent 9a87731944
commit e196a5585f
39 changed files with 260 additions and 246 deletions

View File

@@ -12,7 +12,7 @@ int main(int argc, char *argv[])
{ {
QCoreApplication a(argc, argv); QCoreApplication a(argc, argv);
// CSamplesPhysicalQuantities::samples(); CSamplesPhysicalQuantities::samples();
CSamplesAviation::samples(); CSamplesAviation::samples();
return a.exec(); return a.exec();

View File

@@ -1,5 +1,8 @@
#include "samplesaviation.h" #include "samplesaviation.h"
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
/** /**
@@ -44,6 +47,7 @@ int CSamplesAviation::samples()
qDebug() << tr1 << tr2; qDebug() << tr1 << tr2;
// bye // bye
qDebug() << "-----------------------------------------------";
return 0; return 0;
} }

View File

@@ -1,5 +1,5 @@
#ifndef SAMPLESAVIATION_H #ifndef BLACKMISC_SAMPLESAVIATION_H
#define SAMPLESAVIATION_H #define BLACKMISC_SAMPLESAVIATION_H
#include "blackmisc/avheading.h" #include "blackmisc/avheading.h"
#include "blackmisc/avverticalpositions.h" #include "blackmisc/avverticalpositions.h"
@@ -8,9 +8,6 @@
#include "blackmisc/avionavsystem.h" #include "blackmisc/avionavsystem.h"
#include "blackmisc/aviotransponder.h" #include "blackmisc/aviotransponder.h"
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
/*! /*!

View File

@@ -1,5 +1,7 @@
#include "samplesphysicalquantities.h" #include "samplesphysicalquantities.h"
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
/** /**
@@ -91,6 +93,7 @@ int CSamplesPhysicalQuantities::samples() {
qDebug() << ti1 << ti2; qDebug() << ti1 << ti2;
// bye // bye
qDebug() << "-----------------------------------------------";
return 0; return 0;
} }

View File

@@ -1,11 +1,9 @@
#ifndef SAMPLESPHYSICALQUANTITIES_H #ifndef BLACKMISC_SAMPLESPHYSICALQUANTITIES_H
#define SAMPLESPHYSICALQUANTITIES_H #define BLACKMISC_SAMPLESPHYSICALQUANTITIES_H
#include <QDebug>
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
#include "blackmisc/debug.h" #include "blackmisc/debug.h"
#include <QDebug>
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
@@ -22,4 +20,4 @@ public:
}; };
} }
#endif // SAMPLESPHYSICALQUANTITIES_H #endif // BLACKMISC_SAMPLESPHYSICALQUANTITIES_H

View File

@@ -5,6 +5,9 @@
#include "avaltitude.h" #include "avaltitude.h"
using BlackMisc::PhysicalQuantities::CLength;
using BlackMisc::PhysicalQuantities::CLengthUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation

View File

@@ -1,15 +1,12 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVALTITUDE_H #ifndef BLACKMISC_AVALTITUDE_H
#define AVALTITUDE_H #define BLACKMISC_AVALTITUDE_H
#include "blackmisc/pqlength.h" #include "blackmisc/pqlength.h"
using BlackMisc::PhysicalQuantities::CLength;
using BlackMisc::PhysicalQuantities::CLengthUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -19,7 +16,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. * \remarks Intentionally allowing +/- CLength , and >= / <= CLength.
*/ */
class CAltitude : public CLength class CAltitude : public BlackMisc::PhysicalQuantities::CLength
{ {
private: private:
bool m_msl; //!< MSL or AGL? bool m_msl; //!< MSL or AGL?
@@ -35,34 +32,34 @@ public:
/*! /*!
* \brief Default constructor: 0 Altitude true * \brief Default constructor: 0 Altitude true
*/ */
CAltitude() : CLength(0, CLengthUnit::m()), m_msl(true) {} CAltitude() : BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::m()), m_msl(true) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param msl MSL or AGL? * \param msl MSL or AGL?
* \param unit * \param unit
*/ */
CAltitude(double value, bool msl, const CLengthUnit &unit) : CLength(value, unit), m_msl(msl) {} CAltitude(double value, bool msl, const BlackMisc::PhysicalQuantities::CLengthUnit &unit) : BlackMisc::PhysicalQuantities::CLength(value, unit), m_msl(msl) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param msl MSL or AGL? * \param msl MSL or AGL?
* \param unit * \param unit
*/ */
CAltitude(int value, bool msl, const CLengthUnit &unit) : CLength(value, unit), m_msl(msl) {} CAltitude(int value, bool msl, const BlackMisc::PhysicalQuantities::CLengthUnit &unit) : CLength(value, unit), m_msl(msl) {}
/*! /*!
* \brief Constructor by CLength * \brief Constructor by CLength
* \param Altitude * \param Altitude
* \param msl * \param msl
*/ */
CAltitude(CLength altitude, bool msl) : CLength(), m_msl(msl) { CAltitude(BlackMisc::PhysicalQuantities::CLength altitude, bool msl) : BlackMisc::PhysicalQuantities::CLength(), m_msl(msl) {
CLength::operator =(altitude); BlackMisc::PhysicalQuantities::CLength::operator =(altitude);
} }
/*! /*!
* \brief Copy constructor * \brief Copy constructor
* \param otherAltitude * \param otherAltitude
*/ */
CAltitude(const CAltitude &otherAltitude) : CLength(otherAltitude), m_msl(otherAltitude.m_msl) {} CAltitude(const CAltitude &otherAltitude) : BlackMisc::PhysicalQuantities::CLength(otherAltitude), m_msl(otherAltitude.m_msl) {}
/*! /*!
* \brief Assignment operator = * \brief Assignment operator =
* \param otherQuantity * \param otherQuantity
@@ -100,4 +97,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVALTITUDE_H #endif // BLACKMISC_AVALTITUDE_H

View File

@@ -5,6 +5,9 @@
#include "avheading.h" #include "avheading.h"
using BlackMisc::PhysicalQuantities::CAngle;
using BlackMisc::PhysicalQuantities::CAngleUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation

View File

@@ -3,13 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVHEADING_H #ifndef BLACKMISC_AVHEADING_H
#define AVHEADING_H #define BLACKMISC_AVHEADING_H
#include "blackmisc/pqangle.h" #include "blackmisc/pqangle.h"
using BlackMisc::PhysicalQuantities::CAngle;
using BlackMisc::PhysicalQuantities::CAngleUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -18,7 +15,7 @@ namespace Aviation
* \brief Heading as used in aviation, can be true or magnetic heading * \brief Heading as used in aviation, can be true or magnetic heading
* \remarks Intentionally allowing +/- CAngle , and >= / <= CAngle. * \remarks Intentionally allowing +/- CAngle , and >= / <= CAngle.
*/ */
class CHeading : public CAngle class CHeading : public BlackMisc::PhysicalQuantities::CAngle
{ {
private: private:
bool m_magnetic; //!< magnetic or true heading? bool m_magnetic; //!< magnetic or true heading?
@@ -34,21 +31,21 @@ public:
/*! /*!
* \brief Default constructor: 0 heading true * \brief Default constructor: 0 heading true
*/ */
CHeading() : CAngle(0, CAngleUnit::rad()), m_magnetic(true) {} CHeading() : CAngle(0, BlackMisc::PhysicalQuantities::CAngleUnit::rad()), m_magnetic(true) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param magnetic * \param magnetic
* \param unit * \param unit
*/ */
CHeading(double value, bool magnetic, const CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {} CHeading(double value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param magnetic * \param magnetic
* \param unit * \param unit
*/ */
CHeading(int value, bool magnetic, const CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {} CHeading(int value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {}
/*! /*!
* \brief Constructor by CAngle * \brief Constructor by CAngle
* \param heading * \param heading
@@ -98,4 +95,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVHEADING_H #endif // BLACKMISC_AVHEADING_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIOADFSYSTEM_H #ifndef BLACKMISC_AVIOADFSYSTEM_H
#define AVIOADFSYSTEM_H #define BLACKMISC_AVIOADFSYSTEM_H
#include "blackmisc/aviomodulator.h" #include "blackmisc/aviomodulator.h"
@@ -244,4 +244,4 @@ public:
} // namespace } // namespace
#endif // AVIOADFSYSTEM_H #endif // BLACKMISC_AVIOADFSYSTEM_H

View File

@@ -1,14 +1,14 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIOBASE_H #ifndef BLACKMISC_AVIOBASE_H
#define AVIOBASE_H #define BLACKMISC_AVIOBASE_H
// QtGlobal is required for asserts // QtGlobal is required for asserts
#include <QtGlobal>
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
#include <QtGlobal>
namespace BlackMisc namespace BlackMisc
{ {
@@ -105,4 +105,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVIOBASE_H #endif // BLACKMISC_AVIOBASE_H

View File

@@ -3,12 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIOCOMUNIT_H #ifndef BLACKMISC_AVIOCOMUNIT_H
#define AVIOCOMUNIT_H #define BLACKMISC_AVIOCOMUNIT_H
#include "blackmisc/aviomodulator.h" #include "blackmisc/aviomodulator.h"
using BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -25,8 +23,8 @@ private:
* \param f * \param f
* \return * \return
*/ */
bool isValidCivilAviationFrequency(CFrequency f) const { bool isValidCivilAviationFrequency(BlackMisc::PhysicalQuantities::CFrequency f) const {
double fr = f.valueRounded(CFrequencyUnit::MHz(), this->m_digits); double fr = f.valueRounded(BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz(), this->m_digits);
return fr >= 118.0 && fr <= 136.975; return fr >= 118.0 && fr <= 136.975;
} }
/*! /*!
@@ -34,8 +32,8 @@ private:
* \param f * \param f
* \return * \return
*/ */
bool isValidMilitaryFrequency(CFrequency f) const { bool isValidMilitaryFrequency(BlackMisc::PhysicalQuantities::CFrequency f) const {
double fr = f.valueRounded(CFrequencyUnit::MHz(), this->m_digits); double fr = f.valueRounded(BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz(), this->m_digits);
return fr >= 220.0 && fr <= 399.95; return fr >= 220.0 && fr <= 399.95;
} }
/*! /*!
@@ -47,7 +45,7 @@ private:
* \param digits * \param digits
* *
*/ */
CComSystem(bool validate, const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency, int digits = 3): CComSystem(bool validate, const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits = 3):
CModulator(name, activeFrequency, standbyFrequency, digits) { CModulator(name, activeFrequency, standbyFrequency, digits) {
this->validate(validate); this->validate(validate);
} }
@@ -97,7 +95,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \param digits * \param digits
*/ */
CComSystem(const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency = CModulator::FrequencyNotSet(), int digits = 3): CComSystem(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::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); this->validate(true);
} }
@@ -122,14 +120,14 @@ public:
*/ */
void setActiveUnicom() { void setActiveUnicom() {
this->toggleActiveStandby(); this->toggleActiveStandby();
this->setFrequencyActive(CPhysicalQuantitiesConstants::FrequencyUnicom()); this->setFrequencyActive(BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants::FrequencyUnicom());
} }
/*! /*!
* \brief Set International Air Distress 121.5MHz * \brief Set International Air Distress 121.5MHz
*/ */
void setActiveInternationalAirDistress() { void setActiveInternationalAirDistress() {
this->toggleActiveStandby(); this->toggleActiveStandby();
this->setFrequencyActive(CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress()); this->setFrequencyActive(BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress());
} }
/*! /*!
* \brief Assigment operator = * \brief Assigment operator =
@@ -167,7 +165,7 @@ public:
* \return * \return
*/ */
static bool tryGetComSystem(CComSystem &comSystem, const QString &name, double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static bool tryGetComSystem(CComSystem &comSystem, const QString &name, double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
comSystem = CComSystem(false, name, CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); comSystem = CComSystem(false, name, BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
bool s; bool s;
if (!(s = comSystem.validate(false))) comSystem = CComSystem(); // reset to default if (!(s = comSystem.validate(false))) comSystem = CComSystem(); // reset to default
return s; return s;
@@ -182,7 +180,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetComSystem(CComSystem &comSystem, const QString &name, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetComSystem(CComSystem &comSystem, const QString &name, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
comSystem = CComSystem(false, name, activeFrequency, standbyFrequency); comSystem = CComSystem(false, name, activeFrequency, standbyFrequency);
bool s; bool s;
if (!(s = comSystem.validate(false))) comSystem = CComSystem(); // reset to default if (!(s = comSystem.validate(false))) comSystem = CComSystem(); // reset to default
@@ -195,7 +193,7 @@ public:
* \return * \return
*/ */
static CComSystem getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static CComSystem getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
return CComSystem(CModulator::NameCom1(), CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); return CComSystem(CModulator::NameCom1(), BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
} }
/*! /*!
* \brief COM1 unit * \brief COM1 unit
@@ -203,7 +201,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static CComSystem getCom1System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static CComSystem getCom1System(BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem(CModulator::NameCom1(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency); return CComSystem(CModulator::NameCom1(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
} }
/*! /*!
@@ -223,7 +221,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetCom1Unit(CComSystem &comSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetCom1Unit(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom1(), activeFrequency, standbyFrequency); return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom1(), activeFrequency, standbyFrequency);
} }
/*! /*!
@@ -233,7 +231,7 @@ public:
* \return * \return
*/ */
static CComSystem getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static CComSystem getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
return CComSystem(CModulator::NameCom2(), CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); return CComSystem(CModulator::NameCom2(), BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
} }
/*! /*!
* \brief COM2 unit * \brief COM2 unit
@@ -241,7 +239,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static CComSystem getCom2System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static CComSystem getCom2System(BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem(CModulator::NameCom2(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency); return CComSystem(CModulator::NameCom2(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
} }
/*! /*!
@@ -261,7 +259,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetCom2System(CComSystem &comSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetCom2System(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom2(), activeFrequency, standbyFrequency); return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom2(), activeFrequency, standbyFrequency);
} }
@@ -272,7 +270,7 @@ public:
* \return * \return
*/ */
static CComSystem getCom3System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static CComSystem getCom3System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
return CComSystem(CModulator::NameCom3(), CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); return CComSystem(CModulator::NameCom3(), BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
} }
/*! /*!
* \brief COM3 unit * \brief COM3 unit
@@ -280,7 +278,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static CComSystem getCom3System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static CComSystem getCom3System(BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem(CModulator::NameCom3(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency); return CComSystem(CModulator::NameCom3(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
} }
@@ -301,7 +299,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetCom3System(CComSystem &comSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetCom3System(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom3(), activeFrequency, standbyFrequency); return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom3(), activeFrequency, standbyFrequency);
} }
}; };
@@ -310,4 +308,4 @@ public:
} // namespace } // namespace
#endif // AVIOCOMUNIT_H #endif // include guard

View File

@@ -1,7 +1,15 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "blackmisc/aviomodulator.h" #include "blackmisc/aviomodulator.h"
#include "blackmisc/aviocomsystem.h" #include "blackmisc/aviocomsystem.h"
#include "blackmisc/avionavsystem.h" #include "blackmisc/avionavsystem.h"
using BlackMisc::PhysicalQuantities::CFrequency;
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -27,14 +35,6 @@ template <class AVIO> QString CModulator<AVIO>::stringForStreamingOperator() con
s.append(" Standby: ").append(this->m_frequencyStandby.unitValueRoundedWithUnit(3)); s.append(" Standby: ").append(this->m_frequencyStandby.unitValueRoundedWithUnit(3));
return s; return s;
} }
/* Copyright (C) 2013 VATSIM Community
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Copyright (C) 2013 VATSIM Community
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** /**
* Assigment operator = * Assigment operator =

View File

@@ -3,13 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIOMODULATORUNIT_H #ifndef BLACKMISC_AVIOMODULATORUNIT_H
#define AVIOMODULATORUNIT_H #define BLACKMISC_AVIOMODULATORUNIT_H
#include "blackmisc/aviobase.h" #include "blackmisc/aviobase.h"
using BlackMisc::PhysicalQuantities::CFrequency;
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -21,8 +18,8 @@ namespace Aviation
template <class AVIO> class CModulator : public CAvionicsBase template <class AVIO> class CModulator : public CAvionicsBase
{ {
private: private:
CFrequency m_frequencyActive; //!< active frequency BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
CFrequency m_frequencyStandby; //!< standby frequency BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
protected: protected:
int m_digits; //!< digits used int m_digits; //!< digits used
@@ -44,7 +41,7 @@ protected:
* \param activeFrequency * \param activeFrequency
* \param standbyFrequency * \param standbyFrequency
*/ */
CModulator(const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency, int digits) : CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits) :
m_frequencyActive(activeFrequency), m_frequencyActive(activeFrequency),
m_digits(digits), m_frequencyStandby(standbyFrequency), CAvionicsBase(name) { } m_digits(digits), m_frequencyStandby(standbyFrequency), CAvionicsBase(name) { }
/*! /*!
@@ -71,14 +68,14 @@ protected:
* \param frequencyMHz * \param frequencyMHz
*/ */
void setFrequencyActiveMHz(double frequencyMHz) { void setFrequencyActiveMHz(double frequencyMHz) {
this->m_frequencyActive = CFrequency(frequencyMHz, CFrequencyUnit::MHz()); this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
} }
/*! /*!
* \brief Set standby frequency * \brief Set standby frequency
* \param frequencyMHz * \param frequencyMHz
*/ */
void setFrequencyStandbyMHz(double frequencyMHz) { void setFrequencyStandbyMHz(double frequencyMHz) {
this->m_frequencyStandby = CFrequency(frequencyMHz, CFrequencyUnit::MHz()); this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
} }
/*! /*!
* \brief Assigment operator = * \brief Assigment operator =
@@ -166,8 +163,8 @@ protected:
* \brief Frequency not set * \brief Frequency not set
* \return * \return
*/ */
static const CFrequency& FrequencyNotSet() { static const BlackMisc::PhysicalQuantities::CFrequency& FrequencyNotSet() {
static CFrequency f; static BlackMisc::PhysicalQuantities::CFrequency f;
return f; return f;
} }
@@ -191,28 +188,28 @@ public:
* \brief Active frequency * \brief Active frequency
* \return * \return
*/ */
CFrequency getFrequencyActive() const { BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const {
return this->m_frequencyActive; return this->m_frequencyActive;
} }
/*! /*!
* \brief Standby frequency * \brief Standby frequency
* \return * \return
*/ */
CFrequency getFrequencyStandby() const { BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const {
return this->m_frequencyActive; return this->m_frequencyActive;
} }
/*! /*!
* \brief Set active frequency * \brief Set active frequency
* \param frequency * \param frequency
*/ */
void setFrequencyActive(const CFrequency &frequency) { void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency) {
this->m_frequencyActive = frequency; this->m_frequencyActive = frequency;
} }
/*! /*!
* \brief Set standby frequency * \brief Set standby frequency
* \param frequency * \param frequency
*/ */
void setFrequencyStandby(const CFrequency &frequency) { void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency) {
this->m_frequencyStandby = frequency; this->m_frequencyStandby = frequency;
} }
}; };
@@ -220,4 +217,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVIOMODULATORUNIT_H #endif // guard

View File

@@ -1,15 +1,14 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIONAVSYSTEM_H #ifndef BLACKMISC_AVIONAVSYSTEM_H
#define AVIONAVSYSTEM_H #define BLACKMISC_AVIONAVSYSTEM_H
#include "blackmisc/aviomodulator.h" #include "blackmisc/aviomodulator.h"
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
{ {
@@ -24,8 +23,8 @@ private:
* \param f * \param f
* \return * \return
*/ */
bool isValidCivilNavigationFrequency(CFrequency f) const { bool isValidCivilNavigationFrequency(BlackMisc::PhysicalQuantities::CFrequency f) const {
double fr = f.valueRounded(CFrequencyUnit::MHz(), this->m_digits); double fr = f.valueRounded(BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz(), this->m_digits);
return fr >= 108.0 && fr <= 117.95; return fr >= 108.0 && fr <= 117.95;
} }
/*! /*!
@@ -33,7 +32,7 @@ private:
* \param f * \param f
* \return * \return
*/ */
bool isValidMilitaryNavigationFrequency(CFrequency f) const { bool isValidMilitaryNavigationFrequency(BlackMisc::PhysicalQuantities::CFrequency f) const {
return false; return false;
} }
/*! /*!
@@ -45,7 +44,7 @@ private:
* \param digits * \param digits
* *
*/ */
CNavSystem(bool validate, const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency, int digits = 3): CNavSystem(bool validate, const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits = 3):
CModulator(name, activeFrequency, standbyFrequency, digits) { CModulator(name, activeFrequency, standbyFrequency, digits) {
this->validate(validate); this->validate(validate);
} }
@@ -96,7 +95,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \param digits * \param digits
*/ */
CNavSystem(const QString &name, const CFrequency &activeFrequency, const CFrequency &standbyFrequency, int digits = 3): CNavSystem(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits = 3):
CModulator(name, activeFrequency, standbyFrequency, digits) { CModulator(name, activeFrequency, standbyFrequency, digits) {
this->validate(true); this->validate(true);
} }
@@ -121,7 +120,7 @@ public:
* \param otherSystem * \param otherSystem
* \return * \return
*/ */
CNavSystem& operator =(const CNavSystem &otherSystem) { CNavSystem &operator =(const CNavSystem &otherSystem) {
CModulator::operator =(otherSystem); CModulator::operator =(otherSystem);
return (*this); return (*this);
} }
@@ -152,7 +151,7 @@ public:
* \return * \return
*/ */
static bool tryGetNavSystem(CNavSystem &navSystem, const QString &name, double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static bool tryGetNavSystem(CNavSystem &navSystem, const QString &name, double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
navSystem = CNavSystem(false, name, CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); navSystem = CNavSystem(false, name, BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
bool s; bool s;
if (!(s = navSystem.validate(false))) navSystem = CNavSystem(); // reset to default if (!(s = navSystem.validate(false))) navSystem = CNavSystem(); // reset to default
return s; return s;
@@ -166,7 +165,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetNavSystem(CNavSystem &navSystem, const QString &name, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetNavSystem(CNavSystem &navSystem, const QString &name, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
navSystem = CNavSystem(false, name, activeFrequency, standbyFrequency); navSystem = CNavSystem(false, name, activeFrequency, standbyFrequency);
bool s; bool s;
if (!(s = navSystem.validate(false))) navSystem = CNavSystem(); // reset to default if (!(s = navSystem.validate(false))) navSystem = CNavSystem(); // reset to default
@@ -179,7 +178,7 @@ public:
* \return * \return
*/ */
static CNavSystem getNav1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static CNavSystem getNav1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
return CNavSystem(CModulator::NameNav1(), CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); return CNavSystem(CModulator::NameNav1(), BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
} }
/*! /*!
* \brief NAV1 unit * \brief NAV1 unit
@@ -187,7 +186,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static CNavSystem getNav1System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static CNavSystem getNav1System(BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CNavSystem(CModulator::NameNav1(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency); return CNavSystem(CModulator::NameNav1(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
} }
/*! /*!
@@ -207,7 +206,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetNav1System(CNavSystem &navSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetNav1System(CNavSystem &navSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CNavSystem::tryGetNavSystem(navSystem, CModulator::NameNav1(), activeFrequency, standbyFrequency); return CNavSystem::tryGetNavSystem(navSystem, CModulator::NameNav1(), activeFrequency, standbyFrequency);
} }
/*! /*!
@@ -217,7 +216,7 @@ public:
* \return * \return
*/ */
static CNavSystem getNav2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { static CNavSystem getNav2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) {
return CNavSystem(CModulator::NameNav2(), CFrequency(activeFrequencyMHz, CFrequencyUnit::MHz()), CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, CFrequencyUnit::MHz())); return CNavSystem(CModulator::NameNav2(), BlackMisc::PhysicalQuantities::CFrequency(activeFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()), BlackMisc::PhysicalQuantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()));
} }
/*! /*!
* \brief NAV2 unit * \brief NAV2 unit
@@ -225,7 +224,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static CNavSystem getNav2System(CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static CNavSystem getNav2System(BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CNavSystem(CModulator::NameNav2(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency); return CNavSystem(CModulator::NameNav2(), activeFrequency, standbyFrequency == CModulator::FrequencyNotSet() ? activeFrequency : standbyFrequency);
} }
/*! /*!
@@ -245,7 +244,7 @@ public:
* \param standbyFrequency * \param standbyFrequency
* \return * \return
*/ */
static bool tryGetNav2System(CNavSystem &navSystem, CFrequency activeFrequency, CFrequency standbyFrequency = CModulator::FrequencyNotSet()) { static bool tryGetNav2System(CNavSystem &navSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
return CNavSystem::tryGetNavSystem(navSystem, CModulator::NameNav2(), activeFrequency, standbyFrequency); return CNavSystem::tryGetNavSystem(navSystem, CModulator::NameNav2(), activeFrequency, standbyFrequency);
} }
}; };
@@ -253,4 +252,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVIONAVSYSTEM_H #endif // BLACKMISC_AVIONAVSYSTEM_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVIOTRANSPONDER_H #ifndef BLACKMISC_AVIOTRANSPONDER_H
#define AVIOTRANSPONDER_H #define BLACKMISC_AVIOTRANSPONDER_H
#include "blackmisc/aviobase.h" #include "blackmisc/aviobase.h"
namespace BlackMisc namespace BlackMisc
@@ -180,7 +180,7 @@ public:
* \param otherTransponder * \param otherTransponder
* \return * \return
*/ */
CTransponder& operator =(const CTransponder &otherTransponder) { CTransponder &operator =(const CTransponder &otherTransponder) {
CAvionicsBase::operator =(otherTransponder); CAvionicsBase::operator =(otherTransponder);
this->m_transponderMode = otherTransponder.m_transponderMode; this->m_transponderMode = otherTransponder.m_transponderMode;
this->m_transponderCode = otherTransponder.m_transponderCode; this->m_transponderCode = otherTransponder.m_transponderCode;
@@ -272,4 +272,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVIOTRANSPONDER_H #endif // BLACKMISC_AVIOTRANSPONDER_H

View File

@@ -5,6 +5,9 @@
#include "avtrack.h" #include "avtrack.h"
using BlackMisc::PhysicalQuantities::CAngle;
using BlackMisc::PhysicalQuantities::CAngleUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation

View File

@@ -3,24 +3,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVTRACK_H #ifndef BLACKMISC_AVTRACK_H
#define AVTRACK_H #define BLACKMISC_AVTRACK_H
#include "blackmisc/pqangle.h" #include "blackmisc/pqangle.h"
using BlackMisc::PhysicalQuantities::CAngle;
using BlackMisc::PhysicalQuantities::CAngleUnit;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
{ {
/*! /*!
* \brief Track as used in aviation, can be true or magnetic Track * \brief Track as used in aviation, can be true or magnetic Track
* \remarks Intentionally allowing +/- CAngle , and >= / <= CAngle. * \remarks Intentionally allowing +/- BlackMisc::PhysicalQuantities::CAngle , and >= / <= CAngle.
*/ */
class CTrack : public CAngle class CTrack : public BlackMisc::PhysicalQuantities::CAngle
{ {
private: private:
bool m_magnetic; //!< magnetic or true Track? bool m_magnetic; //!< magnetic or true Track?
@@ -34,36 +31,36 @@ protected:
public: public:
/*! /*!
* \brief Default constructor: 0 Track true * \brief Default constructor: 0 Track magnetic
*/ */
CTrack() : CAngle(0, CAngleUnit::rad()), m_magnetic(true) {} CTrack() : BlackMisc::PhysicalQuantities::CAngle(0, BlackMisc::PhysicalQuantities::CAngleUnit::rad()), m_magnetic(true) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param magnetic * \param magnetic
* \param unit * \param unit
*/ */
CTrack(double value, bool magnetic, const CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {} CTrack(double value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : BlackMisc::PhysicalQuantities::CAngle(value, unit), m_magnetic(magnetic) {}
/*! /*!
* \brief Constructor * \brief Constructor
* \param value * \param value
* \param magnetic * \param magnetic
* \param unit * \param unit
*/ */
CTrack(int value, bool magnetic, const CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {} CTrack(int value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : BlackMisc::PhysicalQuantities::CAngle(value, unit), m_magnetic(magnetic) {}
/*! /*!
* \brief Constructor by CAngle * \brief Constructor by CAngle
* \param Track * \param Track
* \param magnetic * \param magnetic
*/ */
CTrack(CAngle track, bool magnetic) : CAngle(), m_magnetic(magnetic) { CTrack(BlackMisc::PhysicalQuantities::CAngle track, bool magnetic) : BlackMisc::PhysicalQuantities::CAngle(), m_magnetic(magnetic) {
CAngle::operator =(track); BlackMisc::PhysicalQuantities::CAngle::operator =(track);
} }
/*! /*!
* \brief Copy constructor * \brief Copy constructor
* \param otherTrack * \param otherTrack
*/ */
CTrack(const CTrack &otherTrack) : CAngle(otherTrack), m_magnetic(otherTrack.m_magnetic) {} CTrack(const CTrack &otherTrack) : BlackMisc::PhysicalQuantities::CAngle(otherTrack), m_magnetic(otherTrack.m_magnetic) {}
/*! /*!
* \brief Assignment operator = * \brief Assignment operator =
* \param otherQuantity * \param otherQuantity
@@ -102,4 +99,4 @@ public:
} // namespace } // namespace
#endif // AVTRACK_H #endif // BLACKMISC_AVTRACK_H

View File

@@ -5,9 +5,12 @@
#include "avverticalpositions.h" #include "avverticalpositions.h"
using BlackMisc::PhysicalQuantities::CLength;
using BlackMisc::PhysicalQuantities::CLengthUnit;
using BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
{ {

View File

@@ -3,14 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AVLATERALPOSITION_H #ifndef BLACKMISC_AVLATERALPOSITION_H
#define AVLATERALPOSITION_H #define BLACKMISC_AVLATERALPOSITION_H
#include "blackmisc/avaltitude.h" #include "blackmisc/avaltitude.h"
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
using BlackMisc::PhysicalQuantities::CLength;
using BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants;
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation namespace Aviation
@@ -39,8 +37,8 @@ class CAviationVerticalPositions
friend CLogMessage operator<<(CLogMessage log, const CAviationVerticalPositions &positions); friend CLogMessage operator<<(CLogMessage log, const CAviationVerticalPositions &positions);
private: private:
CLength m_height; //!< height BlackMisc::PhysicalQuantities::CLength m_height; //!< height
CLength m_elevation; //!< elevation BlackMisc::PhysicalQuantities::CLength m_elevation; //!< elevation
CAltitude m_altitude; //!< altitude CAltitude m_altitude; //!< altitude
protected: protected:
@@ -61,7 +59,7 @@ public:
* \param elevation * \param elevation
* \param height * \param height
*/ */
CAviationVerticalPositions(const CAltitude &altitude, const CLength &elevation, const CLength &height); CAviationVerticalPositions(const CAltitude &altitude, const BlackMisc::PhysicalQuantities::CLength &elevation, const BlackMisc::PhysicalQuantities::CLength &height);
/*! /*!
* \brief Copy constructor * \brief Copy constructor
* \param otherPosition * \param otherPosition
@@ -89,14 +87,14 @@ public:
* \brief Height * \brief Height
* \return * \return
*/ */
CLength getHeight() const { BlackMisc::PhysicalQuantities::CLength getHeight() const {
return this->m_height; return this->m_height;
} }
/*! /*!
* \brief Elevation * \brief Elevation
* \return * \return
*/ */
CLength getElevation() const { BlackMisc::PhysicalQuantities::CLength getElevation() const {
return this->m_elevation; return this->m_elevation;
} }
/*! /*!
@@ -125,4 +123,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // AVLATERALPOSITION_H #endif // BLACKMISC_AVLATERALPOSITION_H

View File

@@ -1,32 +1,30 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQANGLE_H #ifndef BLACKMISC_PQANGLE_H
#define PQANGLE_H #define BLACKMISC_PQANGLE_H
#include "blackmisc/pqphysicalquantity.h" #include "blackmisc/pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
/*! /*!
* \brief Physical unit degree * \brief Physical unit degree
* \author KWB * \author KWB
*/ */
class CAngle : public CPhysicalQuantity<CAngleUnit, CAngle> class CAngle : public CPhysicalQuantity<CAngleUnit, CAngle>
{ {
public: public:
/*! /*!
* \brief Default constructor * \brief Default constructor
*/ */
CAngle() : CPhysicalQuantity(0, CAngleUnit::rad(), CAngleUnit::rad()) {} CAngle() : CPhysicalQuantity(0, CAngleUnit::rad(), CAngleUnit::rad()) {}
/** /*!
* \brief Copy constructor * \brief Copy constructor
*/ */
CAngle(const CAngle &angle) : CPhysicalQuantity(angle) {} CAngle(const CAngle &angle) : CPhysicalQuantity(angle) {}
/*! /*!
* \brief Init by int value * \brief Init by int value
@@ -63,4 +61,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQANGLE_H #endif // BLACKMISC_PQANGLE_H

View File

@@ -3,17 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQBASE_H #ifndef BLACKMISC_PQBASE_H
#define PQBASE_H #define BLACKMISC_PQBASE_H
#include "blackmisc/debug.h"
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
#include <QDebug> #include <QDebug>
#include "blackmisc/debug.h"
namespace BlackMisc namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
@@ -131,7 +130,7 @@ public:
* \brief Unit "None" * \brief Unit "None"
* \return * \return
*/ */
static const CMeasurementPrefix& None() { static const CMeasurementPrefix &None() {
static CMeasurementPrefix none("", "", 0.0); static CMeasurementPrefix none("", "", 0.0);
return none; return none;
} }
@@ -139,7 +138,7 @@ public:
* \brief Unit "One" * \brief Unit "One"
* \return * \return
*/ */
static const CMeasurementPrefix& One() { static const CMeasurementPrefix &One() {
static CMeasurementPrefix one("one", "", 1.0); static CMeasurementPrefix one("one", "", 1.0);
return one; return one;
} }
@@ -147,7 +146,7 @@ public:
* \brief Unit "mega" * \brief Unit "mega"
* \return * \return
*/ */
static const CMeasurementPrefix& M() { static const CMeasurementPrefix &M() {
static CMeasurementPrefix mega("mega", "M", 1E6); static CMeasurementPrefix mega("mega", "M", 1E6);
return mega; return mega;
} }
@@ -155,7 +154,7 @@ public:
* \brief Unit "kilo" * \brief Unit "kilo"
* \return * \return
*/ */
static const CMeasurementPrefix& k() { static const CMeasurementPrefix &k() {
static CMeasurementPrefix kilo("kilo", "k", 1000.0); static CMeasurementPrefix kilo("kilo", "k", 1000.0);
return kilo; return kilo;
} }
@@ -163,7 +162,7 @@ public:
* \brief Unit "giga" * \brief Unit "giga"
* \return * \return
*/ */
static const CMeasurementPrefix& G() { static const CMeasurementPrefix &G() {
static CMeasurementPrefix giga("giga", "G", 1E9); static CMeasurementPrefix giga("giga", "G", 1E9);
return giga; return giga;
} }
@@ -171,7 +170,7 @@ public:
* \brief Unit "hecto" * \brief Unit "hecto"
* \return * \return
*/ */
static const CMeasurementPrefix& h() { static const CMeasurementPrefix &h() {
static CMeasurementPrefix hecto("hecto", "h", 100.0); static CMeasurementPrefix hecto("hecto", "h", 100.0);
return hecto; return hecto;
} }
@@ -179,7 +178,7 @@ public:
* \brief Unit "centi" * \brief Unit "centi"
* \return * \return
*/ */
static const CMeasurementPrefix& c() { static const CMeasurementPrefix &c() {
static CMeasurementPrefix centi("centi", "c", 0.01); static CMeasurementPrefix centi("centi", "c", 0.01);
return centi; return centi;
} }
@@ -187,7 +186,7 @@ public:
* \brief Unit "milli" * \brief Unit "milli"
* \return * \return
*/ */
static const CMeasurementPrefix& m() { static const CMeasurementPrefix &m() {
static CMeasurementPrefix milli("milli", "m", 1E-03); static CMeasurementPrefix milli("milli", "m", 1E-03);
return milli; return milli;
} }
@@ -225,7 +224,7 @@ protected:
/*! /*!
* Points to a individual converter method * Points to a individual converter method
*/ */
typedef double(*UnitConverter)(const CMeasurementUnit&, double); typedef double(*UnitConverter)(const CMeasurementUnit &, double);
private: private:
QString m_name; //!< name, e.g. "meter" QString m_name; //!< name, e.g. "meter"
@@ -442,7 +441,7 @@ public:
* \brief Unit is not specified * \brief Unit is not specified
* \return * \return
*/ */
static CMeasurementUnit& None() { static CMeasurementUnit &None() {
static CMeasurementUnit none("none", "", "", false, false, 0.0, CMeasurementPrefix::None(), 0, 0); static CMeasurementUnit none("none", "", "", false, false, 0.0, CMeasurementPrefix::None(), 0, 0);
return none; return none;
} }
@@ -451,4 +450,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQBASE_H #endif // BLACKMISC_PQBASE_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQCONSTANTS_H #ifndef BLACKMISC_PQCONSTANTS_H
#define PQCONSTANTS_H #define BLACKMISC_PQCONSTANTS_H
#include "blackmisc/pqallquantities.h" #include "blackmisc/pqallquantities.h"
@@ -12,7 +12,6 @@ namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
class CPhysicalQuantitiesConstants class CPhysicalQuantitiesConstants
{ {
@@ -92,4 +91,4 @@ public:
}; };
} //namespace } //namespace
} // namespace } // namespace
#endif // PQCONSTANTS_H #endif // BLACKMISC_PQCONSTANTS_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQFREQUENCY_H #ifndef BLACKMISC_PQFREQUENCY_H
#define PQFREQUENCY_H #define BLACKMISC_PQFREQUENCY_H
#include "pqphysicalquantity.h" #include "pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
@@ -46,4 +46,4 @@ public:
}; };
} // namespace } // namespace
} // namespace } // namespace
#endif // PQFREQUENCY_H #endif // BLACKMISC_PQFREQUENCY_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQlength_H #ifndef BLACKMISC_PQLENGTH_H
#define PQlength_H #define BLACKMISC_PQLENGTH_H
#include "blackmisc/pqphysicalquantity.h" #include "blackmisc/pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
@@ -46,4 +46,4 @@ public:
}; };
} // namespace } // namespace
} // namespace } // namespace
#endif // PQlength_H #endif // BLACKMISC_PQLENGTH_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQMASS_H #ifndef BLACKMISC_PQMASS_H
#define PQMASS_H #define BLACKMISC_PQMASS_H
#include "blackmisc/pqphysicalquantity.h" #include "blackmisc/pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
@@ -48,4 +48,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQMASS_H #endif // BLACKMISC_PQMASS_H

View File

@@ -3,21 +3,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQPHYSICALQUANTITY_H #ifndef BLACKMISC_PQPHYSICALQUANTITY_H
#define PQPHYSICALQUANTITY_H #define BLACKMISC_PQPHYSICALQUANTITY_H
#include <QtGlobal>
#include <QString>
#include <QLocale>
#include "blackmisc/pqbase.h" #include "blackmisc/pqbase.h"
#include "blackmisc/pqunits.h" #include "blackmisc/pqunits.h"
#include "blackmisc/debug.h" #include "blackmisc/debug.h"
#include <QtGlobal>
#include <QString>
#include <QLocale>
namespace BlackMisc namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
/*! /*!
* \brief A physical quantity such as "5m", "20s", "1500ft/s" * \brief A physical quantity such as "5m", "20s", "1500ft/s"
* \author KWB * \author KWB
@@ -362,4 +361,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQPHYSICALQUANTITY_H #endif // BLACKMISC_PQPHYSICALQUANTITY_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQPRESSURE_H #ifndef BLACKMISC_PQPRESSURE_H
#define PQPRESSURE_H #define BLACKMISC_PQPRESSURE_H
#include "pqphysicalquantity.h" #include "pqphysicalquantity.h"
@@ -47,4 +47,4 @@ public:
}; };
} // namespace } // namespace
} // namespace } // namespace
#endif // PQPRESSURE_H #endif // BLACKMISC_PQPRESSURE_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CSPEED_H #ifndef BLACKMISC_CSPEED_H
#define CSPEED_H #define BLACKMISC_CSPEED_H
#include "pqphysicalquantity.h" #include "pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
@@ -47,4 +47,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // CSPEED_H #endif // BLACKMISC_CSPEED_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CTEMPERATURE_H #ifndef BLACKMISC_CTEMPERATURE_H
#define CTEMPERATURE_H #define BLACKMISC_CTEMPERATURE_H
#include "pqphysicalquantity.h" #include "pqphysicalquantity.h"
namespace BlackMisc namespace BlackMisc
@@ -46,4 +46,4 @@ public:
}; };
} // namespace } // namespace
} // namespace } // namespace
#endif // CTEMPERATURE_H #endif // BLACKMISC_CTEMPERATURE_H

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQTIME_H #ifndef BLACKMISC_PQTIME_H
#define PQTIME_H #define BLACKMISC_PQTIME_H
#include "pqphysicalquantity.h" #include "pqphysicalquantity.h"
@@ -48,4 +48,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQTIME_H #endif // BLACKMISC_PQTIME_H

View File

@@ -1,10 +1,10 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PQUNITS_H #ifndef BLACKMISC_PQUNITS_H
#define PQUNITS_H #define BLACKMISC_PQUNITS_H
#include "blackmisc/pqbase.h" #include "blackmisc/pqbase.h"
#include <math.h> #include <math.h>
@@ -14,7 +14,6 @@
// //
namespace BlackMisc namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
@@ -590,4 +589,4 @@ public:
} // namespace } // namespace
} // namespace } // namespace
#endif // PQUNITS_H #endif // BLACKMISC_PQUNITS_H

View File

@@ -1,3 +1,8 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKMISCTEST_H #ifndef BLACKMISCTEST_H
#define BLACKMISCTEST_H #define BLACKMISCTEST_H

View File

@@ -5,9 +5,12 @@
#include "testaviationbase.h" #include "testaviationbase.h"
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
/** /*
* Constructor * Constructor
*/ */
CTestAviationBase::CTestAviationBase(QObject *parent): QObject(parent) CTestAviationBase::CTestAviationBase(QObject *parent): QObject(parent)
@@ -15,7 +18,7 @@ CTestAviationBase::CTestAviationBase(QObject *parent): QObject(parent)
// void // void
} }
/** /*
* Basic tests * Basic tests
*/ */
void CTestAviationBase::headingBasics() void CTestAviationBase::headingBasics()
@@ -39,7 +42,7 @@ void CTestAviationBase::headingBasics()
QVERIFY2(h2.unitValueToDouble() == 360, "Value shall be 360"); QVERIFY2(h2.unitValueToDouble() == 360, "Value shall be 360");
} }
/** /*
* Vertical positions * Vertical positions
*/ */
void CTestAviationBase::verticalPosition() void CTestAviationBase::verticalPosition()
@@ -49,7 +52,7 @@ void CTestAviationBase::verticalPosition()
QVERIFY2(vp1== vp2, "Values shall be equal"); QVERIFY2(vp1== vp2, "Values shall be equal");
} }
/** /*
* COM and NAV units * COM and NAV units
*/ */
void CTestAviationBase::comAndNav() void CTestAviationBase::comAndNav()
@@ -66,7 +69,7 @@ void CTestAviationBase::comAndNav()
QVERIFY2(!CNavSystem::tryGetNav1System(nav1, 200.0), "Expect no NAV system"); QVERIFY2(!CNavSystem::tryGetNav1System(nav1, 200.0), "Expect no NAV system");
} }
/** /*
* COM and NAV units * COM and NAV units
*/ */
void CTestAviationBase::transponder() void CTestAviationBase::transponder()

View File

@@ -1,15 +1,18 @@
#ifndef TESTAVIATIONBASE_H /* Copyright (C) 2013 VATSIM Community / authors
#define TESTAVIATIONBASE_H * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKMISCTEST_TESTAVIATIONBASE_H
#define BLACKMISCTEST_TESTAVIATIONBASE_H
#include <QtTest/QtTest>
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
#include "blackmisc/avheading.h" #include "blackmisc/avheading.h"
#include "blackmisc/avverticalpositions.h" #include "blackmisc/avverticalpositions.h"
#include "blackmisc/aviocomsystem.h" #include "blackmisc/aviocomsystem.h"
#include "blackmisc/avionavsystem.h" #include "blackmisc/avionavsystem.h"
#include "blackmisc/aviotransponder.h" #include "blackmisc/aviotransponder.h"
#include <QtTest/QtTest>
using namespace BlackMisc::Aviation;
namespace BlackMiscTest { namespace BlackMiscTest {
@@ -49,4 +52,4 @@ private slots:
} // namespace } // namespace
#endif // TESTAVIATIONBASE_H #endif // BLACKMISCTEST_TESTAVIATIONBASE_H

View File

@@ -1,12 +1,15 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "testmain.h" #include "testmain.h"
namespace BlackMiscTest { namespace BlackMiscTest
{
//! Starting main, equivalent to QTEST_APPLESS_MAIN for multiple test classes. /*
/*! \param argc * Starting main, equivalent to QTEST_APPLESS_MAIN for multiple test classes.
\param argv */
\sa http://stackoverflow.com/questions/12194256/qt-how-to-organize-unit-test-with-more-than-one-class
*/
int CTestMain::unitMain(int argc, char *argv[]) int CTestMain::unitMain(int argc, char *argv[])
{ {
int status = 0; int status = 0;

View File

@@ -1,9 +1,14 @@
#ifndef TESTMAIN_H /* Copyright (C) 2013 VATSIM Community / authors
#define TESTMAIN_H * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKMISCTEST_TESTMAIN_H
#define BLACKMISCTEST_TESTMAIN_H
#include <QtTest/QtTest>
#include "testphysicalquantitiesbase.h" #include "testphysicalquantitiesbase.h"
#include "testaviationbase.h" #include "testaviationbase.h"
#include <QtTest/QtTest>
namespace BlackMiscTest{ namespace BlackMiscTest{
@@ -15,8 +20,14 @@ namespace BlackMiscTest{
class CTestMain class CTestMain
{ {
public: public:
/*!
* \brief Starting all
* \param argc
* \param argv
* \return
*/
static int unitMain(int argc, char *argv[]); static int unitMain(int argc, char *argv[]);
}; };
} }
#endif // TESTMAIN_H #endif // BLACKMISCTEST_TESTMAIN_H

View File

@@ -1,13 +1,15 @@
/* Copyright (C) 2013 VATSIM Community /* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "testphysicalquantitiesbase.h" #include "testphysicalquantitiesbase.h"
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest { namespace BlackMiscTest {
/*! /*
* Constructor * Constructor
*/ */
CTestPhysicalQuantitiesBase::CTestPhysicalQuantitiesBase(QObject *parent) : QObject(parent) CTestPhysicalQuantitiesBase::CTestPhysicalQuantitiesBase(QObject *parent) : QObject(parent)
@@ -15,7 +17,7 @@ CTestPhysicalQuantitiesBase::CTestPhysicalQuantitiesBase(QObject *parent) : QObj
// void // void
} }
/*! /*
* Basic unit tests for physical units * Basic unit tests for physical units
*/ */
void CTestPhysicalQuantitiesBase::unitsBasics() void CTestPhysicalQuantitiesBase::unitsBasics()
@@ -36,7 +38,7 @@ void CTestPhysicalQuantitiesBase::unitsBasics()
QVERIFY2(fu1 != du1, "Hz must not be meter"); QVERIFY2(fu1 != du1, "Hz must not be meter");
} }
/*! /*
* Distance tests * Distance tests
*/ */
void CTestPhysicalQuantitiesBase::lengthBasics() void CTestPhysicalQuantitiesBase::lengthBasics()
@@ -67,7 +69,7 @@ void CTestPhysicalQuantitiesBase::lengthBasics()
QVERIFY2(d1 > d2, "d1 shall be greater"); QVERIFY2(d1 > d2, "d1 shall be greater");
} }
/** /*
* Unit tests for speed * Unit tests for speed
*/ */
void CTestPhysicalQuantitiesBase::speedBasics() void CTestPhysicalQuantitiesBase::speedBasics()
@@ -78,7 +80,7 @@ void CTestPhysicalQuantitiesBase::speedBasics()
QVERIFY2(s2.valueRounded(CSpeedUnit::m_s(),1) == 5.1, qPrintable(QString("1000ft/min is not %1 m/s").arg(s2.valueRounded(CSpeedUnit::m_s(),1)))); QVERIFY2(s2.valueRounded(CSpeedUnit::m_s(),1) == 5.1, qPrintable(QString("1000ft/min is not %1 m/s").arg(s2.valueRounded(CSpeedUnit::m_s(),1))));
} }
/** /*
* Frequency unit tests * Frequency unit tests
*/ */
void CTestPhysicalQuantitiesBase::frequencyTests() void CTestPhysicalQuantitiesBase::frequencyTests()
@@ -91,7 +93,7 @@ void CTestPhysicalQuantitiesBase::frequencyTests()
QVERIFY2(f1 == f2 , "MHz is 1E6 Hz"); QVERIFY2(f1 == f2 , "MHz is 1E6 Hz");
} }
/** /*
* Angle tests * Angle tests
*/ */
void CTestPhysicalQuantitiesBase::angleTests() void CTestPhysicalQuantitiesBase::angleTests()
@@ -105,7 +107,7 @@ void CTestPhysicalQuantitiesBase::angleTests()
QVERIFY2(a3.valueRounded(CAngleUnit::deg()) == 35.73, "Expecting 35.73"); QVERIFY2(a3.valueRounded(CAngleUnit::deg()) == 35.73, "Expecting 35.73");
} }
/** /*
* Weight tests * Weight tests
*/ */
void CTestPhysicalQuantitiesBase::massTests() void CTestPhysicalQuantitiesBase::massTests()
@@ -119,7 +121,7 @@ void CTestPhysicalQuantitiesBase::massTests()
QVERIFY2(w1 == w2, "Masses shall be equal"); QVERIFY2(w1 == w2, "Masses shall be equal");
} }
/** /*
* Pressure tests * Pressure tests
*/ */
void CTestPhysicalQuantitiesBase::pressureTests() void CTestPhysicalQuantitiesBase::pressureTests()
@@ -136,7 +138,7 @@ void CTestPhysicalQuantitiesBase::pressureTests()
QVERIFY2(p1.unitValueToDouble() == p4.unitValueToDouble(), "mbar/hPa test"); QVERIFY2(p1.unitValueToDouble() == p4.unitValueToDouble(), "mbar/hPa test");
} }
/** /*
* Temperature tests * Temperature tests
*/ */
void CTestPhysicalQuantitiesBase::temperatureTests() void CTestPhysicalQuantitiesBase::temperatureTests()
@@ -151,7 +153,7 @@ void CTestPhysicalQuantitiesBase::temperatureTests()
QVERIFY2(t4.valueRounded(CTemperatureUnit::K()) == 260.93, qPrintable(QString("10F shall be 260.93K, not %1 K").arg(t4.valueRounded(CTemperatureUnit::K())))); QVERIFY2(t4.valueRounded(CTemperatureUnit::K()) == 260.93, qPrintable(QString("10F shall be 260.93K, not %1 K").arg(t4.valueRounded(CTemperatureUnit::K()))));
} }
/** /*
* Temperature tests * Temperature tests
*/ */
void CTestPhysicalQuantitiesBase::timeTests() void CTestPhysicalQuantitiesBase::timeTests()
@@ -160,7 +162,7 @@ void CTestPhysicalQuantitiesBase::timeTests()
QVERIFY2(t1.siBaseUnitValueToInteger() == 3600, "1hour shall be 3600s"); QVERIFY2(t1.siBaseUnitValueToInteger() == 3600, "1hour shall be 3600s");
} }
/** /*
* Just testing obvious memory create / destruct flaws * Just testing obvious memory create / destruct flaws
*/ */
void CTestPhysicalQuantitiesBase::memoryTests() void CTestPhysicalQuantitiesBase::memoryTests()
@@ -178,7 +180,7 @@ void CTestPhysicalQuantitiesBase::memoryTests()
delete a; delete a;
} }
/** /*
* @brief Just testing obvious memory create / destruct flaws * @brief Just testing obvious memory create / destruct flaws
*/ */
void CTestPhysicalQuantitiesBase::basicArithmetic() void CTestPhysicalQuantitiesBase::basicArithmetic()
@@ -193,6 +195,4 @@ void CTestPhysicalQuantitiesBase::basicArithmetic()
p3 = p3 - p3; p3 = p3 - p3;
QVERIFY2(p3.unitValueToDouble() == 0, "Value needs to be zero"); QVERIFY2(p3.unitValueToDouble() == 0, "Value needs to be zero");
} }
} // namespace } // namespace

View File

@@ -1,11 +1,9 @@
#ifndef TESTPHYSICALQUANTITIESBASE_H #ifndef BLACKMISCTEST_TESTPHYSICALQUANTITIESBASE_H
#define TESTPHYSICALQUANTITIESBASE_H #define BLACKMISCTEST_TESTPHYSICALQUANTITIESBASE_H
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest namespace BlackMiscTest
{ {
@@ -72,4 +70,4 @@ private slots:
} // namespace } // namespace
#endif // TESTPHYSICALQUANTITIESBASE_H #endif // BLACKMISCTEST_TESTPHYSICALQUANTITIESBASE_H