@@ -51,7 +51,7 @@ namespace dsm {
5151
5252 class TrafficLight : public Intersection {
5353 private:
54- std::unordered_map<Id, std::vector <TrafficLightCycle>> m_cycles;
54+ std::unordered_map<Id, std::array <TrafficLightCycle, 3 >> m_cycles;
5555 Delay m_cycleTime; // The total time of a red-green cycle
5656 Delay m_counter;
5757
@@ -104,8 +104,9 @@ namespace dsm {
104104 // / @param cycle The traffic light cycle
105105 void setCycle (Id const streetId, Direction direction, TrafficLightCycle const & cycle);
106106 // / @brief Set the traffic light's cycles
107- // / @param cycles std::unordered_map<Id, std::vector<TrafficLightCycle>> The traffic light's cycles
108- inline void setCycles (std::unordered_map<Id, std::vector<TrafficLightCycle>> cycles) {
107+ // / @param cycles std::unordered_map<Id, std::array<TrafficLightCycle, 3>> The traffic light's cycles
108+ inline void setCycles (
109+ std::unordered_map<Id, std::array<TrafficLightCycle, 3 >> cycles) {
109110 m_cycles = std::move (cycles);
110111 }
111112 // / @brief Set the complementary cycle for a street
@@ -128,8 +129,8 @@ namespace dsm {
128129 // / @param delta Delay, the time to increase or decrease the green times
129130 void decreaseGreenTimes (Delay const delta);
130131 // / @brief Get the traffic light's cycles
131- // / @return std::unordered_map<Id, std::vector <TrafficLightCycle>> const & The traffic light's cycles
132- inline std::unordered_map<Id, std::vector <TrafficLightCycle>> const & cycles () const {
132+ // / @return std::unordered_map<Id, std::array <TrafficLightCycle, 3>> & The traffic light's cycles
133+ inline std::unordered_map<Id, std::array <TrafficLightCycle, 3 >> const & cycles () const {
133134 return m_cycles;
134135 }
135136 // / @brief Returns true if all the cycles are set to their default values
0 commit comments