forked from RoniCycode/embedded-programming-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathairplane.cpp
More file actions
39 lines (36 loc) · 1.49 KB
/
airplane.cpp
File metadata and controls
39 lines (36 loc) · 1.49 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "myLibrary.h"
#include "airplane.h"
void printAirplaneFlights(vector<Node *> &arr, const string &airplane) {
if (arr.empty()) {
cout << "There is no info about aircraft " << airplane << " in db." << endl;
}
else
{
int size = (int) arr.size();
cout << airplane << ":" << endl;
for (int i = 0; i < size; i++)
cout << arr[i]->getIcao24() << " departed from " << arr[i]->getEstDepartureAirport() <<
" at " << convertEpochToReadable(arr[i]->getFirstSeen()) << " arrived in "
<< arr[i]->getEstArrivalAirport() <<
" at " << convertEpochToReadable(arr[i]->getLastSeen()) << endl;
}
}
void printAirplaneArrivalFlights(vector<Node *> &arr, const string &airport) {
if (arr.empty()) {
cout << "There is no info about airport " << airport << " in db." << endl;
}
else
{
int size = (int) arr.size();
cout << airport << ":" << endl;
for (int i = 0; i < size; i++) {
cout << "FLight #" << arr[i]->getCallSign() << " Arriving from " << arr[i]->getEstDepartureAirport()
<< ", tookoff at " << convertEpochToReadable(arr[i]->getFirstSeen()) << " landed at " << convertEpochToReadable(arr[i]->getLastSeen()) << endl;
}
}
}
vector<Node *> airplaneFlights(const string &icao_name, vector<Node *> &arr) {
vector<Node *> flightsByAircraft = get_flights_by_aircraft(icao_name, arr);
return flightsByAircraft;
}