/* 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/. */ #include "blackmisc/aviomodulator.h" #include "blackmisc/aviocomsystem.h" #include "blackmisc/avionavsystem.h" #include "blackmisc/avioadfsystem.h" #include "blackmisc/blackmiscfreefunctions.h" using BlackMisc::PhysicalQuantities::CFrequency; using BlackMisc::PhysicalQuantities::CFrequencyUnit; namespace BlackMisc { namespace Aviation { /* * Toggle standby <-> active */ template void CModulator::toggleActiveStandby() { CFrequency a = this->m_frequencyActive; this->m_frequencyActive = this->m_frequencyStandby; this->m_frequencyStandby = a; } /* * Register metadata */ template void CModulator::registerMetadata() { qRegisterMetaType(); qDBusRegisterMetaType(); } /* * To JSON */ template QJsonObject CModulator::toJson() const { return BlackMisc::serializeJson(CModulator::jsonMembers(), TupleConverter::toTuple(*this)); } /* * To JSON */ template void CModulator::fromJson(const QJsonObject &json) { BlackMisc::deserializeJson(json, CModulator::jsonMembers(), TupleConverter::toTuple(*this)); } /* * Members */ template const QStringList &CModulator::jsonMembers() { return TupleConverter::jsonMembers(); } /* * Equal operator == */ template bool CModulator::operator ==(const CModulator &other) const { if (this == &other) return true; if (!CAvionicsBase::operator ==(other)) return false; return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); } /* * Equal operator != */ template bool CModulator::operator !=(const CModulator &other) const { return !(other == (*this)); } /* * To DBus */ template void CModulator::marshallToDbus(QDBusArgument &argument) const { CAvionicsBase::marshallToDbus(argument); argument << TupleConverter::toTuple(*this); } /* * From DBus */ template void CModulator::unmarshallFromDbus(const QDBusArgument &argument) { CAvionicsBase::unmarshallFromDbus(argument); argument >> TupleConverter::toTuple(*this); } /* * Compare */ template int CModulator::compareImpl(const CValueObject &otherBase) const { const auto &other = static_cast(otherBase); int result = compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); return result == 0 ? CAvionicsBase::compareImpl(otherBase) : result; } /* * Value hash */ template uint CModulator::getValueHash() const { QList hashs; hashs << CAvionicsBase::getValueHash(); hashs << qHash(TupleConverter::toTuple(*this)); return BlackMisc::calculateHash(hashs, "CModulator"); } // see here for the reason of thess forward instantiations // http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html template class CModulator; template class CModulator; template class CModulator; } // namespace } // namespace