mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 07:15:34 +08:00
refs #345 Second wave of value classes using the CValueObjectStdTuple CRTP class template, with inheritance.
This commit is contained in:
@@ -111,54 +111,6 @@ namespace BlackMisc
|
||||
return CTransponder::isValidTransponderCode(QString::number(transponderCode));
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall
|
||||
*/
|
||||
void CTransponder::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
CAvionicsBase::marshallToDbus(argument);
|
||||
argument << TupleConverter<CTransponder>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall
|
||||
*/
|
||||
void CTransponder::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
CAvionicsBase::unmarshallFromDbus(argument);
|
||||
argument >> TupleConverter<CTransponder>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CTransponder::getValueHash() const
|
||||
{
|
||||
QList<uint> hashs;
|
||||
hashs << CAvionicsBase::getValueHash();
|
||||
hashs << qHash(TupleConverter<CTransponder>::toTuple(*this));
|
||||
return BlackMisc::calculateHash(hashs, "CTransponder");
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CTransponder::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CTransponder &>(otherBase);
|
||||
int result = compare(TupleConverter<CTransponder>::toTuple(*this), TupleConverter<CTransponder>::toTuple(other));
|
||||
return result == 0 ? CAvionicsBase::compareImpl(otherBase) : result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata of unit and quantity
|
||||
*/
|
||||
void CTransponder::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CTransponder>();
|
||||
qDBusRegisterMetaType<CTransponder>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Mode as readable string
|
||||
*/
|
||||
@@ -200,30 +152,6 @@ namespace BlackMisc
|
||||
return m;
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CTransponder::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CTransponder>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CTransponder::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CTransponder::jsonMembers(), TupleConverter<CTransponder>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* From Json
|
||||
*/
|
||||
void CTransponder::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CTransponder::jsonMembers(), TupleConverter<CTransponder>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Property
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user