mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 23:05:34 +08:00
Moved PQs from blackcore to blackmisc, added header for namespace, mainpage.dox for Doxygen
This commit is contained in:
@@ -6,11 +6,11 @@ WITH_BLACKCORE = ON
|
|||||||
WITH_BLACKD = ON
|
WITH_BLACKD = ON
|
||||||
WITH_BLACKBOX = ON
|
WITH_BLACKBOX = ON
|
||||||
WITH_SAMPLES = ON
|
WITH_SAMPLES = ON
|
||||||
|
WITH_UNITTESTS = ON
|
||||||
|
|
||||||
#WITH_DRIVER_FSX = ON
|
#WITH_DRIVER_FSX = ON
|
||||||
#WITH_DRIVER_FS9 = ON
|
#WITH_DRIVER_FS9 = ON
|
||||||
#WITH_DRIVER_XPLANE = ON
|
#WITH_DRIVER_XPLANE = ON
|
||||||
#WITH_UNITTESTS = ON
|
|
||||||
|
|
||||||
equals(WITH_BLACKMISC, ON) {
|
equals(WITH_BLACKMISC, ON) {
|
||||||
SUBDIRS += src/blackmisc
|
SUBDIRS += src/blackmisc
|
||||||
@@ -51,5 +51,5 @@ equals(WITH_SAMPLES, ON) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
equals(WITH_UNITTESTS, ON) {
|
equals(WITH_UNITTESTS, ON) {
|
||||||
SUBDIRS += tests/blackcore/test_blackcore.pro
|
SUBDIRS += tests/blackmisc/test_blackmisc.pro
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ win32-msvc* {
|
|||||||
PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
||||||
|
|
||||||
LIBS += ../../lib/libblackmisc.a \
|
LIBS += ../../lib/libblackmisc.a \
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTDIR = ../../bin
|
DESTDIR = ../../bin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "blackcore/pqdistance.h"
|
#include "blackmisc/pqconstants.h"
|
||||||
#include "blackcore/pqfrequency.h"
|
#include "blackmisc/debug.h"
|
||||||
#include "blackcore/pqspeed.h"
|
|
||||||
#include "blackcore/pqangle.h"
|
|
||||||
#include "blackcore/pqmass.h"
|
|
||||||
#include "blackcore/pqpressure.h"
|
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackMisc;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Sample tests
|
||||||
|
* \brief main
|
||||||
|
* \param argc
|
||||||
|
* \param argv
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
|
|
||||||
const CDistance d1(5.0, CDistanceUnit::ft()); // 5 ft
|
const CDistance d1(5.0, CDistanceUnit::ft()); // 5 ft
|
||||||
CDistance d2(1, CDistanceUnit::NM()); // 1NM
|
CDistance d2(1, CDistanceUnit::NM()); // 1NM
|
||||||
CDistance d3(1, CDistanceUnit::km());
|
CDistance d3(1, CDistanceUnit::km());
|
||||||
@@ -50,6 +52,14 @@ int main(int argc, char *argv[])
|
|||||||
CPressure p1(1013.25, CPressureUnit::hPa());
|
CPressure p1(1013.25, CPressureUnit::hPa());
|
||||||
qDebug() << p1 << p1.valueRoundedWithUnit(CPressureUnit::psi()) << p1.valueRoundedWithUnit(CPressureUnit::inHg());
|
qDebug() << p1 << p1.valueRoundedWithUnit(CPressureUnit::psi()) << p1.valueRoundedWithUnit(CPressureUnit::inHg());
|
||||||
|
|
||||||
|
CTemperature t1;
|
||||||
|
CTemperature t2(20, CTemperatureUnit::C());
|
||||||
|
qDebug() << t1 << t2;
|
||||||
|
|
||||||
|
// some logging wit CLogMessage
|
||||||
|
bDebug << p1;
|
||||||
|
bDebug << p1.getUnit() << p1.getUnit().getMultiplier();
|
||||||
|
|
||||||
// bye
|
// bye
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ TEMPLATE = app
|
|||||||
CONFIG += console
|
CONFIG += console
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
DEPENDPATH += . ../../src/blackcore
|
DEPENDPATH += . ../../src
|
||||||
INCLUDEPATH += . ../../src
|
INCLUDEPATH += . ../../src
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
|
|
||||||
win32-msvc* {
|
win32-msvc* {
|
||||||
PRE_TARGETDEPS += ../../lib/blackcore.lib
|
PRE_TARGETDEPS += ../../lib/blackmisc.lib
|
||||||
LIBS += ../../lib/blackcore.lib
|
LIBS += ../../lib/blackmisc.lib
|
||||||
}
|
}
|
||||||
|
|
||||||
!win32-msvc* {
|
!win32-msvc* {
|
||||||
PRE_TARGETDEPS += ../../lib/libblackcore.a
|
PRE_TARGETDEPS += ../../lib/libblackmisc.a
|
||||||
LIBS += ../../lib/libblackcore.a
|
LIBS += ../../lib/libblackmisc.a
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTDIR = ../../bin
|
DESTDIR = ../../bin
|
||||||
|
|||||||
@@ -29,15 +29,6 @@ HEADERS += \
|
|||||||
multiplayer.h \
|
multiplayer.h \
|
||||||
ned.h \
|
ned.h \
|
||||||
plane.h \
|
plane.h \
|
||||||
pqdistance.h \
|
|
||||||
pqphysicalquantity.h \
|
|
||||||
pqfrequency.h \
|
|
||||||
pqbase.h \
|
|
||||||
pqspeed.h \
|
|
||||||
pqangle.h \
|
|
||||||
pqmass.h \
|
|
||||||
pqpressure.h \
|
|
||||||
pqtemperature.h \
|
|
||||||
simulator.h \
|
simulator.h \
|
||||||
vector_3d.h \
|
vector_3d.h \
|
||||||
vector_geo.h
|
vector_geo.h
|
||||||
@@ -52,15 +43,6 @@ SOURCES += \
|
|||||||
multiplayer.cpp \
|
multiplayer.cpp \
|
||||||
ned.cpp \
|
ned.cpp \
|
||||||
plane.cpp \
|
plane.cpp \
|
||||||
pqdistance.cpp \
|
|
||||||
pqphysicalquantity.cpp \
|
|
||||||
pqfrequency.cpp \
|
|
||||||
pqbase.cpp \
|
|
||||||
pqspeed.cpp \
|
|
||||||
pqangle.cpp \
|
|
||||||
pqmass.cpp \
|
|
||||||
pqpressure.cpp \
|
|
||||||
pqtemperature.cpp \
|
|
||||||
simulator.cpp \
|
simulator.cpp \
|
||||||
vector_3d.cpp \
|
vector_3d.cpp \
|
||||||
vector_geo.cpp \
|
vector_geo.cpp \
|
||||||
|
|||||||
14
src/blackmisc/blackmisc.h
Normal file
14
src/blackmisc/blackmisc.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef BLACKMISC_H
|
||||||
|
#define BLACKMISC_H
|
||||||
|
|
||||||
|
// just a dummy header, namespace documentation will go here
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace BlackMisc
|
||||||
|
* BlackMisc is the namespace for generic utility classes. As of its nature
|
||||||
|
* (containing central classes such as CLogMessage, or CPhysicalQuantity),
|
||||||
|
* BlackMisc is available in any other compilation unit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,7 +5,6 @@ TEMPLATE = lib
|
|||||||
CONFIG += staticlib
|
CONFIG += staticlib
|
||||||
|
|
||||||
INCLUDEPATH += ..
|
INCLUDEPATH += ..
|
||||||
|
|
||||||
DEPENDPATH += . ..
|
DEPENDPATH += . ..
|
||||||
|
|
||||||
#PRECOMPILED_HEADER = stdpch.h
|
#PRECOMPILED_HEADER = stdpch.h
|
||||||
@@ -17,6 +16,7 @@ precompile_header:!isEmpty(PRECOMPILED_HEADER) {
|
|||||||
DEFINES += LOG_IN_FILE
|
DEFINES += LOG_IN_FILE
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
blackmisc.h \
|
||||||
logmessage.h \
|
logmessage.h \
|
||||||
log.h \
|
log.h \
|
||||||
display.h \
|
display.h \
|
||||||
@@ -26,22 +26,33 @@ HEADERS += \
|
|||||||
config_manager.h \
|
config_manager.h \
|
||||||
serialize.h \
|
serialize.h \
|
||||||
com_client.h \
|
com_client.h \
|
||||||
|
com_handler.h \
|
||||||
com_server.h \
|
com_server.h \
|
||||||
com_client_buffer.h \
|
com_client_buffer.h \
|
||||||
message.h \
|
message.h \
|
||||||
com_handler.h \
|
|
||||||
message_factory.h \
|
message_factory.h \
|
||||||
message_handler.h \
|
message_handler.h \
|
||||||
type_info.h \
|
type_info.h \
|
||||||
message_dispatcher.h \
|
message_dispatcher.h \
|
||||||
message_system.h \
|
message_system.h \
|
||||||
gui_messages.h
|
gui_messages.h \
|
||||||
|
pqdistance.h \
|
||||||
|
pqphysicalquantity.h \
|
||||||
|
pqfrequency.h \
|
||||||
|
pqbase.h \
|
||||||
|
pqspeed.h \
|
||||||
|
pqangle.h \
|
||||||
|
pqmass.h \
|
||||||
|
pqpressure.h \
|
||||||
|
pqtemperature.h \
|
||||||
|
pqconstants.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
logmessage.cpp \
|
logmessage.cpp \
|
||||||
log.cpp \
|
log.cpp \
|
||||||
display.cpp \
|
display.cpp \
|
||||||
debug.cpp \
|
debug.cpp \
|
||||||
|
com_handler.cpp \
|
||||||
context.cpp \
|
context.cpp \
|
||||||
config.cpp \
|
config.cpp \
|
||||||
config_manager.cpp \
|
config_manager.cpp \
|
||||||
@@ -50,15 +61,20 @@ SOURCES += \
|
|||||||
com_server.cpp \
|
com_server.cpp \
|
||||||
com_client_buffer.cpp \
|
com_client_buffer.cpp \
|
||||||
message.cpp \
|
message.cpp \
|
||||||
com_handler.cpp \
|
|
||||||
message_factory.cpp \
|
message_factory.cpp \
|
||||||
message_handler.cpp \
|
message_handler.cpp \
|
||||||
type_info.cpp \
|
type_info.cpp \
|
||||||
message_dispatcher.cpp \
|
message_dispatcher.cpp \
|
||||||
message_system.cpp
|
message_system.cpp \
|
||||||
|
pqdistance.cpp \
|
||||||
|
pqphysicalquantity.cpp \
|
||||||
|
pqfrequency.cpp \
|
||||||
|
pqbase.cpp \
|
||||||
|
pqspeed.cpp \
|
||||||
|
pqangle.cpp \
|
||||||
|
pqmass.cpp \
|
||||||
|
pqpressure.cpp \
|
||||||
|
pqtemperature.cpp \
|
||||||
|
pqconstants.cpp
|
||||||
|
|
||||||
DESTDIR = ../../lib
|
DESTDIR = ../../lib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqangle.h"
|
#include "blackmisc/pqangle.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for angles (degrees, radian).
|
* Specialized class for angles (degrees, radian).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqbase.h"
|
#include "blackmisc/pqbase.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// --- Mulitplier --------------------------------------------------------
|
// --- Mulitplier --------------------------------------------------------
|
||||||
@@ -78,6 +78,15 @@ QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log to debug
|
||||||
|
*/
|
||||||
|
CLogMessage operator<<(CLogMessage log, const CMeasurementPrefix &multiplier)
|
||||||
|
{
|
||||||
|
log << multiplier._name;
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// --- Measurement unit --------------------------------------------------
|
// --- Measurement unit --------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -132,14 +141,6 @@ bool CMeasurementUnit::operator ==(const CMeasurementUnit &otherUnit) const
|
|||||||
&& this->_isSIUnit==otherUnit._isSIUnit;
|
&& this->_isSIUnit==otherUnit._isSIUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Unequal operator
|
|
||||||
*/
|
|
||||||
bool CMeasurementUnit::operator !=(const CMeasurementUnit &otherUnit) const
|
|
||||||
{
|
|
||||||
return !(otherUnit == *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream to debug
|
* Stream to debug
|
||||||
*/
|
*/
|
||||||
@@ -149,6 +150,23 @@ QDebug operator <<(QDebug d, const CMeasurementUnit &unit)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream to log
|
||||||
|
*/
|
||||||
|
CLogMessage operator<<(CLogMessage log, const CMeasurementUnit &unit)
|
||||||
|
{
|
||||||
|
log << unit._name;
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unequal operator
|
||||||
|
*/
|
||||||
|
bool CMeasurementUnit::operator !=(const CMeasurementUnit &otherUnit) const
|
||||||
|
{
|
||||||
|
return !(otherUnit == *this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conversion factor from unit x to y
|
* Conversion factor from unit x to y
|
||||||
*/
|
*/
|
||||||
@@ -8,8 +8,9 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include "blackmisc/debug.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Typical prefixes (multipliers) such as kilo, mega, hecto.
|
* Typical prefixes (multipliers) such as kilo, mega, hecto.
|
||||||
@@ -25,6 +26,14 @@ class CMeasurementPrefix {
|
|||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
friend QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier);
|
friend QDebug operator<<(QDebug d, const CMeasurementPrefix &multiplier);
|
||||||
|
/*!
|
||||||
|
* Stream operator for log messages
|
||||||
|
* \brief operator <<
|
||||||
|
* \param log
|
||||||
|
* \param multiplier
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend CLogMessage operator<<(CLogMessage log, const CMeasurementPrefix &multiplier);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _name; //!< name, e.g. "kilo"
|
QString _name; //!< name, e.g. "kilo"
|
||||||
@@ -155,6 +164,15 @@ class CMeasurementUnit {
|
|||||||
*/
|
*/
|
||||||
friend QDebug operator<<(QDebug d, const CMeasurementUnit &unit);
|
friend QDebug operator<<(QDebug d, const CMeasurementUnit &unit);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Stream operator for log messages
|
||||||
|
* \brief operator <<
|
||||||
|
* \param log
|
||||||
|
* \param unit
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend CLogMessage operator<<(CLogMessage log, const CMeasurementUnit &unit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _name; //!< name, e.g. "meter"
|
QString _name; //!< name, e.g. "meter"
|
||||||
QString _unitName; //!< unit name, e.g. "m"
|
QString _unitName; //!< unit name, e.g. "m"
|
||||||
@@ -275,6 +293,6 @@ public:
|
|||||||
static CMeasurementUnit& None() { static CMeasurementUnit none("none", "", "", false, false, 0.0, CMeasurementPrefix::None(), 0, 0); return none;}
|
static CMeasurementUnit& None() { static CMeasurementUnit none("none", "", "", false, false, 0.0, CMeasurementPrefix::None(), 0, 0); return none;}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BlackCore
|
} // namespace BlackMisc
|
||||||
|
|
||||||
#endif // PQBASE_H
|
#endif // PQBASE_H
|
||||||
7
src/blackmisc/pqconstants.cpp
Normal file
7
src/blackmisc/pqconstants.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "blackmisc/pqconstants.h"
|
||||||
|
|
||||||
|
namespace BlackMisc {
|
||||||
|
|
||||||
|
// no code here, all in header
|
||||||
|
|
||||||
|
} // namespace
|
||||||
40
src/blackmisc/pqconstants.h
Normal file
40
src/blackmisc/pqconstants.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#ifndef PQCONSTANTS_H
|
||||||
|
#define PQCONSTANTS_H
|
||||||
|
|
||||||
|
#include "blackmisc/blackmisc.h"
|
||||||
|
#include "blackmisc/pqdistance.h"
|
||||||
|
#include "blackmisc/pqfrequency.h"
|
||||||
|
#include "blackmisc/pqspeed.h"
|
||||||
|
#include "blackmisc/pqangle.h"
|
||||||
|
#include "blackmisc/pqmass.h"
|
||||||
|
#include "blackmisc/pqpressure.h"
|
||||||
|
#include "blackmisc/pqtemperature.h"
|
||||||
|
|
||||||
|
namespace BlackMisc{
|
||||||
|
|
||||||
|
class CPhysicalQuantitiesConstants
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*!
|
||||||
|
* \brief Temperature absolute Zero in °C
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static CTemperature& TemperatureAbsoluteZero() { static CTemperature t(-273.15, CTemperatureUnit::C()); return t;}
|
||||||
|
/*!
|
||||||
|
* \brief Tripe point of purified water, 0.01°C
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static CTemperature& TemperatureTriplePointOfVSMOW() { static CTemperature t(-273.16, CTemperatureUnit::K()); return t;}
|
||||||
|
/*!
|
||||||
|
* \brief Temperature absolute Zero in °C
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static CTemperature& TemperatureAbsoluteZeroC() { static CTemperature t(-273.15, CTemperatureUnit::C()); return t;}
|
||||||
|
/*!
|
||||||
|
* \brief Standard pressure 1013,25mbar / 29.92inHg
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static CPressure& InternationalStandardSeaLevelPressure() { static CPressure p(1013.25, CPressureUnit::hPa()); return p;}
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
#endif // PQCONSTANTS_H
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqdistance.h"
|
#include "blackmisc/pqdistance.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#define PQDISTANCE_H
|
#define PQDISTANCE_H
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for distance units (meter, foot, nautical miles).
|
* Specialized class for distance units (meter, foot, nautical miles).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqfrequency.h"
|
#include "blackmisc/pqfrequency.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#define PQFREQUENCY_H
|
#define PQFREQUENCY_H
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
* Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqmass.h"
|
#include "blackmisc/pqmass.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#define PQMASS_H
|
#define PQMASS_H
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for mass units (kg, lbs).
|
* Specialized class for mass units (kg, lbs).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqPhysicalQuantity.h"
|
#include "blackmisc/pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor by integer
|
* Constructor by integer
|
||||||
@@ -40,6 +40,16 @@ QDebug operator <<(QDebug d, const CPhysicalQuantity &quantity)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream operator
|
||||||
|
*/
|
||||||
|
CLogMessage operator <<(CLogMessage d, const CPhysicalQuantity &quantity)
|
||||||
|
{
|
||||||
|
QString v = quantity.unitValueRoundedWithUnit(-1);
|
||||||
|
d << v;
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equal operator ==
|
* Equal operator ==
|
||||||
*/
|
*/
|
||||||
@@ -234,7 +244,7 @@ bool CPhysicalQuantity::operator <=(const CPhysicalQuantity &otherQuantity) cons
|
|||||||
/**
|
/**
|
||||||
* Switch to another unit
|
* Switch to another unit
|
||||||
*/
|
*/
|
||||||
bool CPhysicalQuantity::switchUnit(const BlackCore::CMeasurementUnit &unit)
|
bool CPhysicalQuantity::switchUnit(const CMeasurementUnit &unit)
|
||||||
{
|
{
|
||||||
if (this->_unit == unit) return true;
|
if (this->_unit == unit) return true;
|
||||||
if (this->_unit.getType() != unit.getType()) return false; // not possible
|
if (this->_unit.getType() != unit.getType()) return false; // not possible
|
||||||
@@ -4,9 +4,10 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include "pqbase.h"
|
#include "blackmisc/pqbase.h"
|
||||||
|
#include "blackmisc/debug.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief A physical quantity such as "5m", "20s", "1500ft/s"
|
* \brief A physical quantity such as "5m", "20s", "1500ft/s"
|
||||||
@@ -22,6 +23,14 @@ class CPhysicalQuantity
|
|||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
friend QDebug operator<<(QDebug debug, const CPhysicalQuantity &quantity);
|
friend QDebug operator<<(QDebug debug, const CPhysicalQuantity &quantity);
|
||||||
|
/*!
|
||||||
|
* Stream operator for log messages
|
||||||
|
* \brief operator <<
|
||||||
|
* \param log
|
||||||
|
* \param quantity
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend CLogMessage operator<<(CLogMessage log, const CPhysicalQuantity &quantity);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qint32 _unitValueI; //!< value backed by integer, allows sole integer arithmetic
|
qint32 _unitValueI; //!< value backed by integer, allows sole integer arithmetic
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqpressure.h"
|
#include "blackmisc/pqpressure.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for pressure (psi, hPa, bar).
|
* Specialized class for pressure (psi, hPa, bar).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqspeed.h"
|
#include "blackmisc/pqspeed.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#define CSPEED_H
|
#define CSPEED_H
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for speed units (m/s, ft/s, NM/h).
|
* Specialized class for speed units (m/s, ft/s, NM/h).
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pqtemperature.h"
|
#include "blackmisc/pqtemperature.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#define CTEMPERATURE_H
|
#define CTEMPERATURE_H
|
||||||
#include "pqphysicalquantity.h"
|
#include "pqphysicalquantity.h"
|
||||||
|
|
||||||
namespace BlackCore {
|
namespace BlackMisc {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specialized class for temperatur units (kelvin, centidegree).
|
* Specialized class for temperatur units (kelvin, centidegree).
|
||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
* \param epsilon
|
* \param epsilon
|
||||||
*/
|
*/
|
||||||
CTemperatureUnit(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) :
|
CTemperatureUnit(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, "temperature", isSIUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
||||||
/*!
|
/*!
|
||||||
* Downcast copy constructor, allows to implement methods in base class
|
* Downcast copy constructor, allows to implement methods in base class
|
||||||
* \param otherUnit
|
* \param otherUnit
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Physical unit distance
|
* \brief Physical unit temperature
|
||||||
* \author KWB
|
* \author KWB
|
||||||
*/
|
*/
|
||||||
class CTemperature : public CPhysicalQuantity
|
class CTemperature : public CPhysicalQuantity
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
*\brief downcast copy constructor
|
*\brief downcast copy constructor
|
||||||
*/
|
*/
|
||||||
CTemperature(const CPhysicalQuantity &distance);
|
CTemperature(const CPhysicalQuantity &temperature);
|
||||||
/*!
|
/*!
|
||||||
* \brief Init by int value
|
* \brief Init by int value
|
||||||
* \param value
|
* \param value
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
CTemperature(double value, const CTemperatureUnit &unit = CTemperatureUnit::K());
|
CTemperature(double value, const CTemperatureUnit &unit = CTemperatureUnit::K());
|
||||||
/*!
|
/*!
|
||||||
* \brief Unit of the distance
|
* \brief Unit of the temperature
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
CTemperatureUnit getUnit() const { return this->_unit; }
|
CTemperatureUnit getUnit() const { return this->_unit; }
|
||||||
@@ -79,6 +79,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
CTemperatureUnit getConversionSiUnit() const { return this->_conversionSiUnit; }
|
CTemperatureUnit getConversionSiUnit() const { return this->_conversionSiUnit; }
|
||||||
};
|
};
|
||||||
} // namespace blackCore
|
} // namespace
|
||||||
|
|
||||||
#endif // CTEMPERATURE_H
|
#endif // CTEMPERATURE_H
|
||||||
6
src/mainpage.dox
Normal file
6
src/mainpage.dox
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
\mainpage VATSIM client project, aka black mystery
|
||||||
|
|
||||||
|
This is the Doxygen main page for the file,please write something useful here!
|
||||||
|
|
||||||
|
*/
|
||||||
@@ -2,8 +2,15 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "testmain.h"
|
#include "testmain.h"
|
||||||
|
|
||||||
using namespace BlackCoreTest;
|
using namespace BlackMiscTest;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Starter for testcases
|
||||||
|
* \brief main
|
||||||
|
* \param argc
|
||||||
|
* \param argv
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
QT += core testlib
|
QT += core testlib
|
||||||
QT -= gui
|
QT -= gui
|
||||||
|
|
||||||
TARGET = test_blackcore
|
TARGET = test_blackmisc
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
CONFIG += console
|
CONFIG += console
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
DEPENDPATH += . ../../src/blackcore
|
DEPENDPATH += . ../../src
|
||||||
INCLUDEPATH += . ../../src/blackcore
|
INCLUDEPATH += . ../../src
|
||||||
SOURCES += main.cpp testmain.cpp testphysicalquantitiesbase.cpp
|
SOURCES += main.cpp testmain.cpp testphysicalquantitiesbase.cpp
|
||||||
HEADERS += testmain.h testphysicalquantitiesbase.h
|
HEADERS += testmain.h testphysicalquantitiesbase.h
|
||||||
|
|
||||||
win32-msvc* {
|
win32-msvc* {
|
||||||
PRE_TARGETDEPS += ../../lib/blackcore.lib
|
PRE_TARGETDEPS += ../../lib/blackmisc.lib
|
||||||
LIBS += ../../lib/blackcore.lib
|
LIBS += ../../lib/blackmisc.lib
|
||||||
}
|
}
|
||||||
|
|
||||||
!win32-msvc* {
|
!win32-msvc* {
|
||||||
PRE_TARGETDEPS += ../../lib/libblackcore.a
|
PRE_TARGETDEPS += ../../lib/libblackmisc.a
|
||||||
LIBS += ../../lib/libblackcore.a
|
LIBS += ../../lib/libblackmisc.a
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTDIR = ../../bin
|
DESTDIR = ../../bin
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "testmain.h"
|
#include "testmain.h"
|
||||||
|
|
||||||
namespace BlackCoreTest {
|
namespace BlackMiscTest {
|
||||||
|
|
||||||
//! Starting main, equivalent to QTEST_APPLESS_MAIN for multiple test classes.
|
//! Starting main, equivalent to QTEST_APPLESS_MAIN for multiple test classes.
|
||||||
/*! \param argc
|
/*! \param argc
|
||||||
@@ -4,11 +4,7 @@
|
|||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include "testphysicalquantitiesbase.h"
|
#include "testphysicalquantitiesbase.h"
|
||||||
|
|
||||||
using namespace BlackCore;
|
namespace BlackMiscTest{
|
||||||
using namespace BlackCoreTest;
|
|
||||||
|
|
||||||
|
|
||||||
namespace BlackCoreTest{
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Class firing of all unit tests in this namespace.
|
* Class firing of all unit tests in this namespace.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "testphysicalquantitiesbase.h"
|
#include "testphysicalquantitiesbase.h"
|
||||||
|
|
||||||
namespace BlackCoreTest {
|
namespace BlackMiscTest {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructor
|
* \brief Constructor
|
||||||
@@ -2,15 +2,10 @@
|
|||||||
#define TESTPHYSICALQUANTITIESBASE_H
|
#define TESTPHYSICALQUANTITIESBASE_H
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include "../../src/blackcore/pqdistance.h"
|
#include "blackmisc/pqconstants.h"
|
||||||
#include "../../src/blackcore/pqfrequency.h"
|
using namespace BlackMisc;
|
||||||
#include "../../src/blackcore/pqspeed.h"
|
|
||||||
#include "../../src/blackcore/pqangle.h"
|
|
||||||
#include "../../src/blackcore/pqmass.h"
|
|
||||||
#include "../../src/blackcore/pqpressure.h"
|
|
||||||
using namespace BlackCore;
|
|
||||||
|
|
||||||
namespace BlackCoreTest {
|
namespace BlackMiscTest {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Physical quantities,basic tests
|
* \brief Physical quantities,basic tests
|
||||||
@@ -53,12 +48,10 @@ private slots:
|
|||||||
* \brief Testing pressure
|
* \brief Testing pressure
|
||||||
*/
|
*/
|
||||||
void pressureTests();
|
void pressureTests();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief testing construction / destruction in memory
|
* \brief testing construction / destruction in memory
|
||||||
*/
|
*/
|
||||||
void memoryTests();
|
void memoryTests();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user