mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Revised avionics (stringifier) and matrix operations
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user