FlightGear next
performancedb.hxx
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <map>
5#include <vector>
6
8class SGPath;
9
10#include <simgear/structure/subsystem_mgr.hxx>
11
20// TODO: provide std::map interface?
21class PerformanceDB : public SGSubsystem
22{
23public:
24 PerformanceDB() = default;
25 virtual ~PerformanceDB() = default;
26
27 // Subsystem API.
28 void init() override;
29 void shutdown() override;
30 void update(double dt) override;
31
32 // Subsystem identification.
33 static const char* staticSubsystemClassId() { return "aircraft-performance-db"; }
34
35 bool havePerformanceDataForAircraftType(const std::string& acType) const;
36
41 PerformanceData* getDataFor(const std::string& acType, const std::string& acClass) const;
42
44
45private:
46 void load(const SGPath& path);
47
48 void registerPerformanceData(const std::string& id, PerformanceData* data);
49
50 typedef std::map<std::string, PerformanceData*> PerformanceDataDict;
51 PerformanceDataDict _db;
52
53 const std::string& findAlias(const std::string& acType) const;
54
55 typedef std::pair<std::string, std::string> StringPair;
59 std::vector<StringPair> _aliases;
60};
static const char * staticSubsystemClassId()
virtual ~PerformanceDB()=default
bool havePerformanceDataForAircraftType(const std::string &acType) const
PerformanceData * getDefaultPerformance() const
PerformanceDB()=default
void init() override
void update(double dt) override
PerformanceData * getDataFor(const std::string &acType, const std::string &acClass) const
get performance data for an aircraft type / class.
void shutdown() override
Data storage for aircraft performance data.