refs #395, refs #413, refs #403 Post merge tasks

* missing exports for new classes
* public non virtual convertToQString, propertyByIndex
* removed left-over of watchdog
* virtual destructor for avionicsbase.h
This commit is contained in:
Klaus Basan
2015-05-07 03:21:45 +02:00
committed by Mathew Sutcliffe
parent e7f65ba0b6
commit f18cfed087
16 changed files with 47 additions and 138 deletions

View File

@@ -12,6 +12,7 @@
#ifndef BLACKCORE_AIRSPACE_ANALYZER_H #ifndef BLACKCORE_AIRSPACE_ANALYZER_H
#define BLACKCORE_AIRSPACE_ANALYZER_H #define BLACKCORE_AIRSPACE_ANALYZER_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/network.h" #include "blackcore/network.h"
#include "blackmisc/simulation/airspaceaircraftsnapshot.h" #include "blackmisc/simulation/airspaceaircraftsnapshot.h"
#include "blackmisc/simulation/remoteaircraftprovider.h" #include "blackmisc/simulation/remoteaircraftprovider.h"
@@ -31,7 +32,7 @@ namespace BlackCore
//! clients nearby. The server does not take care of that. When a client crashes, no delete packet is ever sent. This class therefore monitors callsigns and emits a timeout signal if it //! clients nearby. The server does not take care of that. When a client crashes, no delete packet is ever sent. This class therefore monitors callsigns and emits a timeout signal if it
//! wasn't resetted during the specified timeout value. //! wasn't resetted during the specified timeout value.
//! //!
class CAirspaceAnalyzer : class BLACKCORE_EXPORT CAirspaceAnalyzer :
public BlackMisc::CContinuousWorker, public BlackMisc::CContinuousWorker,
public BlackMisc::Simulation::COwnAircraftAware, public BlackMisc::Simulation::COwnAircraftAware,
public BlackMisc::Simulation::CRemoteAircraftAware public BlackMisc::Simulation::CRemoteAircraftAware

View File

@@ -12,7 +12,11 @@
#ifndef BLACKCORE_AIRSPACE_MONITOR_H #ifndef BLACKCORE_AIRSPACE_MONITOR_H
#define BLACKCORE_AIRSPACE_MONITOR_H #define BLACKCORE_AIRSPACE_MONITOR_H
#include "blackcoreexport.h" #include "blackcore/blackcoreexport.h"
#include "blackcore/network.h"
#include "blackcore/vatsimbookingreader.h"
#include "blackcore/vatsimdatafilereader.h"
#include "airspace_analyzer.h"
#include "blackmisc/simulation/simulatedaircraftlist.h" #include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/simulation/ownaircraftprovider.h" #include "blackmisc/simulation/ownaircraftprovider.h"
#include "blackmisc/simulation/remoteaircraftprovider.h" #include "blackmisc/simulation/remoteaircraftprovider.h"
@@ -22,10 +26,6 @@
#include "blackmisc/aviation/flightplan.h" #include "blackmisc/aviation/flightplan.h"
#include "blackmisc/network/userlist.h" #include "blackmisc/network/userlist.h"
#include "blackmisc/aviation/callsignset.h" #include "blackmisc/aviation/callsignset.h"
#include "network.h"
#include "vatsimbookingreader.h"
#include "vatsimdatafilereader.h"
#include "airspace_analyzer.h"
namespace BlackCore namespace BlackCore
{ {

View File

@@ -1,83 +0,0 @@
/* Copyright (C) 2014
* 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.
*/
//! \file
#ifndef BLACKCORE_AIRSPACE_WATCHDOG_H
#define BLACKCORE_AIRSPACE_WATCHDOG_H
#include "blackcoreexport.h"
#include "blackmisc/pq/time.h"
#include "blackmisc/aviation/callsign.h"
#include <QObject>
#include <QHash>
namespace BlackCore
{
/*!
* CAirspaceWatchdog monitores any added callsign, if it has timed out.
*
* This class was introduced due to a flaw in the VATSIM server implementation:
* Every client needs to send an add/delete packet on its own to inform other
* clients nearby. The server does not take care of that. When a client crashes,
* no delete packet is ever sent. This class therefore monitors callsigns and
* emits a timeout signal if it wasn't resetted during the specified timeout
* value.
*/
class BLACKCORE_EXPORT CAirspaceWatchdog : public QObject
{
Q_OBJECT
public:
//! Default constructor
CAirspaceWatchdog(QObject *parent);
//! Constructor
CAirspaceWatchdog(const BlackMisc::PhysicalQuantities::CTime & initialTimeOut, QObject *parent);
//! Sets the maximum time, after a client is considered timed out
void setTimeout(const BlackMisc::PhysicalQuantities::CTime &value) { m_timeout = value; }
//! Returns the currently configured timeout value
const BlackMisc::PhysicalQuantities::CTime &getTimeout() const { return m_timeout; }
//! Add a new callsign to watch list
void addCallsign(const BlackMisc::Aviation::CCallsign &callsign);
//! Reset the watchdog for Callsign
//! The callsign must have been added by \sa addCallsign before.
void resetCallsign(const BlackMisc::Aviation::CCallsign &callsign);
//! Remove Callsign from watch list
void removeCallsign(const BlackMisc::Aviation::CCallsign &callsign);
//! Remove all watched callsigns
void removeAll();
signals:
//! Callsign has timed out
void timeout(const BlackMisc::Aviation::CCallsign &callsign);
protected:
//! \overload QObject::timerEvent
virtual void timerEvent(QTimerEvent * event) override;
private:
void checkTimeouts();
BlackMisc::PhysicalQuantities::CTime m_timeout = {15, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value
QHash<BlackMisc::Aviation::CCallsign, QDateTime> m_callsignTimestamps; //!< Hash of callsigns and latest timestamp
};
} // namespace
#endif

View File

@@ -12,6 +12,7 @@
#ifndef BLACKCORE_SIMULATOR_COMMON_H #ifndef BLACKCORE_SIMULATOR_COMMON_H
#define BLACKCORE_SIMULATOR_COMMON_H #define BLACKCORE_SIMULATOR_COMMON_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/interpolator.h" #include "blackcore/interpolator.h"
#include "blackcore/simulator.h" #include "blackcore/simulator.h"
#include "blackmisc/simulation/simulatorplugininfo.h" #include "blackmisc/simulation/simulatorplugininfo.h"
@@ -31,7 +32,7 @@ namespace BlackCore
{ {
//! Common base class with providers, interface and some base functionality //! Common base class with providers, interface and some base functionality
class CSimulatorCommon : class BLACKCORE_EXPORT CSimulatorCommon :
public BlackCore::ISimulator, public BlackCore::ISimulator,
public BlackMisc::Simulation::COwnAircraftAware, // gain access to in memor own aircraft data public BlackMisc::Simulation::COwnAircraftAware, // gain access to in memor own aircraft data
public BlackMisc::Simulation::CRemoteAircraftAware // gain access to in memory remote aircraft data public BlackMisc::Simulation::CRemoteAircraftAware // gain access to in memory remote aircraft data

View File

@@ -35,7 +35,13 @@ namespace BlackMisc
//! Are set values valid? //! Are set values valid?
virtual bool validValues() const { return true; } virtual bool validValues() const { return true; }
//! Virtual destructor
virtual ~CAvionicsBase() {}
protected: protected:
//! Constructor
CAvionicsBase() : m_name("default") {}
//! Constructor //! Constructor
CAvionicsBase(const QString &name) : m_name(name) {} CAvionicsBase(const QString &name) : m_name(name) {}

View File

@@ -88,10 +88,13 @@ namespace BlackMisc
void setEnabled(bool enable) { this->m_enabled = enable;} void setEnabled(bool enable) { this->m_enabled = enable;}
//! \copydoc CValueObject::propertyByIndex //! \copydoc CValueObject::propertyByIndex
virtual CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
//! \copydoc CValueObject::setPropertyByIndex //! \copydoc CValueObject::setPropertyByIndex
virtual void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index) override; void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
//! \copydoc CValueObject::convertToQString
QString convertToQString(bool i18n = false) const;
protected: protected:
//! Default constructor //! Default constructor
@@ -101,9 +104,6 @@ namespace BlackMisc
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency) : CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency) :
CModulator::CValueObject(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency) {} CModulator::CValueObject(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency) {}
//! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n = false) const override;
//! Set active frequency //! Set active frequency
void setFrequencyActiveKHz(double frequencyKHz) void setFrequencyActiveKHz(double frequencyKHz)
{ {
@@ -207,16 +207,18 @@ namespace BlackMisc
//! Easy access to derived class (CRTP template parameter) //! Easy access to derived class (CRTP template parameter)
AVIO *derived() { return static_cast<AVIO *>(this); } AVIO *derived() { return static_cast<AVIO *>(this); }
//! \cond PRIVATE
class CComSystem;
class CNavSystem;
class CAdfSystem;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CComSystem>;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CNavSystem>;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CAdfSystem>;
//! \endcond
}; };
//! \cond PRIVATE
class CComSystem;
class CNavSystem;
class CAdfSystem;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CComSystem>;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CNavSystem>;
extern template class BLACKMISC_EXPORT_TEMPLATE CModulator<CAdfSystem>;
//! \endcond
} // namespace } // namespace
} // namespace } // namespace

View File

@@ -176,8 +176,8 @@ namespace BlackMisc
TransponderMode m_transponderMode; //!< Transponder mode TransponderMode m_transponderMode; //!< Transponder mode
}; };
} } // ns
} } // ns
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Aviation::CTransponder, ( BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Aviation::CTransponder, (
o.m_transponderCode, o.m_transponderCode,

View File

@@ -319,7 +319,6 @@ namespace BlackMisc
BLACKMISC_EXPORT QJsonObject applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject); BLACKMISC_EXPORT QJsonObject applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject);
} // BlackMisc } // BlackMisc
#endif // guard #endif // guard

View File

@@ -22,12 +22,6 @@ namespace BlackMisc
return this->m_unit; return this->m_unit;
} }
template <class MU, class PQ>
void CPhysicalQuantity<MU, PQ>::setUnit(const MU &unit)
{
this->m_unit = unit;
}
template <class MU, class PQ> template <class MU, class PQ>
void CPhysicalQuantity<MU, PQ>::setUnitBySymbol(const QString &unitName) void CPhysicalQuantity<MU, PQ>::setUnitBySymbol(const QString &unitName)
{ {

View File

@@ -82,11 +82,6 @@ namespace BlackMisc
return s; return s;
} }
int CPropertyIndexVariantMap::getMetaTypeId() const
{
return qMetaTypeId<CPropertyIndexVariantMap>();
}
void CPropertyIndexVariantMap::marshallToDbus(QDBusArgument &argument) const void CPropertyIndexVariantMap::marshallToDbus(QDBusArgument &argument) const
{ {
argument << this->m_values.keys(); argument << this->m_values.keys();
@@ -136,12 +131,6 @@ namespace BlackMisc
return CPropertyIndexList::fromImpl(this->m_values.keys()); return CPropertyIndexList::fromImpl(this->m_values.keys());
} }
void CPropertyIndexVariantMap::registerMetadata()
{
qRegisterMetaType<CPropertyIndexVariantMap>();
qDBusRegisterMetaType<CPropertyIndexVariantMap>();
}
uint CPropertyIndexVariantMap::getValueHash() const uint CPropertyIndexVariantMap::getValueHash() const
{ {
// there is no hash for map, so I use this workaround here // there is no hash for map, so I use this workaround here

View File

@@ -120,10 +120,8 @@ namespace BlackMisc
public Mixin::String<CPropertyIndexVariantMap> public Mixin::String<CPropertyIndexVariantMap>
{ {
public: public:
/*! //! Constructor
* Constructor //! \param wildcard when used in search, for setting values irrelevant
* \param wildcard when used in search, for setting values irrelevant
*/
CPropertyIndexVariantMap(bool wildcard = false); CPropertyIndexVariantMap(bool wildcard = false);
//! Single value constructor //! Single value constructor
@@ -240,6 +238,7 @@ namespace BlackMisc
//! \copydoc CValueObject::unmarshallFromDbus //! \copydoc CValueObject::unmarshallFromDbus
void unmarshallFromDbus(const QDBusArgument &argument); void unmarshallFromDbus(const QDBusArgument &argument);
}; };
namespace Mixin namespace Mixin

View File

@@ -12,6 +12,7 @@
#ifndef BLACKMISC_SIMULATION_AIRSPACEAIRCRAFTANALYZER_H #ifndef BLACKMISC_SIMULATION_AIRSPACEAIRCRAFTANALYZER_H
#define BLACKMISC_SIMULATION_AIRSPACEAIRCRAFTANALYZER_H #define BLACKMISC_SIMULATION_AIRSPACEAIRCRAFTANALYZER_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/simulation/simulatedaircraftlist.h" #include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/aviation/callsignset.h" #include "blackmisc/aviation/callsignset.h"
#include "blackmisc/propertyindex.h" #include "blackmisc/propertyindex.h"
@@ -22,7 +23,7 @@ namespace BlackMisc
namespace Simulation namespace Simulation
{ {
//! Current situation in the sky analyzed. //! Current situation in the sky analyzed.
class CAirspaceAircraftSnapshot : public CValueObject<CAirspaceAircraftSnapshot> class BLACKMISC_EXPORT CAirspaceAircraftSnapshot : public CValueObject<CAirspaceAircraftSnapshot>
{ {
public: public:
//! Default constructor //! Default constructor
@@ -74,14 +75,13 @@ namespace BlackMisc
bool isRenderingEnabled() const { return m_renderingEnabled; } bool isRenderingEnabled() const { return m_renderingEnabled; }
//! \copydoc CValueObject::propertyByIndex //! \copydoc CValueObject::propertyByIndex
virtual CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
//! \copydoc CValueObject::setPropertyByIndex //! \copydoc CValueObject::setPropertyByIndex
virtual void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index) override; void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
protected:
//! \copydoc CValueObject::convertToQString //! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n = false) const override; QString convertToQString(bool i18n = false) const;
private: private:
BLACK_ENABLE_TUPLE_CONVERSION(CAirspaceAircraftSnapshot) BLACK_ENABLE_TUPLE_CONVERSION(CAirspaceAircraftSnapshot)

View File

@@ -21,7 +21,7 @@ namespace BlackMisc
{ {
//! Direct threadsafe in memory access to own aircraft //! Direct threadsafe in memory access to own aircraft
class IOwnAircraftProvider class BLACKMISC_EXPORT IOwnAircraftProvider
{ {
public: public:
@@ -83,7 +83,7 @@ namespace BlackMisc
}; };
//! Delegating class which can be directly used to access an \sa IOwnAircraftProvider instance //! Delegating class which can be directly used to access an \sa IOwnAircraftProvider instance
class COwnAircraftAware class BLACKMISC_EXPORT COwnAircraftAware
{ {
public: public:
//! \copydoc IOwnAircraftProvider::getOwnAircraft //! \copydoc IOwnAircraftProvider::getOwnAircraft

View File

@@ -12,6 +12,7 @@
#ifndef BLACKMISC_SIMULATION_OWNAIRCRAFTPROVIDERDUMMY_H #ifndef BLACKMISC_SIMULATION_OWNAIRCRAFTPROVIDERDUMMY_H
#define BLACKMISC_SIMULATION_OWNAIRCRAFTPROVIDERDUMMY_H #define BLACKMISC_SIMULATION_OWNAIRCRAFTPROVIDERDUMMY_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/simulation/ownaircraftprovider.h" #include "blackmisc/simulation/ownaircraftprovider.h"
namespace BlackMisc namespace BlackMisc
@@ -19,7 +20,7 @@ namespace BlackMisc
namespace Simulation namespace Simulation
{ {
//! For testing, thread safety not implemented in this class //! For testing, thread safety not implemented in this class
class COwnAircraftProviderDummy : class BLACKMISC_EXPORT COwnAircraftProviderDummy :
public QObject, public QObject,
public IOwnAircraftProvider public IOwnAircraftProvider
{ {

View File

@@ -109,7 +109,7 @@ namespace BlackMisc
}; };
//! Class which can be directly used to access an \sa IRemoteAircraftProvider object //! Class which can be directly used to access an \sa IRemoteAircraftProvider object
class CRemoteAircraftAware class BLACKMISC_EXPORT CRemoteAircraftAware
{ {
public: public:
//! \copydoc IRemoteAircraftProvider::getAircraftInRange //! \copydoc IRemoteAircraftProvider::getAircraftInRange

View File

@@ -47,7 +47,7 @@ namespace BlackMisc
static void registerMetadata() static void registerMetadata()
{ {
Private::MetaTypeHelper<Derived>::maybeRegisterMetaType(); Private::MetaTypeHelper<Derived>::maybeRegisterMetaType();
//! \todo KB: What does this monster do? Please some comment
[](...){}((qRegisterMetaType<AdditionalTypes>(), qDBusRegisterMetaType<AdditionalTypes>(), 0)...); [](...){}((qRegisterMetaType<AdditionalTypes>(), qDBusRegisterMetaType<AdditionalTypes>(), 0)...);
} }