mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Ref T120, refactoring of modulator related classes
* avoid virtual functions in modulator related classes * removed unused isDefaultValue() * using null values (which was not present when class was written) * removed destructor
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f936f07c8d
commit
4d9ee1626d
@@ -17,6 +17,7 @@
|
||||
#include "blackmisc/variant.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include <QtGlobal>
|
||||
#include <type_traits>
|
||||
|
||||
using BlackMisc::PhysicalQuantities::CFrequency;
|
||||
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
|
||||
@@ -25,16 +26,10 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
template <class AVIO>
|
||||
bool CModulator<AVIO>::isDefaultValue() const
|
||||
{
|
||||
return (this->m_frequencyActive == FrequencyNotSet());
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
void CModulator<AVIO>::toggleActiveStandby()
|
||||
{
|
||||
CFrequency a = this->m_frequencyActive;
|
||||
const CFrequency a = this->m_frequencyActive;
|
||||
this->m_frequencyActive = this->m_frequencyStandby;
|
||||
this->m_frequencyStandby = a;
|
||||
}
|
||||
@@ -180,15 +175,17 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
CModulator<AVIO>::CModulator() :
|
||||
m_name("default") {}
|
||||
CModulator<AVIO>::CModulator() : m_name("default")
|
||||
{
|
||||
static_assert(!std::is_polymorphic<AVIO>::value, "Must not use virtual functions for value classes");
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
CModulator<AVIO>::CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency) :
|
||||
m_name(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency) {}
|
||||
|
||||
template <class AVIO>
|
||||
CModulator<AVIO>::~CModulator() {}
|
||||
m_name(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency)
|
||||
{
|
||||
static_assert(!std::is_polymorphic<AVIO>::value, "Must not use virtual functions for value classes");
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
QString CModulator<AVIO>::convertToQString(bool i18n) const
|
||||
@@ -211,21 +208,6 @@ namespace BlackMisc
|
||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
|
||||
}
|
||||
|
||||
|
||||
template <class AVIO>
|
||||
void CModulator<AVIO>::setFrequencyActiveMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
void CModulator<AVIO>::setFrequencyStandbyMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = Math::CMathUtils::round(frequencyMHz, 3);
|
||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
const QString &CModulator<AVIO>::NameCom1()
|
||||
{
|
||||
@@ -282,13 +264,6 @@ namespace BlackMisc
|
||||
return n;
|
||||
}
|
||||
|
||||
template <class AVIO>
|
||||
const BlackMisc::PhysicalQuantities::CFrequency &CModulator<AVIO>::FrequencyNotSet()
|
||||
{
|
||||
static BlackMisc::PhysicalQuantities::CFrequency f;
|
||||
return f;
|
||||
}
|
||||
|
||||
// see here for the reason of the forward instantiations
|
||||
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
||||
//! \cond PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user