refs #345 Second wave of value classes using the CValueObjectStdTuple CRTP class template, with inheritance.

This commit is contained in:
Mathew Sutcliffe
2014-11-07 23:56:53 +00:00
parent 79e401887c
commit 40362e706a
10 changed files with 18 additions and 445 deletions

View File

@@ -46,83 +46,6 @@ namespace BlackMisc
CModulator::setFrequencyStandby(f);
}
/*
* Marshall
*/
void CComSystem::marshallToDbus(QDBusArgument &argument) const
{
CModulator::marshallToDbus(argument);
argument << TupleConverter<CComSystem>::toTuple(*this);
}
/*
* Unmarshall
*/
void CComSystem::unmarshallFromDbus(const QDBusArgument &argument)
{
CModulator::unmarshallFromDbus(argument);
argument >> TupleConverter<CComSystem>::toTuple(*this);
}
/*
* Hash
*/
uint CComSystem::getValueHash() const
{
QList<uint> hashs;
hashs << CModulator::getValueHash();
hashs << qHash(TupleConverter<CComSystem>::toTuple(*this));
return BlackMisc::calculateHash(hashs, "CComSystem");
}
/*
* To JSON
*/
QJsonObject CComSystem::toJson() const
{
QJsonObject json = BlackMisc::serializeJson(CComSystem::jsonMembers(), TupleConverter<CComSystem>::toTuple(*this));
return BlackMisc::Json::appendJsonObject(json, CModulator::toJson());
}
/*
* To JSON
*/
void CComSystem::convertFromJson(const QJsonObject &json)
{
CModulator::convertFromJson(json);
BlackMisc::deserializeJson(json, CComSystem::jsonMembers(), TupleConverter<CComSystem>::toTuple(*this));
}
/*
* Members
*/
const QStringList &CComSystem::jsonMembers()
{
return TupleConverter<CComSystem>::jsonMembers();
}
/*
* Compare
*/
int CComSystem::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CComSystem &>(otherBase);
int result = compare(TupleConverter<CComSystem>::toTuple(*this), TupleConverter<CComSystem>::toTuple(other));
return result == 0 ? CModulator::compareImpl(otherBase) : result;
}
bool CComSystem::operator ==(const CComSystem &other) const
{
if (this == &other) return true;
if (!CModulator::operator ==(other)) return false;
return TupleConverter<CComSystem>::toTuple(*this) == TupleConverter<CComSystem>::toTuple(other);
}
bool CComSystem::operator !=(const CComSystem &other) const
{
return !((*this) == other);
}
/*
* Round to channel spacing
*/