#ifndef GERMANAIRLINESVA_FILE_SIMDATABASE_H #define GERMANAIRLINESVA_FILE_SIMDATABASE_H #include #include #include #include #include #include #include #include #include #include #include "config/config.h" #include "constants.h" #include "simdata/gate.h" #include "simdata/runway.h" #include "simdata/simdataXP.h" /* * Header * * CHAR[5] | UINT8 * --------+-------- * VGAS | VERSION */ /* * Airport * * UINT8 | CHAR[] | UINT16 | GATE[] | UINT8 | RUNWAY[] * --------+--------+----------+--------+---------+--------- * STRLEN | ICAO | NUMGATES | GATES | NUMRWYS | RUNWAYS */ namespace germanairlinesva { namespace file { namespace simdata { class SimDatabase { private: std::map< std::string, std::pair, std::vector>> airports; void fromFile(); void readVersion1(std::ifstream &in); public: SimDatabase(int xPlaneVersion, const char *hash, std::unique_ptr &configuration, std::function toLog); void toFile() const; inline std::size_t getCount() const { return this->airports.size(); } inline const std::pair, const std::vector> operator[](std::string key) { try { return this->airports.at(key); } catch (std::out_of_range &ex) { return std::pair, const std::vector>(); } } }; } // namespace simdata } // namespace file } // namespace germanairlinesva #endif