1 #ifndef PERFORMANCEDB_HXX
2 #define PERFORMANCEDB_HXX
11 #include <simgear/structure/subsystem_mgr.hxx>
14 * Registry for performance data.
16 * Allows to store performance data for later reuse/retrieval. Just
17 * a simple map for now.
19 * @author Thomas F�rster <t.foerster@biologie.hu-berlin.de>
21 //TODO provide std::map interface?
22 class PerformanceDB : public SGSubsystem
26 virtual ~PerformanceDB();
29 virtual void shutdown();
31 virtual void update(double dt);
33 bool havePerformanceDataForAircraftType(const std::string& acType) const;
36 * get performance data for an aircraft type / class. Type is specific, eg
37 * '738' or 'A319'. Class is more generic, such as 'jet_transport'.
39 PerformanceData* getDataFor(const std::string& acType, const std::string& acClass) const;
41 PerformanceData* getDefaultPerformance() const;
43 static const char* subsystemName() { return "aircraft-performance-db"; }
45 void load(const SGPath& path);
47 void registerPerformanceData(const std::string& id, PerformanceData* data);
50 typedef std::map<std::string, PerformanceData*> PerformanceDataDict;
51 PerformanceDataDict _db;
53 const std::string& findAlias(const std::string& acType) const;
55 typedef std::pair<std::string, std::string> StringPair;
56 /// alias list, to allow type/class names to share data. This is used to merge
57 /// related types together. Note it's ordered, and not a map since we permit
58 /// partial matches when merging - the first matching alias is used.
59 std::vector<StringPair> _aliases;