/* Copyright (C) 2013 * swift project Community / Contributors * * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, * including this file, may be copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE file. */ #include "blackmisc/aviomodulator.h" #include "blackmisc/aviocomsystem.h" #include "blackmisc/avionavsystem.h" #include "blackmisc/avioadfsystem.h" #include "blackmisc/propertyindex.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; } /* * Property by index */ template QVariant CModulator::propertyByIndex(const CPropertyIndex &index) const { if (index.isMyself()) { return this->toQVariant(); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexActiveFrequency: return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved()); case IndexStandbyFrequency: return this->getFrequencyStandby().propertyByIndex(index.copyFrontRemoved()); case IndexEnabled: return QVariant(this->isEnabled()); case IndexInputVolume: return QVariant(this->getVolumeInput()); case IndexOutputVolume: return QVariant(this->getVolumeOutput()); default: return CValueObject::propertyByIndex(index); } } /* * Property by index */ template void CModulator::setPropertyByIndex(const QVariant &variant, const CPropertyIndex &index) { if (index.isMyself()) { this->convertFromQVariant(variant); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexActiveFrequency: this->m_frequencyActive.setPropertyByIndex(variant, index.copyFrontRemoved()); break; case IndexStandbyFrequency: this->m_frequencyStandby.setPropertyByIndex(variant, index.copyFrontRemoved()); break; case IndexEnabled: this->setEnabled(variant.toBool()); break; case IndexInputVolume: this->setVolumeInput(variant.toInt()); break; case IndexOutputVolume: this->setVolumeOutput(variant.toInt()); break; default: CValueObject::setPropertyByIndex(variant, index); break; } } // 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