mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Change MetarSet to MetarList
CMetarSet was implemented as a collection. This only makes sense for values which have one member variable only or hardly ever change. METARs often change and therefore a collection didn't make much sense. Additional profiling showed that a sequence has better algorithmic performance. refs #689
This commit is contained in:
@@ -439,7 +439,7 @@ namespace BlackCore
|
|||||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance, maxRenderedBoundary);
|
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance, maxRenderedBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextNetwork::ps_updateMetars(const BlackMisc::Weather::CMetarSet &metars)
|
void CContextNetwork::ps_updateMetars(const BlackMisc::Weather::CMetarList &metars)
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
CLogMessage(this).info("%1 METARs updated") << metars.size();
|
CLogMessage(this).info("%1 METARs updated") << metars.size();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/weather/metar.h"
|
#include "blackmisc/weather/metar.h"
|
||||||
#include "blackmisc/weather/metarset.h"
|
#include "blackmisc/weather/metarlist.h"
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Update METAR collection
|
//! Update METAR collection
|
||||||
void ps_updateMetars(const BlackMisc::Weather::CMetarSet &metars);
|
void ps_updateMetars(const BlackMisc::Weather::CMetarList &metars);
|
||||||
|
|
||||||
//! Check if a supervisor message was received
|
//! Check if a supervisor message was received
|
||||||
void ps_checkForSupervisiorTextMessage(const BlackMisc::Network::CTextMessageList &messages);
|
void ps_checkForSupervisiorTextMessage(const BlackMisc::Network::CTextMessageList &messages);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace BlackCore
|
|||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetarSet CVatsimMetarReader::getMetars() const
|
CMetarList CVatsimMetarReader::getMetars() const
|
||||||
{
|
{
|
||||||
QReadLocker l(&m_lock);
|
QReadLocker l(&m_lock);
|
||||||
return m_metars;
|
return m_metars;
|
||||||
@@ -119,9 +119,9 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetarSet metars;
|
|
||||||
QString invalidMetars;
|
QString invalidMetars;
|
||||||
int invalidLineCount = 0;
|
int invalidLineCount = 0;
|
||||||
|
CMetarList metars;
|
||||||
QTextStream lineReader(&metarData);
|
QTextStream lineReader(&metarData);
|
||||||
while (!lineReader.atEnd())
|
while (!lineReader.atEnd())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include "blackcore/threadedreader.h"
|
#include "blackcore/threadedreader.h"
|
||||||
#include "blackmisc/weather/metar.h"
|
#include "blackmisc/weather/metar.h"
|
||||||
#include "blackmisc/weather/metardecoder.h"
|
#include "blackmisc/weather/metardecoder.h"
|
||||||
#include "blackmisc/weather/metarset.h"
|
#include "blackmisc/weather/metarlist.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Get METARs
|
//! Get METARs
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual BlackMisc::Weather::CMetarSet getMetars() const;
|
virtual BlackMisc::Weather::CMetarList getMetars() const;
|
||||||
|
|
||||||
//! Get METAR for airport
|
//! Get METAR for airport
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -53,8 +53,8 @@ namespace BlackCore
|
|||||||
virtual int getMetarsCount() const;
|
virtual int getMetarsCount() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! METARs have been read and converted to BlackMisc::Weather::CMetarSet
|
//! METARs have been read and converted to BlackMisc::Weather::CMetarList
|
||||||
void metarsRead(const BlackMisc::Weather::CMetarSet &metars);
|
void metarsRead(const BlackMisc::Weather::CMetarList &metars);
|
||||||
|
|
||||||
//! Data have been read
|
//! Data have been read
|
||||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
@@ -76,7 +76,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BlackMisc::Weather::CMetarDecoder m_metarDecoder;
|
BlackMisc::Weather::CMetarDecoder m_metarDecoder;
|
||||||
BlackMisc::Weather::CMetarSet m_metars;
|
BlackMisc::Weather::CMetarList m_metars;
|
||||||
BlackMisc::CSettingReadOnly<BlackCore::Settings::SettingsVatsimMetars> m_settings { this };
|
BlackMisc::CSettingReadOnly<BlackCore::Settings::SettingsVatsimMetars> m_settings { this };
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -381,10 +381,10 @@ namespace BlackCore
|
|||||||
return CCountry();
|
return CCountry();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetarSet CWebDataServices::getMetars() const
|
CMetarList CWebDataServices::getMetars() const
|
||||||
{
|
{
|
||||||
if (m_vatsimMetarReader) { return m_vatsimMetarReader->getMetars(); }
|
if (m_vatsimMetarReader) { return m_vatsimMetarReader->getMetars(); }
|
||||||
return CMetarSet();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
CMetar CWebDataServices::getMetarForAirport(const CAirportIcaoCode &icao) const
|
CMetar CWebDataServices::getMetarForAirport(const CAirportIcaoCode &icao) const
|
||||||
@@ -541,7 +541,7 @@ namespace BlackCore
|
|||||||
CLogMessage(this).info("Read %1 ATC bookings from network") << stations.size();
|
CLogMessage(this).info("Read %1 ATC bookings from network") << stations.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWebDataServices::ps_receivedMetars(const CMetarSet &metars)
|
void CWebDataServices::ps_receivedMetars(const CMetarList &metars)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Read %1 METARs") << metars.size();
|
CLogMessage(this).info("Read %1 METARs") << metars.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "blackmisc/simulation/distributorlist.h"
|
#include "blackmisc/simulation/distributorlist.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/weather/metar.h"
|
#include "blackmisc/weather/metar.h"
|
||||||
#include "blackmisc/weather/metarset.h"
|
#include "blackmisc/weather/metarlist.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -264,7 +264,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Get METARs
|
//! Get METARs
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Weather::CMetarSet getMetars() const;
|
BlackMisc::Weather::CMetarList getMetars() const;
|
||||||
|
|
||||||
//! Get METAR for airport
|
//! Get METAR for airport
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -302,7 +302,7 @@ namespace BlackCore
|
|||||||
void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
void ps_receivedBookings(const BlackMisc::Aviation::CAtcStationList &bookedStations);
|
||||||
|
|
||||||
//! Received METAR data
|
//! Received METAR data
|
||||||
void ps_receivedMetars(const BlackMisc::Weather::CMetarSet &metars);
|
void ps_receivedMetars(const BlackMisc::Weather::CMetarList &metars);
|
||||||
|
|
||||||
//! Data file has been read
|
//! Data file has been read
|
||||||
void ps_dataFileRead(int lines);
|
void ps_dataFileRead(int lines);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackmisc/weather/metarset.h"
|
#include "blackmisc/weather/metarlist.h"
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
@@ -15,11 +15,11 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Weather
|
namespace Weather
|
||||||
{
|
{
|
||||||
CMetarSet::CMetarSet(const CCollection<CMetar> &other) :
|
CMetarList::CMetarList(const CSequence<CMetar> &other) :
|
||||||
CCollection<CMetar>(other)
|
CSequence<CMetar>(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
CMetar CMetarSet::getMetarForAirport(const Aviation::CAirportIcaoCode &icao) const
|
CMetar CMetarList::getMetarForAirport(const Aviation::CAirportIcaoCode &icao) const
|
||||||
{
|
{
|
||||||
return this->findFirstByOrDefault(&CMetar::getAirportIcaoCode, icao);
|
return this->findFirstByOrDefault(&CMetar::getAirportIcaoCode, icao);
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKMISC_WEATHER_METARSET_H
|
#ifndef BLACKMISC_WEATHER_METARLIST_H
|
||||||
#define BLACKMISC_WEATHER_METARSET_H
|
#define BLACKMISC_WEATHER_METARLIST_H
|
||||||
|
|
||||||
#include "blackmisc/aviation/airporticaocode.h"
|
#include "blackmisc/aviation/airporticaocode.h"
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
@@ -28,19 +28,19 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Weather
|
namespace Weather
|
||||||
{
|
{
|
||||||
//! Collection of Metars
|
//! Sequence of Metars
|
||||||
class BLACKMISC_EXPORT CMetarSet :
|
class BLACKMISC_EXPORT CMetarList :
|
||||||
public CCollection<CMetar>,
|
public CSequence<CMetar>,
|
||||||
public BlackMisc::Mixin::MetaType<CMetarSet>
|
public BlackMisc::Mixin::MetaType<CMetarList>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CMetarSet)
|
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CMetarList)
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CMetarSet() = default;
|
CMetarList() = default;
|
||||||
|
|
||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CMetarSet(const CCollection<CMetar> &other);
|
CMetarList(const CSequence<CMetar> &other);
|
||||||
|
|
||||||
//! METAR for ICAO code
|
//! METAR for ICAO code
|
||||||
CMetar getMetarForAirport(const Aviation::CAirportIcaoCode &icao) const;
|
CMetar getMetarForAirport(const Aviation::CAirportIcaoCode &icao) const;
|
||||||
@@ -49,7 +49,7 @@ namespace BlackMisc
|
|||||||
} //namespace
|
} //namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Weather::CMetarSet)
|
Q_DECLARE_METATYPE(BlackMisc::Weather::CMetarList)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Weather::CMetar>)
|
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Weather::CMetar>)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Weather::CMetar>)
|
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Weather::CMetar>)
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace BlackMisc
|
|||||||
CCloudLayerList::registerMetadata();
|
CCloudLayerList::registerMetadata();
|
||||||
CGridPoint::registerMetadata();
|
CGridPoint::registerMetadata();
|
||||||
CMetar::registerMetadata();
|
CMetar::registerMetadata();
|
||||||
CMetarSet::registerMetadata();
|
CMetarList::registerMetadata();
|
||||||
CPresentWeather::registerMetadata();
|
CPresentWeather::registerMetadata();
|
||||||
CPresentWeatherList::registerMetadata();
|
CPresentWeatherList::registerMetadata();
|
||||||
CTemperatureLayer::registerMetadata();
|
CTemperatureLayer::registerMetadata();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "blackmisc/weather/cloudlayerlist.h"
|
#include "blackmisc/weather/cloudlayerlist.h"
|
||||||
#include "blackmisc/weather/gridpoint.h"
|
#include "blackmisc/weather/gridpoint.h"
|
||||||
#include "blackmisc/weather/metar.h"
|
#include "blackmisc/weather/metar.h"
|
||||||
#include "blackmisc/weather/metarset.h"
|
#include "blackmisc/weather/metarlist.h"
|
||||||
#include "blackmisc/weather/presentweather.h"
|
#include "blackmisc/weather/presentweather.h"
|
||||||
#include "blackmisc/weather/presentweatherlist.h"
|
#include "blackmisc/weather/presentweatherlist.h"
|
||||||
#include "blackmisc/weather/temperaturelayer.h"
|
#include "blackmisc/weather/temperaturelayer.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user