mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +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:
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/weather/metarset.h"
|
||||
#include "blackmisc/weather/metarlist.h"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
@@ -15,11 +15,11 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Weather
|
||||
{
|
||||
CMetarSet::CMetarSet(const CCollection<CMetar> &other) :
|
||||
CCollection<CMetar>(other)
|
||||
CMetarList::CMetarList(const CSequence<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);
|
||||
}
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_WEATHER_METARSET_H
|
||||
#define BLACKMISC_WEATHER_METARSET_H
|
||||
#ifndef BLACKMISC_WEATHER_METARLIST_H
|
||||
#define BLACKMISC_WEATHER_METARLIST_H
|
||||
|
||||
#include "blackmisc/aviation/airporticaocode.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
@@ -28,19 +28,19 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Weather
|
||||
{
|
||||
//! Collection of Metars
|
||||
class BLACKMISC_EXPORT CMetarSet :
|
||||
public CCollection<CMetar>,
|
||||
public BlackMisc::Mixin::MetaType<CMetarSet>
|
||||
//! Sequence of Metars
|
||||
class BLACKMISC_EXPORT CMetarList :
|
||||
public CSequence<CMetar>,
|
||||
public BlackMisc::Mixin::MetaType<CMetarList>
|
||||
{
|
||||
public:
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CMetarSet)
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CMetarList)
|
||||
|
||||
//! Default constructor.
|
||||
CMetarSet() = default;
|
||||
CMetarList() = default;
|
||||
|
||||
//! Construct from a base class object.
|
||||
CMetarSet(const CCollection<CMetar> &other);
|
||||
CMetarList(const CSequence<CMetar> &other);
|
||||
|
||||
//! METAR for ICAO code
|
||||
CMetar getMetarForAirport(const Aviation::CAirportIcaoCode &icao) const;
|
||||
@@ -49,7 +49,7 @@ namespace BlackMisc
|
||||
} //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::CSequence<BlackMisc::Weather::CMetar>)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BlackMisc
|
||||
CCloudLayerList::registerMetadata();
|
||||
CGridPoint::registerMetadata();
|
||||
CMetar::registerMetadata();
|
||||
CMetarSet::registerMetadata();
|
||||
CMetarList::registerMetadata();
|
||||
CPresentWeather::registerMetadata();
|
||||
CPresentWeatherList::registerMetadata();
|
||||
CTemperatureLayer::registerMetadata();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "blackmisc/weather/cloudlayerlist.h"
|
||||
#include "blackmisc/weather/gridpoint.h"
|
||||
#include "blackmisc/weather/metar.h"
|
||||
#include "blackmisc/weather/metarset.h"
|
||||
#include "blackmisc/weather/metarlist.h"
|
||||
#include "blackmisc/weather/presentweather.h"
|
||||
#include "blackmisc/weather/presentweatherlist.h"
|
||||
#include "blackmisc/weather/temperaturelayer.h"
|
||||
|
||||
Reference in New Issue
Block a user