From 194b2fd9ba3851eb7df87b18f3836fbf9a5a1ea1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 5 Jan 2017 02:29:33 +0100 Subject: [PATCH] refs #849, network context * formatting * made some functions protected instead public --- src/blackcore/context/contextnetworkempty.h | 3 +-- src/blackcore/context/contextnetworkimpl.cpp | 28 ++++++++++---------- src/blackcore/context/contextnetworkimpl.h | 11 +++++--- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/blackcore/context/contextnetworkempty.h b/src/blackcore/context/contextnetworkempty.h index b3cb62255..18282d66b 100644 --- a/src/blackcore/context/contextnetworkempty.h +++ b/src/blackcore/context/contextnetworkempty.h @@ -29,8 +29,7 @@ namespace BlackCore //! Constructor CContextNetworkEmpty(CCoreFacade *runtime) : IContextNetwork(CCoreFacadeConfig::NotUsed, runtime) {} - public slots: // IContextNetwork overrides - + public slots: //! \copydoc IContextNetwork::requestAtcBookingsUpdate() virtual void requestAtcBookingsUpdate() const override { diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index a88ace37b..98ad3e6e7 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -497,31 +497,31 @@ namespace BlackCore CSimulatedAircraft CContextNetwork::getAircraftInRangeForCallsign(const CCallsign &callsign) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->getAircraftInRangeForCallsign(callsign); } CAircraftModel CContextNetwork::getAircraftInRangeModelForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->getAircraftInRangeModelForCallsign(callsign); } CStatusMessageList CContextNetwork::getReverseLookupMessages(const CCallsign &callsign) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->getReverseLookupMessages(callsign); } bool CContextNetwork::isReverseLookupMessagesEnabled() const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } return this->m_airspace->isReverseLookupMessagesEnabled(); } void CContextNetwork::enableReverseLookupMessages(bool enabled) { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } if (this->m_airspace->isReverseLookupMessagesEnabled() == enabled) { return; } this->m_airspace->enableReverseLookupMessages(enabled); emit CContext::changedLogOrDebugSettings(); @@ -529,32 +529,32 @@ namespace BlackCore CStatusMessageList CContextNetwork::getAircraftPartsHistory(const CCallsign &callsign) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->getAircraftPartsHistory(callsign); } CAircraftPartsList CContextNetwork::getRemoteAircraftParts(const CCallsign &callsign, qint64 cutoffTimeValuesBefore) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore); } bool CContextNetwork::isAircraftPartsHistoryEnabled() const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } return this->m_airspace->isAircraftPartsHistoryEnabled(); } void CContextNetwork::enableAircraftPartsHistory(bool enabled) { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; } this->m_airspace->enableAircraftPartsHistory(enabled); emit CContext::changedLogOrDebugSettings(); } CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const { - if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return this->m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign); } @@ -606,7 +606,7 @@ namespace BlackCore bool CContextNetwork::updateAircraftNetworkModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator) { if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; } - bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator); + const bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator); if (c) { const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign)); @@ -711,11 +711,11 @@ namespace BlackCore CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const { if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } - CAtcStationList stations = this->getSelectedAtcStations(); + const CAtcStationList stations = this->getSelectedAtcStations(); Q_ASSERT(stations.size() == 2); CVoiceRoomList rooms; - CAtcStation s1 = stations[0]; - CAtcStation s2 = stations[1]; + const CAtcStation s1 = stations[0]; + const CAtcStation s2 = stations[1]; rooms.push_back(s1.getVoiceRoom()); rooms.push_back(s2.getVoiceRoom()); return rooms; diff --git a/src/blackcore/context/contextnetworkimpl.h b/src/blackcore/context/contextnetworkimpl.h index 0b2516620..d92edac66 100644 --- a/src/blackcore/context/contextnetworkimpl.h +++ b/src/blackcore/context/contextnetworkimpl.h @@ -104,9 +104,6 @@ namespace BlackCore virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override; //! @} - //! Network library - INetwork *network() const { return m_network; } - public slots: // from context and provider interface //! \ingroup remoteaircraftprovider @@ -187,6 +184,14 @@ namespace BlackCore //! Register myself in DBus CContextNetwork *registerWithDBus(BlackMisc::CDBusServer *server); + //! Network library + //! \remarks normally only for core facade internal usage + INetwork *network() const { return m_network; } + + //! Airspace + //! \remarks normally only for core facade internal usage + CAirspaceMonitor *airspace() const { return m_airspace; } + private: CAirspaceMonitor *m_airspace = nullptr; INetwork *m_network = nullptr;