Dynamical system model
Loading...
Searching...
No Matches
dsm::Roundabout Class Reference

The Roundabout class represents a roundabout node in the network. More...

#include <Node.hpp>

Inheritance diagram for dsm::Roundabout:
dsm::Node

Public Member Functions

 Roundabout (Id id)
 Construct a new Roundabout object.
 
 Roundabout (Id id, std::pair< double, double > coords)
 Construct a new Roundabout object.
 
 Roundabout (const Node &node)
 Construct a new Roundabout object.
 
void enqueue (Id agentId)
 Put an agent in the node.
 
Id dequeue ()
 Removes the first agent from the node.
 
const dsm::queue< Id > & agents () const
 Get the node's queue.
 
double density () const override
 Returns the node's density.
 
bool isFull () const override
 Returns true if the node is full.
 
bool isRoundabout () const noexcept override
 Returns true if the node is a roundabout.
 
- Public Member Functions inherited from dsm::Node
 Node (Id id)
 Construct a new Node object with capacity 1.
 
 Node (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.
 
virtual void setCapacity (Size capacity)
 Set the node's capacity.
 
virtual void setTransportCapacity (Size capacity)
 Set the node's transport capacity.
 
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.
 
Size transportCapacity () const
 Get the node's transport capacity.
 
virtual bool isIntersection () const noexcept
 
virtual bool isTrafficLight () const noexcept
 

Protected Attributes

dsm::queue< Id > m_agents
 
- Protected Attributes inherited from dsm::Node
Id m_id
 
std::optional< std::pair< double, double > > m_coords
 
Size m_capacity
 
Size m_transportCapacity
 

Detailed Description

The Roundabout class represents a roundabout node in the network.

Template Parameters
IdThe type of the node's id
SizeThe type of the node's capacity

Constructor & Destructor Documentation

◆ Roundabout() [1/3]

dsm::Roundabout::Roundabout ( Id id)
inlineexplicit

Construct a new Roundabout object.

Parameters
idThe node's id

◆ Roundabout() [2/3]

dsm::Roundabout::Roundabout ( Id id,
std::pair< double, double > coords )
inline

Construct a new Roundabout object.

Parameters
idThe node's id
coordsA std::pair containing the node's coordinates

◆ Roundabout() [3/3]

dsm::Roundabout::Roundabout ( const Node & node)

Construct a new Roundabout object.

Parameters
nodeAn Intersection object

Member Function Documentation

◆ agents()

const dsm::queue< Id > & dsm::Roundabout::agents ( ) const
inline

Get the node's queue.

Returns
dsm::queue<Id> The node's queue

◆ density()

double dsm::Roundabout::density ( ) const
inlineoverridevirtual

Returns the node's density.

Returns
double The node's density

Implements dsm::Node.

◆ dequeue()

Id dsm::Roundabout::dequeue ( )

Removes the first agent from the node.

Returns
Id The agent's id

◆ enqueue()

void dsm::Roundabout::enqueue ( Id agentId)

Put an agent in the node.

Parameters
agentIdThe agent's id
Exceptions
std::runtime_errorif the node is full

◆ isFull()

bool dsm::Roundabout::isFull ( ) const
inlineoverridevirtual

Returns true if the node is full.

Returns
bool True if the node is full

Implements dsm::Node.

◆ isRoundabout()

bool dsm::Roundabout::isRoundabout ( ) const
inlineoverridevirtualnoexcept

Returns true if the node is a roundabout.

Returns
bool True if the node is a roundabout

Reimplemented from dsm::Node.


The documentation for this class was generated from the following files: