-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimulationManager.h
52 lines (46 loc) · 1.38 KB
/
SimulationManager.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
#pragma once
#include "Aircraft.h"
#include "Runway.h"
#include "Queue.h"
#include "Statistics.h"
#include <vector>
#include <thread>
#include "Logger.h"
#include "Timer.h"
class UserInterface;
class SimulationManager
{
public:
SimulationManager();
~SimulationManager();
const std::vector<Runway> &getRunways() const;
size_t getLandingQueueSize() const;
size_t getTakeOffQueueSize() const;
void displayStatistics() const;
void runSimulation(int simulationTime);
void displaySimulationStats() const;
void logRunwayStatus(const std::string &runwayStatus);
void logEvent(const std::string& event, bool enableLogging);
private:
Logger logger;
std::vector<std::thread> threads;
UserInterface *userInterface;
std::vector<Runway> runways;
std::string runwayStatusToString(RunwayStatus status);
Queue landingQueue;
Queue takeOffQueue;
Statistics statistics;
Timer timer;
void generateAircraft();
void displayInitialInfo();
void processAircraft();
void updateRunwayStatus();
void updateStatistics();
void handleLanding();
void handleTakeOff();
void displayRunwayStatus(const std::string &runwayCode, const std::string &status);
void waitThreadsCompletion();
Runway &assignRunwayForLanding();
Runway &assignRunwayForTakeOff();
void generateTakeoffAircraft(const Aircraft& landingAircraft);
};