-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.h
39 lines (27 loc) · 937 Bytes
/
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
#pragma once
#include <memory>
#include <vector>
#include <map>
class TrafficLightGroup;
class Sequence;
class Controller
{
public:
Controller();
void addTrafficLightGroup(std::shared_ptr<TrafficLightGroup> group, unsigned int id);
void addSequence(std::shared_ptr<Sequence> sequence, unsigned int targetGroupId);
void clearSequences();
void run();
private:
size_t _index = 0;
std::map<unsigned int, std::shared_ptr<TrafficLightGroup>> _groups;
std::vector<std::tuple<std::shared_ptr<Sequence>, unsigned int>> _sequences;
void reset();
bool next();
unsigned int getCurrentGroupId() const;
size_t count() const;
std::tuple<std::shared_ptr<Sequence>, unsigned int> getCurrent() const;
std::shared_ptr<Sequence> getCurrentSequence() const;
std::shared_ptr<TrafficLightGroup> getGroup(size_t id) const;
std::shared_ptr<TrafficLightGroup> getCurrentGroup() const;
};