61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
#ifndef GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
|
#define GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
|
|
|
#include <cstdint>
|
|
#include <fstream>
|
|
#include <map>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include "geodata.hpp"
|
|
#include "helpers.hpp"
|
|
#include "simdata/gate.h"
|
|
#include "simdata/runway.h"
|
|
|
|
namespace germanairlinesva
|
|
{
|
|
namespace file
|
|
{
|
|
namespace simdata
|
|
{
|
|
class SimDatabase
|
|
{
|
|
private:
|
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
airports;
|
|
|
|
public:
|
|
void toFile(std::ofstream &out) const;
|
|
|
|
const Gate *checkGate(
|
|
const std::string icao,
|
|
const struct germanairlinesva::geodata::point coordinates) const;
|
|
|
|
inline std::size_t numAirports() const { return this->airports.size(); }
|
|
inline const std::pair<std::vector<Gate>, std::vector<Runway>> &
|
|
getAirport(std::string icao) const
|
|
{
|
|
return this->airports.at(icao);
|
|
}
|
|
inline void addAirport(std::string icao,
|
|
std::vector<Gate> &gates,
|
|
std::vector<Runway> &runways)
|
|
{
|
|
this->airports[icao] = std::make_pair(gates, runways);
|
|
}
|
|
template <class... Args>
|
|
inline void addGate(std::string icao, Args &&...args)
|
|
{
|
|
this->airports[icao].first.emplace_back(std::forward<Args>(args)...);
|
|
}
|
|
template <class... Args>
|
|
inline void addRunway(std::string icao, Args &&...args)
|
|
{
|
|
this->airports[icao].second.emplace_back(std::forward<Args>(args)...);
|
|
}
|
|
};
|
|
} // namespace simdata
|
|
} // namespace file
|
|
} // namespace germanairlinesva
|
|
|
|
#endif |