-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlightDB.cpp
26 lines (21 loc) · 890 Bytes
/
FlightDB.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//
// Created by Jonathan Zhu on 2023-06-11.
//
#include "FlightDB.h"
FlightDB::FlightDB() {
Database db{};
}
unordered_map<string, Flight>& FlightDB::getFlights() {return flights;}
unordered_map<string, Passenger>& FlightDB::getPassengers() {return passengers;}
unordered_map<string, Attendent>& FlightDB::getAttendents() {return attendents;}
unordered_map<string, Airport>& FlightDB::getAirports() {return airports;}
void FlightDB::addFlight(Flight flight) {flights[flight.getFlightID()] = flight;}
void FlightDB::addPassenger(Passenger passenger) {
passengers[passenger.getPassengerID()] = passenger;
}
void FlightDB::addAttendent(Attendent attendent) {
attendents[attendent.getAttendentID()] = attendent;
}
void FlightDB::addAirport(Airport airport) {airports[airport.getCode()] = airport;}
void FlightDB::reset() {db.load(this);}
void FlightDB::save() {db.save(this);}