-
Notifications
You must be signed in to change notification settings - Fork 0
/
trafficlight_group.cpp
50 lines (42 loc) · 1.15 KB
/
trafficlight_group.cpp
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
#include "trafficlight_group.h"
TrafficLightGroup::TrafficLightGroup()
{
}
TrafficLightGroup::TrafficLightGroup(std::vector<std::shared_ptr<TrafficLight>> trafficLights)
{
for (auto trafficLight : trafficLights) {
addTrafficLight(trafficLight);
}
}
void TrafficLightGroup::addTrafficLight(std::shared_ptr<TrafficLight> trafficLight)
{
_trafficLights.push_back(trafficLight);
}
void TrafficLightGroup::turnAllLightsOff()
{
for (auto trafficLight : _trafficLights) {
trafficLight->turnAllLightsOff();
}
}
void TrafficLightGroup::turnLightsOn(TrafficLight::Light lights)
{
for (auto trafficLight : _trafficLights) {
trafficLight->turnLightsOn(lights);
}
}
void TrafficLightGroup::turnLightsOff(TrafficLight::Light lights)
{
for (auto trafficLight : _trafficLights) {
trafficLight->turnLightsOff(lights);
}
}
void TrafficLightGroup::setLightsState(TrafficLight::Light lights, bool on)
{
for (auto trafficLight : _trafficLights) {
trafficLight->setLightsState(lights, on);
}
}
std::vector<std::shared_ptr<TrafficLight>> TrafficLightGroup::getTrafficLights() const
{
return _trafficLights;
}