mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #402, post merge feedback by MS
This commit is contained in:
@@ -19,7 +19,7 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
|
||||
Client::Client(QObject *parent)
|
||||
: QObject(parent), COwnAircraftProviderSupport(COwnAircraftProviderDummy::instance()),
|
||||
: QObject(parent), COwnAircraftAware(COwnAircraftProviderDummy::instance()),
|
||||
m_net(new BlackCore::CNetworkVatlib(COwnAircraftProviderDummy::instance(), this))
|
||||
{
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#include <QMap>
|
||||
#include <functional>
|
||||
|
||||
class Client : public QObject, BlackMisc::Simulation::COwnAircraftProviderSupport
|
||||
class Client :
|
||||
public QObject,
|
||||
public BlackMisc::Simulation::COwnAircraftAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackCore
|
||||
|
||||
CAirspaceMonitor::CAirspaceMonitor(QObject *parent, const BlackMisc::Simulation::IOwnAircraftProviderReadOnly *ownAircraftProvider, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile)
|
||||
: QObject(parent),
|
||||
COwnAircraftProviderSupportReadOnly(ownAircraftProvider),
|
||||
COwnAircraftAwareReadOnly(ownAircraftProvider),
|
||||
m_network(network), m_vatsimBookingReader(bookings), m_vatsimDataFileReader(dataFile),
|
||||
m_atcWatchdog(this), m_aircraftWatchdog(this)
|
||||
{
|
||||
@@ -144,8 +144,7 @@ namespace BlackCore
|
||||
CSimulatedAircraft aircraft = m_aircraftInRange.findFirstByCallsign(callsign);
|
||||
if (!aircraft.hasValidCallsign()) { return false; }
|
||||
|
||||
CAircraftModel newModel(model);
|
||||
aircraft.setModel(newModel); // this consolidates all common data such as callsign, ICAO ...
|
||||
aircraft.setModel(model); // this consolidates all common data such as callsign, ICAO ...
|
||||
|
||||
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, aircraft.getModel().toCVariant());
|
||||
int c = m_aircraftInRange.applyIfCallsign(callsign, vm);
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace BlackCore
|
||||
*/
|
||||
class CAirspaceMonitor :
|
||||
public QObject,
|
||||
public BlackMisc::Simulation::IRemoteAircraftProvider, // those data will be provided from the class CAirspaceMonitor
|
||||
public BlackMisc::Simulation::COwnAircraftProviderSupportReadOnly // used to obtain in memory inofmration about own aircraft
|
||||
public BlackMisc::Simulation::IRemoteAircraftProvider, // those data will be provided from the class CAirspaceMonitor
|
||||
public BlackMisc::Simulation::COwnAircraftAwareReadOnly // used to obtain in memory inofmration about own aircraft
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(BlackMisc::Simulation::IRemoteAircraftProvider)
|
||||
@@ -131,8 +131,8 @@ namespace BlackCore
|
||||
std::function<void(const BlackMisc::Aviation::CCallsign &)> removedAircraftSlot
|
||||
) override;
|
||||
|
||||
const qint64 AircraftSituationsRemovedOffsetMs = 30 * 1000; //!< situations older than now - offset will be removed
|
||||
const qint64 AircraftPartsRemoveOffsetMs = 30* 1000; //!< parts older than now - offset will be removed
|
||||
static const qint64 AircraftSituationsRemovedOffsetMs = 30 * 1000; //!< situations older than now - offset will be removed
|
||||
static const qint64 AircraftPartsRemoveOffsetMs = 30* 1000; //!< parts older than now - offset will be removed
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BlackCore
|
||||
|
||||
IInterpolator::IInterpolator(IRemoteAircraftProviderReadOnly *provider, const QString &workerName, QObject *parent) :
|
||||
CContinuousWorker(parent, workerName),
|
||||
CRemoteAircraftProviderSupportReadOnly(provider)
|
||||
CRemoteAircraftAwareReadOnly(provider)
|
||||
{
|
||||
Q_ASSERT(provider);
|
||||
this->m_situationsByCallsign = this->remoteAircraftSituations().splitPerCallsign();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackCore
|
||||
//! Interpolator, calculation inbetween positions
|
||||
class IInterpolator :
|
||||
public BlackMisc::CContinuousWorker,
|
||||
public BlackMisc::Simulation::CRemoteAircraftProviderSupportReadOnly
|
||||
public BlackMisc::Simulation::CRemoteAircraftAwareReadOnly
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackCore
|
||||
void exceptionDispatcher(const char *caller);
|
||||
|
||||
CNetworkVatlib::CNetworkVatlib(Simulation::IOwnAircraftProvider *ownAircraft, QObject *parent)
|
||||
: INetwork(parent), COwnAircraftProviderSupport(ownAircraft),
|
||||
: INetwork(parent), COwnAircraftAware(ownAircraft),
|
||||
m_loginMode(LoginNormal),
|
||||
m_status(vatStatusIdle),
|
||||
m_fsdTextCodec(QTextCodec::codecForName("latin1")),
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackCore
|
||||
*/
|
||||
class CNetworkVatlib :
|
||||
public INetwork,
|
||||
public BlackMisc::Simulation::COwnAircraftProviderSupport // network vatlib consumes own aircraft data and sets ICAO/callsign data
|
||||
public BlackMisc::Simulation::COwnAircraftAware // network vatlib consumes own aircraft data and sets ICAO/callsign data
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace BlackCore
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
QObject *parent)
|
||||
: ISimulator(parent),
|
||||
COwnAircraftProviderSupport(ownAircraftProvider),
|
||||
CRemoteAircraftProviderSupport(remoteAircraftProvider)
|
||||
COwnAircraftAware(ownAircraftProvider),
|
||||
CRemoteAircraftAware(remoteAircraftProvider)
|
||||
{
|
||||
m_oneSecondTimer = new QTimer(this);
|
||||
connect(this->m_oneSecondTimer, &QTimer::timeout, this, &CSimulatorCommon::ps_oneSecondTimer);
|
||||
|
||||
@@ -259,8 +259,8 @@ namespace BlackCore
|
||||
//! Common base class with providers, interface and some base functionality
|
||||
class CSimulatorCommon :
|
||||
public BlackCore::ISimulator,
|
||||
public BlackMisc::Simulation::COwnAircraftProviderSupport, // gain access to in memor own aircraft data
|
||||
public BlackMisc::Simulation::CRemoteAircraftProviderSupport // gain access to in memory remote 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
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
@@ -32,16 +32,9 @@ namespace BlackCore
|
||||
|
||||
void CVatsimBookingReader::readInBackgroundThread()
|
||||
{
|
||||
if (QThread::currentThread() == QObject::thread())
|
||||
{
|
||||
ps_read();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool s = QMetaObject::invokeMethod(this, "ps_read", Qt::BlockingQueuedConnection);
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
bool s = QMetaObject::invokeMethod(this, "ps_read");
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
void CVatsimBookingReader::ps_read()
|
||||
|
||||
@@ -126,16 +126,9 @@ namespace BlackCore
|
||||
|
||||
void CVatsimDataFileReader::readInBackgroundThread()
|
||||
{
|
||||
if (QThread::currentThread() == QObject::thread())
|
||||
{
|
||||
ps_read();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool s = QMetaObject::invokeMethod(this, "ps_read", Qt::BlockingQueuedConnection);
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
bool s = QMetaObject::invokeMethod(this, "ps_read");
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
void CVatsimDataFileReader::ps_read()
|
||||
|
||||
@@ -43,13 +43,6 @@ namespace BlackMisc
|
||||
//! Metadata
|
||||
static void registerMetadata();
|
||||
|
||||
protected:
|
||||
//! Myself
|
||||
virtual const CAircraftSituationList &container() const override { return *this; }
|
||||
|
||||
//! Myself
|
||||
virtual CAircraftSituationList &container() override { return *this; }
|
||||
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -55,13 +55,6 @@ namespace BlackMisc
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
protected:
|
||||
//! Myself
|
||||
virtual const CAirportList &container() const override { return *this; }
|
||||
|
||||
//! Myself
|
||||
virtual CAirportList &container() override { return *this; }
|
||||
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
@@ -24,6 +24,18 @@ namespace BlackMisc
|
||||
ICallsignObjectList<OBJ, CONTAINER>::ICallsignObjectList()
|
||||
{ }
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
const CONTAINER &ICallsignObjectList<OBJ, CONTAINER>::container() const
|
||||
{
|
||||
return static_cast<const CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
CONTAINER &ICallsignObjectList<OBJ, CONTAINER>::container()
|
||||
{
|
||||
return static_cast<CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
bool ICallsignObjectList<OBJ, CONTAINER>::containsCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
|
||||
@@ -77,10 +77,10 @@ namespace BlackMisc
|
||||
ICallsignObjectList();
|
||||
|
||||
//! Container
|
||||
virtual const CONTAINER &container() const = 0;
|
||||
const CONTAINER &container() const;
|
||||
|
||||
//! Container
|
||||
virtual CONTAINER &container() = 0;
|
||||
CONTAINER &container();
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
@@ -24,6 +24,18 @@ namespace BlackMisc
|
||||
IGeoObjectList<OBJ, CONTAINER>::IGeoObjectList()
|
||||
{ }
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
const CONTAINER &IGeoObjectList<OBJ, CONTAINER>::container() const
|
||||
{
|
||||
return static_cast<const CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
CONTAINER &IGeoObjectList<OBJ, CONTAINER>::container()
|
||||
{
|
||||
return static_cast<CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
IGeoObjectWithRelativePositionList<OBJ, CONTAINER>::IGeoObjectWithRelativePositionList()
|
||||
{ }
|
||||
|
||||
@@ -39,10 +39,10 @@ namespace BlackMisc
|
||||
IGeoObjectList();
|
||||
|
||||
//! Container
|
||||
virtual const CONTAINER &container() const = 0;
|
||||
const CONTAINER &container() const;
|
||||
|
||||
//! Container
|
||||
virtual CONTAINER &container() = 0;
|
||||
CONTAINER &container();
|
||||
};
|
||||
|
||||
//! List of objects with geo coordinates.
|
||||
|
||||
@@ -89,13 +89,6 @@ namespace BlackMisc
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
protected:
|
||||
//! Myself
|
||||
virtual const CTextMessageList &container() const override { return *this; }
|
||||
|
||||
//! Myself
|
||||
virtual CTextMessageList &container() override { return *this; }
|
||||
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
@@ -18,37 +18,37 @@ namespace BlackMisc
|
||||
namespace Simulation
|
||||
{
|
||||
|
||||
const CSimulatedAircraft &COwnAircraftProviderSupportReadOnly::ownAircraft() const
|
||||
const CSimulatedAircraft &COwnAircraftAwareReadOnly::ownAircraft() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "ownAircraft", "No object available");
|
||||
return this->m_ownAircraftProvider->ownAircraft();
|
||||
}
|
||||
|
||||
const CSimulatedAircraft &COwnAircraftProviderSupport::ownAircraft() const
|
||||
const CSimulatedAircraft &COwnAircraftAware::ownAircraft() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "ownAircraft", "No object available");
|
||||
return this->m_ownAircraftProvider->ownAircraft();
|
||||
}
|
||||
|
||||
CSimulatedAircraft &COwnAircraftProviderSupport::ownAircraft()
|
||||
CSimulatedAircraft &COwnAircraftAware::ownAircraft()
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "ownAircraft", "No object available");
|
||||
return this->m_ownAircraftProvider->ownAircraft();
|
||||
}
|
||||
|
||||
bool COwnAircraftProviderSupport::providerUpdateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const QString &originator)
|
||||
bool COwnAircraftAware::providerUpdateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const QString &originator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "providerUpdateCockpit", "No object available");
|
||||
return this->m_ownAircraftProvider->updateCockpit(com1, com2, transponder, originator);
|
||||
}
|
||||
|
||||
bool COwnAircraftProviderSupport::providerUpdateActiveComFrequency(const CFrequency &frequency, int comUnit, const QString &originator)
|
||||
bool COwnAircraftAware::providerUpdateActiveComFrequency(const CFrequency &frequency, int comUnit, const QString &originator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "providerUpdateActiveComFrequency", "No object available");
|
||||
return this->m_ownAircraftProvider->updateActiveComFrequency(frequency, comUnit, originator);
|
||||
}
|
||||
|
||||
bool COwnAircraftProviderSupport::providerUpdateSelcal(const CSelcal &selcal, const QString &originator)
|
||||
bool COwnAircraftAware::providerUpdateSelcal(const CSelcal &selcal, const QString &originator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_ownAircraftProvider, "providerUpdateSelcal", "No object available");
|
||||
return this->m_ownAircraftProvider->updateSelcal(selcal, originator);
|
||||
|
||||
@@ -70,13 +70,13 @@ namespace BlackMisc
|
||||
static COwnAircraftProviderDummy *instance();
|
||||
|
||||
//! \copydoc IOwnAircraftProviderReadOnly::ownAircraft
|
||||
virtual const CSimulatedAircraft &ownAircraft() const { return this->m_ownAircraft; }
|
||||
virtual const CSimulatedAircraft &ownAircraft() const override { return this->m_ownAircraft; }
|
||||
|
||||
//! \copydoc IOwnAircraftProvider::ownAircraft
|
||||
virtual CSimulatedAircraft &ownAircraft() { return this->m_ownAircraft; }
|
||||
virtual CSimulatedAircraft &ownAircraft() override { return this->m_ownAircraft; }
|
||||
|
||||
//! \copydoc IOwnAircraftProvider::getOwnAircraft
|
||||
virtual CSimulatedAircraft getOwnAircraft() const { return this->m_ownAircraft; }
|
||||
virtual CSimulatedAircraft getOwnAircraft() const override { return this->m_ownAircraft; }
|
||||
|
||||
public slots:
|
||||
//! \copydoc IOwnAircraftProvider::updateCockpit
|
||||
@@ -92,8 +92,8 @@ namespace BlackMisc
|
||||
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft;
|
||||
};
|
||||
|
||||
//! Class which can be directly used providing access to such an interface
|
||||
class COwnAircraftProviderSupportReadOnly
|
||||
//! Delegating class which can be directly used to access an \sa IOwnAircraftProviderReadOnly instance
|
||||
class COwnAircraftAwareReadOnly
|
||||
{
|
||||
public:
|
||||
//! \copydoc IOwnAircraftProviderReadOnly::ownAircraft
|
||||
@@ -101,12 +101,12 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
COwnAircraftProviderSupportReadOnly(const IOwnAircraftProviderReadOnly *ownAircraftProvider) : m_ownAircraftProvider(ownAircraftProvider) {}
|
||||
COwnAircraftAwareReadOnly(const IOwnAircraftProviderReadOnly *ownAircraftProvider) : m_ownAircraftProvider(ownAircraftProvider) {}
|
||||
const IOwnAircraftProviderReadOnly *m_ownAircraftProvider = nullptr; //!< access to object
|
||||
};
|
||||
|
||||
//! Delegating class which can be directly used providing access to such an interface
|
||||
class COwnAircraftProviderSupport
|
||||
//! Delegating class which can be directly used to access an \sa IOwnAircraftProvider instance
|
||||
class COwnAircraftAware
|
||||
{
|
||||
public:
|
||||
//! \copydoc IOwnAircraftProviderReadOnly::ownAircraft
|
||||
@@ -126,7 +126,7 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
COwnAircraftProviderSupport(IOwnAircraftProvider *ownAircraftProvider) : m_ownAircraftProvider(ownAircraftProvider) { Q_ASSERT(ownAircraftProvider); }
|
||||
COwnAircraftAware(IOwnAircraftProvider *ownAircraftProvider) : m_ownAircraftProvider(ownAircraftProvider) { Q_ASSERT(ownAircraftProvider); }
|
||||
IOwnAircraftProvider *m_ownAircraftProvider = nullptr; //!< access to object
|
||||
};
|
||||
|
||||
|
||||
@@ -16,67 +16,67 @@ namespace BlackMisc
|
||||
namespace Simulation
|
||||
{
|
||||
|
||||
const CSimulatedAircraftList &CRemoteAircraftProviderSupportReadOnly::remoteAircraft() const
|
||||
const CSimulatedAircraftList &CRemoteAircraftAwareReadOnly::remoteAircraft() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraft", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraft();
|
||||
}
|
||||
|
||||
const Aviation::CAircraftSituationList &CRemoteAircraftProviderSupportReadOnly::remoteAircraftSituations() const
|
||||
const Aviation::CAircraftSituationList &CRemoteAircraftAwareReadOnly::remoteAircraftSituations() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftSituations();
|
||||
}
|
||||
|
||||
const Aviation::CAircraftPartsList &CRemoteAircraftProviderSupportReadOnly::remoteAircraftParts() const
|
||||
const Aviation::CAircraftPartsList &CRemoteAircraftAwareReadOnly::remoteAircraftParts() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftParts", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftParts();
|
||||
}
|
||||
|
||||
const CSimulatedAircraftList &CRemoteAircraftProviderSupport::remoteAircraft() const
|
||||
const CSimulatedAircraftList &CRemoteAircraftAware::remoteAircraft() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraft", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraft();
|
||||
}
|
||||
|
||||
CSimulatedAircraftList &CRemoteAircraftProviderSupport::remoteAircraft()
|
||||
CSimulatedAircraftList &CRemoteAircraftAware::remoteAircraft()
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraft", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraft();
|
||||
}
|
||||
|
||||
const CAircraftSituationList &CRemoteAircraftProviderSupport::remoteAircraftSituations() const
|
||||
const CAircraftSituationList &CRemoteAircraftAware::remoteAircraftSituations() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftSituations();
|
||||
}
|
||||
|
||||
CAircraftSituationList &CRemoteAircraftProviderSupport::remoteAircraftSituations()
|
||||
CAircraftSituationList &CRemoteAircraftAware::remoteAircraftSituations()
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftSituations();
|
||||
}
|
||||
|
||||
const CAircraftPartsList &CRemoteAircraftProviderSupport::remoteAircraftParts() const
|
||||
const CAircraftPartsList &CRemoteAircraftAware::remoteAircraftParts() const
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftParts", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftParts();
|
||||
}
|
||||
|
||||
CAircraftPartsList &CRemoteAircraftProviderSupport::remoteAircraftParts()
|
||||
CAircraftPartsList &CRemoteAircraftAware::remoteAircraftParts()
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "renderedAircraftParts", "No object available");
|
||||
return this->m_remoteAircraftProvider->remoteAircraftParts();
|
||||
}
|
||||
|
||||
bool CRemoteAircraftProviderSupport::providerUpdateAircraftModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, const QString &originator)
|
||||
bool CRemoteAircraftAware::providerUpdateAircraftModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, const QString &originator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "providerUpdateAircraftModel", "No object available");
|
||||
return this->m_remoteAircraftProvider->updateAircraftModel(callsign, model, originator);
|
||||
}
|
||||
|
||||
bool CRemoteAircraftProviderSupport::providerUpdateAircraftEnabled(const Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator)
|
||||
bool CRemoteAircraftAware::providerUpdateAircraftEnabled(const Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, "providerUpdateAircraftEnabled", "No object available");
|
||||
return this->m_remoteAircraftProvider->updateAircraftEnabled(callsign, enabledForRedering, originator);
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace BlackMisc
|
||||
virtual bool updateFastPositionUpdates(const BlackMisc::Aviation::CCallsign &callsign, bool enableFastPositonUpdates, const QString &originator) = 0;
|
||||
};
|
||||
|
||||
//! Class which can be directly used providing access to such an interface
|
||||
class CRemoteAircraftProviderSupportReadOnly
|
||||
//! Class which can be directly used to access an \sa IRemoteAircraftProviderReadOnly object
|
||||
class CRemoteAircraftAwareReadOnly
|
||||
{
|
||||
public:
|
||||
//! \copydoc IRemoteAircraftProviderReadOnly::renderedAircraft
|
||||
@@ -103,16 +103,16 @@ namespace BlackMisc
|
||||
virtual const BlackMisc::Aviation::CAircraftPartsList &remoteAircraftParts() const;
|
||||
|
||||
//! Destructor
|
||||
virtual ~CRemoteAircraftProviderSupportReadOnly() {}
|
||||
virtual ~CRemoteAircraftAwareReadOnly() {}
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CRemoteAircraftProviderSupportReadOnly(const IRemoteAircraftProviderReadOnly *remoteAircraftProvider) : m_remoteAircraftProvider(remoteAircraftProvider) {}
|
||||
CRemoteAircraftAwareReadOnly(const IRemoteAircraftProviderReadOnly *remoteAircraftProvider) : m_remoteAircraftProvider(remoteAircraftProvider) {}
|
||||
const IRemoteAircraftProviderReadOnly *m_remoteAircraftProvider = nullptr; //!< access to object
|
||||
};
|
||||
|
||||
//! Delegating class which can be directly used providing access to such an interface
|
||||
class CRemoteAircraftProviderSupport
|
||||
//! Class which can be directly used to access an \sa IRemoteAircraftProvider object
|
||||
class CRemoteAircraftAware
|
||||
{
|
||||
public:
|
||||
//! \copydoc IRemoteAircraftProviderReadOnly::renderedAircraft
|
||||
@@ -140,11 +140,11 @@ namespace BlackMisc
|
||||
virtual bool providerUpdateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const QString &originator);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CRemoteAircraftProviderSupport() {}
|
||||
virtual ~CRemoteAircraftAware() {}
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CRemoteAircraftProviderSupport(IRemoteAircraftProvider *remoteAircraftProvider) : m_remoteAircraftProvider(remoteAircraftProvider) { Q_ASSERT(remoteAircraftProvider); }
|
||||
CRemoteAircraftAware(IRemoteAircraftProvider *remoteAircraftProvider) : m_remoteAircraftProvider(remoteAircraftProvider) { Q_ASSERT(remoteAircraftProvider); }
|
||||
IRemoteAircraftProvider *m_remoteAircraftProvider = nullptr; //!< access to object
|
||||
};
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace BlackMisc
|
||||
CRemoteAircraftProviderDummy(QObject *parent = nullptr);
|
||||
|
||||
//! IRemoteAircraftProviderReadOnly::remoteAircraft
|
||||
virtual const CSimulatedAircraftList &remoteAircraft() const;
|
||||
virtual const CSimulatedAircraftList &remoteAircraft() const override;
|
||||
|
||||
//! IRemoteAircraftProvider::remoteAircraft
|
||||
virtual CSimulatedAircraftList &remoteAircraft();
|
||||
virtual CSimulatedAircraftList &remoteAircraft() override;
|
||||
|
||||
//! \copydoc IRemoteAircraftProviderReadOnly::remoteAircraftParts
|
||||
virtual const BlackMisc::Aviation::CAircraftPartsList &remoteAircraftParts() const override;
|
||||
|
||||
@@ -56,12 +56,6 @@ namespace BlackMisc
|
||||
//! Register metadata of unit and quantity
|
||||
static void registerMetadata();
|
||||
|
||||
protected:
|
||||
//! Myself
|
||||
virtual const CStatusMessageList &container() const override { return *this; }
|
||||
|
||||
//! Myself
|
||||
virtual CStatusMessageList &container() override { return *this; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace BlackMisc
|
||||
|
||||
void CThreadedReader::requestStop()
|
||||
{
|
||||
setFinished();
|
||||
QWriteLocker(&this->m_lock);
|
||||
this->m_stopped = true;
|
||||
this->m_updateTimer->stop();
|
||||
}
|
||||
|
||||
@@ -47,13 +47,6 @@ namespace BlackMisc
|
||||
// cleanup code would go here
|
||||
}
|
||||
|
||||
bool CThreadedReader::isFinished() const
|
||||
{
|
||||
if (CContinuousWorker::isFinished()) { return true; }
|
||||
QReadLocker(&this->m_lock);
|
||||
return this->m_stopped;
|
||||
}
|
||||
|
||||
void CThreadedReader::setInterval(int updatePeriodMs)
|
||||
{
|
||||
Q_ASSERT(this->m_updateTimer);
|
||||
|
||||
@@ -46,9 +46,6 @@ namespace BlackMisc
|
||||
//! \copydoc CContinuousWorker::cleanup
|
||||
virtual void cleanup() override;
|
||||
|
||||
//! Thread ended of stop requested
|
||||
virtual bool isFinished() const override;
|
||||
|
||||
/*!
|
||||
* Set the update time
|
||||
* \param updatePeriodMs <=0 stops the timer
|
||||
@@ -72,7 +69,6 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
QDateTime m_updateTimestamp; //!< when was file / resource read
|
||||
bool m_stopped = false; //!< optional network reply to be stopped
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -22,6 +22,18 @@ namespace BlackMisc
|
||||
ITimestampObjectList<OBJ, CONTAINER>::ITimestampObjectList()
|
||||
{ }
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
const CONTAINER &ITimestampObjectList<OBJ, CONTAINER>::container() const
|
||||
{
|
||||
return static_cast<const CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
CONTAINER &ITimestampObjectList<OBJ, CONTAINER>::container()
|
||||
{
|
||||
return static_cast<CONTAINER &>(*this);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
CONTAINER ITimestampObjectList<OBJ, CONTAINER>::findBefore(qint64 msSinceEpoch) const
|
||||
{
|
||||
|
||||
@@ -77,10 +77,10 @@ namespace BlackMisc
|
||||
ITimestampObjectList();
|
||||
|
||||
//! Container
|
||||
virtual const CONTAINER &container() const = 0;
|
||||
const CONTAINER &container() const;
|
||||
|
||||
//! Container
|
||||
virtual CONTAINER &container() = 0;
|
||||
CONTAINER &container();
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace BlackMisc
|
||||
|
||||
auto *thread = new CRegularThread(m_owner);
|
||||
|
||||
Q_ASSERT(m_owner); // must not be null, see (9) https://dev.vatsim-germany.org/issues/402
|
||||
if (m_owner)
|
||||
{
|
||||
QString ownerName = m_owner->objectName().isEmpty() ? m_owner->metaObject()->className() : m_owner->objectName();
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace BlackMisc
|
||||
|
||||
//! Returns true if the task has finished.
|
||||
//! \threadsafe But don't rely on this condition remaining true for any length of time.
|
||||
virtual bool isFinished() const
|
||||
bool isFinished() const
|
||||
{
|
||||
QMutexLocker lock(&m_finishedMutex);
|
||||
return m_finished;
|
||||
|
||||
Reference in New Issue
Block a user