Loading [MathJax]/extensions/tex2jax.js
Dynamical system model
All Classes Namespaces Files Functions Pages
dsm::Roundabout Class Reference

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

#include <Roundabout.hpp>

Inheritance diagram for dsm::Roundabout:
dsm::RoadJunction 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 RoadJunction &node)
 Construct a new Roundabout object.
 
void enqueue (std::unique_ptr< Agent > agentId)
 Put an agent in the node.
 
std::unique_ptr< Agentdequeue ()
 Removes the first agent from the node.
 
dsm::queue< std::unique_ptr< Agent > > const & 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::RoadJunction
 RoadJunction (Id id)
 
 RoadJunction (Id id, std::pair< double, double > coords)
 
 RoadJunction (RoadJunction const &other)
 
RoadJunctionoperator= (RoadJunction const &other)
 
virtual void setCapacity (Size capacity)
 Set the junction's capacity.
 
void setTransportCapacity (double capacity)
 Set the junction's transport capacity.
 
Size capacity () const
 Get the junction's capacity.
 
double transportCapacity () const
 Get the junction's transport capacity.
 
virtual bool isIntersection () const noexcept
 
virtual bool isTrafficLight () const noexcept
 
- 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.
 
 Node (Node const &other)
 
Nodeoperator= (Node const &other)
 
void setId (Id id)
 Set the node's id.
 
void setCoords (std::pair< double, double > coords)
 Set the node's coordinates.
 
void setName (const std::string &name)
 Set the node's name.
 
Id id () const
 Get the node's id.
 
const std::optional< std::pair< double, double > > & coords () const
 Get the node's coordinates.
 
const std::string & name () const
 Get the node's name.
 
virtual bool isStation () const noexcept
 

Protected Attributes

dsm::queue< std::unique_ptr< Agent > > m_agents
 
- Protected Attributes inherited from dsm::Node
Id m_id
 
std::optional< std::pair< double, double > > m_coords
 
std::string m_name
 

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 RoadJunction & node)

Construct a new Roundabout object.

Parameters
nodeAn Intersection object

Member Function Documentation

◆ agents()

dsm::queue< std::unique_ptr< Agent > > const & 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

Reimplemented from dsm::RoadJunction.

◆ dequeue()

std::unique_ptr< Agent > dsm::Roundabout::dequeue ( )

Removes the first agent from the node.

Returns
Id The agent's id

◆ enqueue()

void dsm::Roundabout::enqueue ( std::unique_ptr< Agent > 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

Reimplemented from dsm::RoadJunction.

◆ 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::RoadJunction.


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