Dynamical system model
Loading...
Searching...
No Matches
dsf::Node Class Reference

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

#include <Node.hpp>

Inheritance diagram for dsf::Node:
dsf::mobility::RoadJunction dsf::mobility::Intersection dsf::mobility::Roundabout dsf::mobility::Station dsf::mobility::TrafficLight

Public Member Functions

 Node (Id id)
 Construct a new Node object with capacity 1.
 Node (Id id, geometry::Point point)
 Construct a new Node object with capacity 1.
 Node (Node const &other)
Nodeoperator= (Node const &other)
void setId (Id id) noexcept
 Set the node's id.
void setGeometry (geometry::Point point) noexcept
 Set the node's geometry.
void setName (const std::string &name) noexcept
 Set the node's name.
void addIngoingEdge (Id edgeId)
 Add an ingoing edge to the node.
void addOutgoingEdge (Id edgeId)
 Add an outgoing edge to the node.
void setAttribute (std::string const &name, std::variant< std::monostate, bool, std::int64_t, double, std::string > const &value)
 Set an attribute for the node.
auto id () const
 Get the node's id.
auto const & geometry () const noexcept
 Get the node's geometry.
auto const & name () const noexcept
 Get the node's name.
auto const & ingoingEdges () const noexcept
 Get the node's ingoing edges.
auto const & outgoingEdges () const noexcept
 Get the node's outgoing edges.
auto const & attributes () const noexcept
 Get the node's attributes.
template<typename T>
std::optional< T > getAttribute (std::string const &name) const
 Get a specific attribute of the node.

Protected Attributes

Id m_id
std::optional< geometry::Pointm_geometry
std::string m_name
std::vector< Id > m_ingoingEdges
std::vector< Id > m_outgoingEdges
std::unordered_map< std::string, std::variant< std::monostate, bool, std::int64_t, double, std::string > > m_attributes

Detailed Description

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

Constructor & Destructor Documentation

◆ Node() [1/2]

dsf::Node::Node ( Id id)
inlineexplicit

Construct a new Node object with capacity 1.

Parameters
idThe node's id

◆ Node() [2/2]

dsf::Node::Node ( Id id,
geometry::Point point )
inline

Construct a new Node object with capacity 1.

Parameters
idThe node's id
pointA geometry::Point containing the node's coordinates

Member Function Documentation

◆ addIngoingEdge()

void dsf::Node::addIngoingEdge ( Id edgeId)
inline

Add an ingoing edge to the node.

Parameters
edgeIdThe edge's id
Exceptions
std::invalid_argumentif the edge already exists in the ingoing edges

◆ addOutgoingEdge()

void dsf::Node::addOutgoingEdge ( Id edgeId)
inline

Add an outgoing edge to the node.

Parameters
edgeIdThe edge's id
Exceptions
std::invalid_argumentif the edge already exists in the outgoing edges

◆ attributes()

auto const & dsf::Node::attributes ( ) const
inlinenoexcept

Get the node's attributes.

Returns
std::unordered_map<std::string, std::variant<std::monostate, bool, std::int64_t, double, std::string>> A map of the node's attributes, where the key is the attribute's name and the value is the attribute's value

◆ geometry()

auto const & dsf::Node::geometry ( ) const
inlinenoexcept

Get the node's geometry.

Returns
std::optional<geometry::Point> A geometry::Point

◆ getAttribute()

template<typename T>
std::optional< T > dsf::Node::getAttribute ( std::string const & name) const
inline

Get a specific attribute of the node.

Template Parameters
TThe type of the attribute's value
Parameters
nameThe attribute's name
Returns
std::optional<T> The attribute's value if it exists and can be cast to the specified type, std::nullopt otherwise

◆ id()

auto dsf::Node::id ( ) const
inline

Get the node's id.

Returns
Id The node's id

◆ ingoingEdges()

auto const & dsf::Node::ingoingEdges ( ) const
inlinenoexcept

Get the node's ingoing edges.

Returns
std::vector<Id> A vector of the node's ingoing edge ids

◆ name()

auto const & dsf::Node::name ( ) const
inlinenoexcept

Get the node's name.

Returns
std::string The node's name

◆ outgoingEdges()

auto const & dsf::Node::outgoingEdges ( ) const
inlinenoexcept

Get the node's outgoing edges.

Returns
std::vector<Id> A vector of the node's outgoing edge ids

◆ setAttribute()

void dsf::Node::setAttribute ( std::string const & name,
std::variant< std::monostate, bool, std::int64_t, double, std::string > const & value )
inline

Set an attribute for the node.

Parameters
nameThe attribute's name
valueThe attribute's value

◆ setGeometry()

void dsf::Node::setGeometry ( geometry::Point point)
inlinenoexcept

Set the node's geometry.

Parameters
pointA geometry::Point containing the node's geometry

◆ setId()

void dsf::Node::setId ( Id id)
inlinenoexcept

Set the node's id.

Parameters
idThe node's id

◆ setName()

void dsf::Node::setName ( const std::string & name)
inlinenoexcept

Set the node's name.

Parameters
nameThe node's name

The documentation for this class was generated from the following file:
  • src/dsf/base/Node.hpp