Dynamical system model
Loading...
Searching...
No Matches
dsm::Agent< Delay > Class Template Reference

The Agent class represents an agent in the network. More...

#include <Agent.hpp>

Public Member Functions

 Agent (Id id, Id itineraryId)
 Construct a new Agent object.
 
 Agent (Id id, Id itineraryId, Id srcNodeId)
 Construct a new Agent object.
 
void setStreetId (Id streetId)
 Set the street occupied by the agent.
 
void setSourceNodeId (Id srcNodeId)
 Set the source node id of the agent.
 
void setItineraryId (Id itineraryId)
 Set the agent's itinerary.
 
void setSpeed (double speed)
 Set the agent's speed.
 
void incrementDelay ()
 Increment the agent's delay by 1.
 
void incrementDelay (Delay delay)
 Set the agent's delay.
 
void decrementDelay ()
 Decrement the agent's delay by 1.
 
void incrementDistance ()
 Increment the agent's distance by its speed * 1 second.
 
void incrementDistance (double distance)
 Increment the agent's distance by a given value.
 
void incrementTime ()
 Increment the agent's time by 1.
 
void incrementTime (unsigned int time)
 Increment the agent's time by a given value.
 
void resetTime ()
 Reset the agent's time to 0.
 
Id id () const
 Get the agent's id.
 
Id itineraryId () const
 Get the agent's itinerary.
 
std::optional< Id > streetId () const
 Get the id of the street currently occupied by the agent.
 
std::optional< Id > srcNodeId () const
 Get the id of the source node of the agent.
 
double speed () const
 Get the agent's speed.
 
Delay delay () const
 Get the agent's delay.
 
double distance () const
 Get the agent's travelled distance.
 
unsigned int time () const
 Get the agent's travel time.
 

Detailed Description

template<typename Delay>
requires (is_numeric_v<Delay>)
class dsm::Agent< Delay >

The Agent class represents an agent in the network.

Template Parameters
Id,Thetype of the agent's id. It must be an unsigned integral type.
Size,Thetype of the size of a street. It must be an unsigned integral type.
Delay,Thetype of the agent's delay. It must be a numeric type (see utility/TypeTraits/is_numeric.hpp).

Constructor & Destructor Documentation

◆ Agent() [1/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
dsm::Agent< Delay >::Agent ( Id id,
Id itineraryId )

Construct a new Agent object.

Parameters
idThe agent's id
itineraryIdThe agent's itinerary

◆ Agent() [2/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
dsm::Agent< Delay >::Agent ( Id id,
Id itineraryId,
Id srcNodeId )

Construct a new Agent object.

Parameters
idThe agent's id
itineraryIdThe agent's itinerary
srcNodeIdThe id of the source node of the agent

Member Function Documentation

◆ decrementDelay()

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::decrementDelay ( )

Decrement the agent's delay by 1.

Exceptions
std::underflow_error,ifdelay has reached its minimum value

◆ delay()

template<typename Delay >
Delay dsm::Agent< Delay >::delay ( ) const
inline

Get the agent's delay.

Returns
The agent's delay

◆ distance()

template<typename Delay >
double dsm::Agent< Delay >::distance ( ) const
inline

Get the agent's travelled distance.

Returns
The agent's travelled distance

◆ id()

template<typename Delay >
Id dsm::Agent< Delay >::id ( ) const
inline

Get the agent's id.

Returns
The agent's id

◆ incrementDelay() [1/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::incrementDelay ( )

Increment the agent's delay by 1.

Exceptions
std::overflow_error,ifdelay has reached its maximum value

◆ incrementDelay() [2/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::incrementDelay ( Delay delay)

Set the agent's delay.

Parameters
delayThe agent's delay
Exceptions
std::overflow_error,ifdelay has reached its maximum value

◆ incrementDistance()

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::incrementDistance ( double distance)

Increment the agent's distance by a given value.

Parameters
distanceThe value to increment the agent's distance byĆ¹
Exceptions
std::invalid_argument,ifdistance is negative

◆ incrementTime() [1/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::incrementTime ( )

Increment the agent's time by 1.

Exceptions
std::overflow_error,iftime has reached its maximum value

◆ incrementTime() [2/2]

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::incrementTime ( unsigned int time)

Increment the agent's time by a given value.

Parameters
timeThe value to increment the agent's time by
Exceptions
std::overflow_error,iftime has reached its maximum value

◆ itineraryId()

template<typename Delay >
Id dsm::Agent< Delay >::itineraryId ( ) const
inline

Get the agent's itinerary.

Returns
The agent's itinerary

◆ setItineraryId()

template<typename Delay >
void dsm::Agent< Delay >::setItineraryId ( Id itineraryId)
inline

Set the agent's itinerary.

Parameters
itineraryIdThe agent's itinerary

◆ setSourceNodeId()

template<typename Delay >
void dsm::Agent< Delay >::setSourceNodeId ( Id srcNodeId)
inline

Set the source node id of the agent.

Parameters
srcNodeIdThe id of the source node of the agent

◆ setSpeed()

template<typename Delay >
requires (is_numeric_v<Delay>)
void dsm::Agent< Delay >::setSpeed ( double speed)

Set the agent's speed.

Parameters
speed,Theagent's speed
Exceptions
std::invalid_argument,ifspeed is negative

◆ setStreetId()

template<typename Delay >
void dsm::Agent< Delay >::setStreetId ( Id streetId)
inline

Set the street occupied by the agent.

Parameters
streetIdThe id of the street currently occupied by the agent

◆ speed()

template<typename Delay >
double dsm::Agent< Delay >::speed ( ) const
inline

Get the agent's speed.

Returns
The agent's speed

◆ srcNodeId()

template<typename Delay >
std::optional< Id > dsm::Agent< Delay >::srcNodeId ( ) const
inline

Get the id of the source node of the agent.

Returns
The id of the source node of the agent

◆ streetId()

template<typename Delay >
std::optional< Id > dsm::Agent< Delay >::streetId ( ) const
inline

Get the id of the street currently occupied by the agent.

Returns
The id of the street currently occupied by the agent

◆ time()

template<typename Delay >
unsigned int dsm::Agent< Delay >::time ( ) const
inline

Get the agent's travel time.

Returns
The agent's travel time

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