Revised avionics (stringifier) and matrix operations

This commit is contained in:
Klaus Basan
2013-04-19 14:36:30 +02:00
parent 8121babe77
commit 8ffa443a69
18 changed files with 296 additions and 131 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2013 VATSIM Community / authors
/* Copyright (C) 2013 VATSIM Community / contributors
* 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/. */
@@ -7,6 +7,7 @@
#define BLACKMISC_AVIOBASE_H
// QtGlobal is required for asserts
#include "blackmisc/basestreamstringifier.h"
#include "blackmisc/pqconstants.h"
#include <QtGlobal>
@@ -18,67 +19,44 @@ namespace Aviation
/*!
* \brief Base class for avionics
*/
class CAvionicsBase
class CAvionicsBase : public CBaseStreamStringifier<CAvionicsBase>
{
/*!
* Stream operator for debugging
* \brief operator <<
* \param debug
* \param avionic
* \return
* \remarks Has to be in the header files to avoid template link errors
*/
friend QDebug operator<<(QDebug debug, const CAvionicsBase &avionic) {
QString v = avionic.stringForStreamingOperator();
debug << v;
return debug;
}
/*!
* Stream operator for log messages
* \brief operator <<
* \param log
* \param avionic
* \return
* \remarks Has to be in the header files to avoid template link errors
*/
friend CLogMessage operator<<(CLogMessage log, const CAvionicsBase &avionic) {
QString v = avionic.stringForStreamingOperator();
log << v;
return log;
}
private:
QString m_name; //!< name of the unit
protected:
/*!
* \brief Default constructor
*/
CAvionicsBase(const QString &name) : m_name(name) {}
/*!
* \brief Meaningful string representation
* \return
*/
virtual QString stringForStreamingOperator() const = 0;
/*!
* \brief Are the set values valid / in range
* \return
*/
virtual bool validValues() {
virtual bool validValues()
{
return true;
}
/*!
* \brief Set name
* \param name
*/
void setName(const QString &name) {
void setName(const QString &name)
{
this->m_name = name;
}
/*!
* \brief operator ==
* \param otherSystem
* \return
*/
bool operator ==(const CAvionicsBase &otherSystem) const {
bool operator ==(const CAvionicsBase &otherSystem) const
{
if (this == &otherSystem) return true;
return this->m_name == otherSystem.m_name;
}
@@ -88,21 +66,17 @@ public:
* \brief Virtual destructor
*/
virtual ~CAvionicsBase() {}
/*!
* \brief Cast as QString
*/
operator QString() const {
return this->stringForStreamingOperator();
}
/*!
* \brief Name
* \return
*/
QString getName() const {
QString getName() const
{
return this->m_name;
}
};
} // namespace
} // namespace
#endif // BLACKMISC_AVIOBASE_H
#endif // guard