-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Expand file tree
/
Copy pathTrafficSystem.hpp
More file actions
34 lines (28 loc) · 1.03 KB
/
TrafficSystem.hpp
File metadata and controls
34 lines (28 loc) · 1.03 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
#ifndef TRAFFIC_SYSTEM_HPP
#define TRAFFIC_SYSTEM_HPP
#include <vector>
#include <string>
#include "Intersection.hpp"
class TrafficSystem {
private:
std::vector<Intersection*> intersections;
int intersectionIdCounter;
int signalIdCounter;
public:
TrafficSystem();
~TrafficSystem();
Intersection* createIntersection();
void removeIntersection(const std::string& intersectionId);
Signal* addSignal(const std::string& intersectionId,
int greenDuration = 30, int yellowDuration = 5, int redDuration = 30);
void removeSignal(const std::string& intersectionId, const std::string& signalId);
void updateSystem(int timeElapsed);
void setIntersectionStatus(const std::string& intersectionId, bool operational);
void synchronizeIntersection(const std::string& intersectionId);
void displaySystemStatus() const;
private:
Intersection* findIntersection(const std::string& intersectionId) const;
std::string generateIntersectionId();
std::string generateSignalId();
};
#endif