mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Shifted DBus operators to CBaseStreamStringifier, much easier to provide streaming - especially for derived classes.
Still required but unwanted overloaded DBus operator in aviomodulator.h - no compilation without them. Need to be removed. Enabled more classes for DBus.
This commit is contained in:
@@ -50,5 +50,14 @@ bool CAltitude::operator !=(const CAltitude &otherAltitude)
|
||||
return !((*this) == otherAltitude);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAltitude::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAltitude>(typeid(CAltitude).name());
|
||||
qDBusRegisterMetaType<CAltitude>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -28,6 +28,24 @@ protected:
|
||||
*/
|
||||
virtual QString stringForConverter() const;
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus <<
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
CLength::marshallToDbus(argument);
|
||||
argument << this->m_msl;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus >>
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
CLength::unmarshallFromDbus(argument);
|
||||
argument >> this->m_msl;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
@@ -105,9 +123,16 @@ public:
|
||||
{
|
||||
return this->m_msl;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register metadata
|
||||
*/
|
||||
static void registerMetadata();
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
Q_DECLARE_METATYPE(BlackMisc::Aviation::CAltitude)
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -19,17 +19,16 @@ namespace Aviation
|
||||
/*!
|
||||
* \brief Base class for avionics
|
||||
*/
|
||||
class CAvionicsBase : public CBaseStreamStringifier
|
||||
class CAvionicsBase : public BlackMisc::CBaseStreamStringifier
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
QString m_name; //!< name of the unit
|
||||
|
||||
/*!
|
||||
* \brief Default constructor
|
||||
* \brief Constructor
|
||||
*/
|
||||
CAvionicsBase(const QString &name) : m_name(name) {}
|
||||
CAvionicsBase(const QString &name) : CBaseStreamStringifier(), m_name(name) {}
|
||||
|
||||
/*!
|
||||
* \brief Are the set values valid / in range
|
||||
@@ -60,6 +59,22 @@ protected:
|
||||
return this->m_name == otherSystem.m_name;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus <<
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_name;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus >>
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
argument >> this->m_name;
|
||||
}
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* 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 BLACKMISC_AVIOCOMUNIT_H
|
||||
#define BLACKMISC_AVIOCOMUNIT_H
|
||||
#ifndef BLACKMISC_AVIOCOMSYSTEM_H
|
||||
#define BLACKMISC_AVIOCOMSYSTEM_H
|
||||
#include "blackmisc/aviomodulator.h"
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -315,8 +315,10 @@ public:
|
||||
static bool tryGetCom3System(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom3(), activeFrequency, standbyFrequency);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "blackmisc/aviomodulator.h"
|
||||
#include "blackmisc/aviocomsystem.h"
|
||||
#include "blackmisc/avionavsystem.h"
|
||||
#include "blackmisc/avioadfsystem.h"
|
||||
|
||||
using BlackMisc::PhysicalQuantities::CFrequency;
|
||||
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
|
||||
@@ -25,12 +26,20 @@ template <class AVIO> void CModulator<AVIO>::toggleActiveStandby()
|
||||
this->m_frequencyStandby = a;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
template <class AVIO> void CModulator<AVIO>::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<AVIO>(typeid(AVIO).name());
|
||||
qDBusRegisterMetaType<AVIO>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigment operator =
|
||||
*/
|
||||
template <class AVIO> CModulator<AVIO>& CModulator<AVIO>::operator=(const CModulator<AVIO> &otherModulator)
|
||||
{
|
||||
|
||||
if (this == &otherModulator) return *this; // Same object?
|
||||
this->m_frequencyActive = otherModulator.m_frequencyActive;
|
||||
this->m_frequencyStandby = otherModulator.m_frequencyStandby;
|
||||
@@ -63,6 +72,8 @@ template <class AVIO> bool CModulator<AVIO>::operator !=(const CModulator<AVIO>
|
||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||
template class CModulator<CComSystem>;
|
||||
template class CModulator<CNavSystem>;
|
||||
template class CModulator<CAdfSystem>;
|
||||
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BLACKMISC_AVIOMODULATORUNIT_H
|
||||
#define BLACKMISC_AVIOMODULATORUNIT_H
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusMetaType>
|
||||
#include "blackmisc/aviobase.h"
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -19,6 +19,33 @@ namespace Aviation
|
||||
*/
|
||||
template <class AVIO> class CModulator : public CAvionicsBase
|
||||
{
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, DBus to object
|
||||
* \param argument
|
||||
* \param uc
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, AVIO &uc) {
|
||||
// If I do not have the method here, DBus metasystem tries to stream against
|
||||
// a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list)
|
||||
// Once someone solves this, this methods should go and the CBaseStreamStringifier signature
|
||||
// should be used
|
||||
CBaseStreamStringifier &sf = uc;
|
||||
return argument >> sf;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Marshalling operator <<, object to DBus
|
||||
* \param argument
|
||||
* \param pq
|
||||
* \return
|
||||
*/
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc;
|
||||
return argument << sf;
|
||||
}
|
||||
|
||||
private:
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
|
||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
||||
@@ -207,6 +234,28 @@ protected:
|
||||
return f;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus <<
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
CAvionicsBase::marshallToDbus(argument);
|
||||
argument << this->m_frequencyActive;
|
||||
argument << this->m_frequencyStandby;
|
||||
argument << this->m_digits;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus >>
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
CAvionicsBase::unmarshallFromDbus(argument);
|
||||
argument >> this->m_frequencyActive;
|
||||
argument >> this->m_frequencyStandby;
|
||||
argument >> this->m_digits;
|
||||
}
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
@@ -262,47 +311,10 @@ public:
|
||||
this->m_frequencyStandby = frequency;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, DBus to object
|
||||
* \param argument
|
||||
* \param aviationUnit
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, AVIO &aviationUnit) {
|
||||
argument.beginStructure();
|
||||
argument >> aviationUnit.m_frequencyActive;
|
||||
argument >> aviationUnit.m_frequencyStandby;
|
||||
argument >> aviationUnit.m_digits;
|
||||
argument >> aviationUnit.m_name;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Marshalling operator <<, object to DBus
|
||||
* \param argument
|
||||
* \param aviationUnit
|
||||
* \return
|
||||
*/
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO& aviationUnit)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << aviationUnit.m_frequencyActive;
|
||||
argument << aviationUnit.m_frequencyStandby;
|
||||
argument << aviationUnit.m_digits;
|
||||
argument << aviationUnit.m_name;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register metadata
|
||||
*/
|
||||
static void registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<AVIO>(typeid(AVIO).name());
|
||||
qDBusRegisterMetaType<AVIO>();
|
||||
}
|
||||
static void registerMetadata();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define BLACKMISC_BASESTREAMSTRINGIFIER_H
|
||||
|
||||
#include "blackmisc/debug.h"
|
||||
#include <QDBusMetaType>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QDataStream>
|
||||
@@ -23,10 +24,10 @@ class CBaseStreamStringifier
|
||||
*/
|
||||
friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc; // allows to access protected method
|
||||
debug << sf.stringForStreaming();
|
||||
debug << uc.stringForStreaming();
|
||||
return debug;
|
||||
}
|
||||
|
||||
// msvc2010: friend QDebug &operator<<(QDebug &debug, const CBaseStreamStringifier &uc)
|
||||
// MinGW: No reference
|
||||
|
||||
@@ -38,8 +39,7 @@ class CBaseStreamStringifier
|
||||
*/
|
||||
friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
||||
textStream << sf.stringForStreaming();
|
||||
textStream << uc.stringForStreaming();
|
||||
return textStream;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ class CBaseStreamStringifier
|
||||
*/
|
||||
friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
||||
stream << sf.stringForStreaming();
|
||||
stream << uc.stringForStreaming();
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -75,8 +74,7 @@ class CBaseStreamStringifier
|
||||
*/
|
||||
friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
||||
log << sf.stringForStreaming();
|
||||
log << uc.stringForStreaming();
|
||||
return log;
|
||||
}
|
||||
|
||||
@@ -88,12 +86,39 @@ class CBaseStreamStringifier
|
||||
*/
|
||||
friend std::ostream &operator<<(std::ostream &ostr, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
||||
ostr << sf.stringForStreaming().toStdString();
|
||||
ostr << uc.stringForStreaming().toStdString();
|
||||
return ostr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, DBus to object
|
||||
* \param argument
|
||||
* \param uc
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CBaseStreamStringifier &uc) {
|
||||
argument.beginStructure();
|
||||
uc.unmarshallFromDbus(argument);
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Marshalling operator <<, object to DBus
|
||||
* \param argument
|
||||
* \param pq
|
||||
* \return
|
||||
*/
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const CBaseStreamStringifier &uc)
|
||||
{
|
||||
argument.beginStructure();
|
||||
uc.marshallToDbus(argument);
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
*/
|
||||
@@ -109,6 +134,10 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Default constructor
|
||||
*/
|
||||
CBaseStreamStringifier() {}
|
||||
|
||||
/*!
|
||||
* \brief String for streaming operators
|
||||
@@ -126,6 +155,18 @@ protected:
|
||||
*/
|
||||
virtual QString stringForConverter() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &) const { }
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &) {}
|
||||
|
||||
/*!
|
||||
* \brief Copy assignment operator.
|
||||
* This is protected in order to forbid slicing an instance of one derived
|
||||
|
||||
@@ -29,8 +29,9 @@ void BlackMisc::PhysicalQuantities::registerMetadata()
|
||||
void BlackMisc::Aviation::registerMetadata()
|
||||
{
|
||||
CComSystem::registerMetadata();
|
||||
CAdfSystem::registerMetadata();
|
||||
CNavSystem::registerMetadata();
|
||||
CAdfSystem::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -50,6 +50,24 @@ protected:
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_name;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString name;
|
||||
argument >> name;
|
||||
(*this) = CMeasurementPrefix::fromPrefixName(name);
|
||||
}
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
@@ -224,6 +242,40 @@ public:
|
||||
return milli;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief All prefixes
|
||||
* \return
|
||||
*/
|
||||
static const QList<CMeasurementPrefix> &prefixes()
|
||||
{
|
||||
static QList<CMeasurementPrefix> prefixes;
|
||||
prefixes.append(CMeasurementPrefix::c());
|
||||
prefixes.append(CMeasurementPrefix::G());
|
||||
prefixes.append(CMeasurementPrefix::h());
|
||||
prefixes.append(CMeasurementPrefix::k());
|
||||
prefixes.append(CMeasurementPrefix::M());
|
||||
prefixes.append(CMeasurementPrefix::m());
|
||||
prefixes.append(CMeasurementPrefix::None());
|
||||
prefixes.append(CMeasurementPrefix::One());
|
||||
return prefixes;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Prefix from name
|
||||
* \param prefixName must be valid!
|
||||
* \return
|
||||
*/
|
||||
static const CMeasurementPrefix &fromPrefixName(const QString &prefixName) {
|
||||
QList<CMeasurementPrefix> prefixes = CMeasurementPrefix::prefixes();
|
||||
// read only, avoid deep copy
|
||||
for (int i = 0; i < prefixes.size(); ++i) {
|
||||
if (prefixes.at(i).getName() == prefixName) return (prefixes.at(i));
|
||||
}
|
||||
qFatal("Illegal unit name");
|
||||
return CMeasurementPrefix::None(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
@@ -243,16 +295,11 @@ protected:
|
||||
typedef double(*UnitConverter)(const CMeasurementUnit &, double);
|
||||
|
||||
/*!
|
||||
* \brief Get unit from DBus argument
|
||||
* \brief Stream to DBus
|
||||
* \param argument
|
||||
* \return
|
||||
*/
|
||||
static QString unitNameUnmarshalling(const QDBusArgument &argument) {
|
||||
QString type;
|
||||
argument.beginStructure();
|
||||
argument >> type;
|
||||
argument.endStructure();
|
||||
return type;
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_unitName;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -520,21 +567,6 @@ public:
|
||||
return abs(checkValue) <= this->m_epsilon;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Marshalling (to DBus) operator, unmarshalling to be found in specialized classes and
|
||||
* mapping back to static object
|
||||
* \brief Marshalling (to DBus) operator <<
|
||||
* \param argument
|
||||
* \param unit
|
||||
* \return
|
||||
*/
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const CMeasurementUnit& unit) {
|
||||
argument.beginStructure();
|
||||
argument << unit.m_unitName;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// -- static
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -422,40 +422,29 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, DBus to object
|
||||
* \brief Stream to DBus <<
|
||||
* \param argument
|
||||
* \param pq
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, PQ &pq) {
|
||||
argument.beginStructure();
|
||||
argument >> pq.m_unitValueD;
|
||||
argument >> pq.m_unitValueI;
|
||||
argument >> pq.m_convertedSiUnitValueD;
|
||||
argument >> pq.m_isIntegerBaseValue;
|
||||
argument >> pq.m_unit;
|
||||
argument >> pq.m_conversionSiUnit;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_unitValueD;
|
||||
argument << this->m_unitValueI;
|
||||
argument << this->m_convertedSiUnitValueD;
|
||||
argument << this->m_isIntegerBaseValue;
|
||||
argument << this->m_unit;
|
||||
argument << this->m_conversionSiUnit;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Marshalling operator <<, object to DBus
|
||||
* \brief Stream from DBus >>
|
||||
* \param argument
|
||||
* \param pq
|
||||
* \return
|
||||
*/
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const PQ& pq)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << pq.m_unitValueD;
|
||||
argument << pq.m_unitValueI;
|
||||
argument << pq.m_convertedSiUnitValueD;
|
||||
argument << pq.m_isIntegerBaseValue;
|
||||
argument << pq.m_unit;
|
||||
argument << pq.m_conversionSiUnit;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
argument >> this->m_unitValueD;
|
||||
argument >> this->m_unitValueI;
|
||||
argument >> this->m_convertedSiUnitValueD;
|
||||
argument >> this->m_isIntegerBaseValue;
|
||||
argument >> this->m_unit;
|
||||
argument >> this->m_conversionSiUnit;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -160,16 +160,15 @@ public:
|
||||
return CLengthUnit::m(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CLengthUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CLengthUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CLengthUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CLengthUnit)
|
||||
@@ -289,16 +288,15 @@ public:
|
||||
return CAngleUnit::rad(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CAngleUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CAngleUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CAngleUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAngleUnit)
|
||||
@@ -406,16 +404,15 @@ public:
|
||||
return CFrequencyUnit::Hz(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CFrequencyUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CFrequencyUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CFrequencyUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CFrequencyUnit)
|
||||
@@ -523,16 +520,15 @@ public:
|
||||
return CMassUnit::kg(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CMassUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CMassUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CMassUnit::fromUnitName(unitName);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -673,16 +669,15 @@ public:
|
||||
return CPressureUnit::Pa(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CPressureUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CPressureUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CPressureUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CPressureUnit)
|
||||
@@ -805,16 +800,15 @@ public:
|
||||
return CTemperatureUnit::K(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CTemperatureUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CTemperatureUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CTemperatureUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTemperatureUnit)
|
||||
@@ -942,16 +936,15 @@ public:
|
||||
return CSpeedUnit::m_s(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CSpeedUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CSpeedUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CSpeedUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CSpeedUnit)
|
||||
@@ -1068,16 +1061,15 @@ public:
|
||||
return CTimeUnit::s(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CTimeUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CTimeUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CTimeUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTimeUnit)
|
||||
@@ -1161,16 +1153,15 @@ public:
|
||||
return CAccelerationUnit::m_s2(); // just suppress "not all control paths return a value"
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
* \param dummy
|
||||
* \return
|
||||
*/
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CAccelerationUnit &unit) {
|
||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
||||
unit = CAccelerationUnit::fromUnitName(unitName);
|
||||
return argument;
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
QString unitName;
|
||||
argument >> unitName;
|
||||
(*this) = CAccelerationUnit::fromUnitName(unitName);
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAccelerationUnit)
|
||||
|
||||
Reference in New Issue
Block a user