|
| TrafficLight (Id id) |
| Construct a new TrafficLight object.
|
|
| TrafficLight (const NodeConcept< Id, Size > &node) |
| Construct a new TrafficLight object.
|
|
void | setDelay (Delay delay) |
| Set the node's delay.
|
|
void | setDelay (std::pair< Delay, Delay > delay) |
| Set the node's delay.
|
|
void | setPhase (Delay phase) |
| Set the node's phase.
|
|
void | increaseCounter () |
| Increase the node's counter.
|
|
void | setPhaseAfterCycle (Delay phase) |
| Set the phase of the node after the current red-green cycle has passed.
|
|
std::optional< std::pair< Delay, Delay > > | delay () const |
| Get the node's delay.
|
|
Delay | counter () const |
|
bool | isGreen () const |
| Returns true if the traffic light is green.
|
|
bool | isGreen (Id streetId) const |
|
bool | isTrafficLight () const noexcept override |
|
| Node (Id id) |
| Construct a new Node object.
|
|
| Node (Id id, std::pair< double, double > coords) |
| Construct a new Node object.
|
|
void | setCapacity (Size capacity) override |
| Set the node's capacity.
|
|
void | addAgent (double angle, Id agentId) |
| Put an agent in the node.
|
|
void | addAgent (Id agentId) |
| Put an agent in the node.
|
|
void | removeAgent (Id agentId) |
| Removes an agent from the node.
|
|
void | setStreetPriorities (std::set< Id > streetPriorities) |
| Set the node streets with priority.
|
|
void | addStreetPriority (Id streetId) |
| Add a street to the node street priorities.
|
|
bool | isFull () const override |
| Returns true if the node is full.
|
|
virtual const std::set< Id > & | streetPriorities () const |
| Get the node's street priorities.
|
|
std::multimap< int16_t, Id > | agents () const |
| Get the node's agent ids.
|
|
Size | agentCounter () |
| Returns the number of agents that have passed through the node.
|
|
virtual bool | isIntersection () const noexcept override final |
|
| NodeConcept (Id id) |
| Construct a new Node object with capacity 1.
|
|
| NodeConcept (Id id, std::pair< double, double > coords) |
| Construct a new Node object with capacity 1.
|
|
void | setId (Id id) |
| Set the node's id.
|
|
void | setCoords (std::pair< double, double > coords) |
| Set the node's coordinates.
|
|
Id | id () const |
| Get the node's id.
|
|
const std::optional< std::pair< double, double > > & | coords () const |
| Get the node's coordinates.
|
|
Size | capacity () const |
| Get the node's capacity.
|
|
virtual bool | isRoundabout () const noexcept |
|
template<typename Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && std::unsigned_integral<Delay>)
Increase the node's counter.
This function is used to increase the node's counter when the simulation is running. It automatically resets the counter when it reaches the double of the delay value.
- Exceptions
-
std::runtime_error | if the delay is not set |