-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.h
87 lines (65 loc) · 1.95 KB
/
Controller.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/****************************************************************
FILE: Controller.h
AUTHOR: Tommy Deng
s199762338
PURPOSE: Header file for the controller (airline) object.
Controls/handles the interaction of most objects
and other program functionalities.
****************************************************************/
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <iostream>
#include <fstream>
#include <sstream>
#include "Message.h"
#include "Plane.h"
#include "FileInfo.h"
#include "Input.h"
using namespace std;
class Controller
{
protected:
vector<Plane*> *plane = new vector<Plane*>;
Message message;
FileInfo file;
Input input;
int numPlanes;
bool run;
public:
// Default constructor
Controller();
// Destructor
~Controller();
// Accessor functions
bool getRun();
// Mutator functions
void setRun(bool run);
// load all initial/current data from file and assigns it to
// the corresponding objects
void retrieveData();
// output display to console
void display();
// nested/isolated functions (individual 'steps')
void OptionTree(string input);
void bookReservation();
void cancelReservation();
void displayPassengerInfo();
void displaySchedule();
void displayDestinations();
void displayReservations();
void searchPassengerInfo();
void cancelEntireFlight();
void exitProgram();
void outputManifest(vector<Passenger> pCopy);
// initialize passenger copy (for displaying manifest)
void initPassengerAll(vector<Passenger>& pCopy, const vector<Plane*> *plane);
void initPassengerOne(vector<Passenger>& pCopy, const vector<Plane*>* plane, int flightId);
// used when displaying passenger info.
// returns the number of tabs needed for proper formatting when displaying passenger info
int spacing(int size);
// linear search of copied passenger object
// TODO: binary search
// returns vector of position(s) of search
vector<int> linearSearch(vector<Passenger> pCopy, string search);
};
#endif // !CONTROLLER_H