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

The Node class represents the concept of a node in the network. More...

#include <Node.hpp>

Inheritance diagram for dsm::Node:
dsm::RoadJunction dsm::Intersection dsm::Roundabout dsm::Station dsm::TrafficLight

Public Member Functions

 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

Id m_id
 
std::optional< std::pair< double, double > > m_coords
 
std::string m_name
 

Detailed Description

The Node class represents the concept of a node in the network.

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

Constructor & Destructor Documentation

◆ Node() [1/2]

dsm::Node::Node ( Id id)
inlineexplicit

Construct a new Node object with capacity 1.

Parameters
idThe node's id

◆ Node() [2/2]

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

Construct a new Node object with capacity 1.

Parameters
idThe node's id
coordsA std::pair containing the node's coordinates (lat, lon)

Member Function Documentation

◆ coords()

const std::optional< std::pair< double, double > > & dsm::Node::coords ( ) const
inline

Get the node's coordinates.

Returns
std::optional<std::pair<double, double>> A std::pair containing the node's coordinates

◆ id()

Id dsm::Node::id ( ) const
inline

Get the node's id.

Returns
Id The node's id

◆ isStation()

virtual bool dsm::Node::isStation ( ) const
inlinevirtualnoexcept

Reimplemented in dsm::Station.

◆ name()

const std::string & dsm::Node::name ( ) const
inline

Get the node's name.

Returns
std::string The node's name

◆ setCoords()

void dsm::Node::setCoords ( std::pair< double, double > coords)
inline

Set the node's coordinates.

Parameters
coordsA std::pair containing the node's coordinates (lat, lon)

◆ setId()

void dsm::Node::setId ( Id id)
inline

Set the node's id.

Parameters
idThe node's id

◆ setName()

void dsm::Node::setName ( const std::string & name)
inline

Set the node's name.

Parameters
nameThe node's name

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