Dynamical system model
Loading...
Searching...
No Matches
dsm::Agent< Id, Size, 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 Id, typename Size, typename Delay>
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
class dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, Delay >::decrementDelay ( )

Decrement the agent's delay by 1.

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

◆ delay()

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

Get the agent's delay.

Returns
The agent's delay

◆ distance()

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

Get the agent's travelled distance.

Returns
The agent's travelled distance

◆ id()

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

Get the agent's id.

Returns
The agent's id

◆ incrementDelay() [1/2]

template<typename Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, Delay >::incrementDelay ( )

Increment the agent's delay by 1.

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

◆ incrementDelay() [2/2]

template<typename Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, Delay >::incrementTime ( )

Increment the agent's time by 1.

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

◆ incrementTime() [2/2]

template<typename Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
Id dsm::Agent< Id, Size, Delay >::itineraryId ( ) const
inline

Get the agent's itinerary.

Returns
The agent's itinerary

◆ setItineraryId()

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

Set the agent's itinerary.

Parameters
itineraryIdThe agent's itinerary

◆ setSourceNodeId()

template<typename Id , typename Size , typename Delay >
void dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size> && is_numeric_v<Delay>)
void dsm::Agent< Id, Size, Delay >::setSpeed ( double speed)

Set the agent's speed.

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

◆ setStreetId()

template<typename Id , typename Size , typename Delay >
void dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
double dsm::Agent< Id, Size, Delay >::speed ( ) const
inline

Get the agent's speed.

Returns
The agent's speed

◆ srcNodeId()

template<typename Id , typename Size , typename Delay >
std::optional< Id > dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
std::optional< Id > dsm::Agent< Id, Size, 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 Id , typename Size , typename Delay >
unsigned int dsm::Agent< Id, Size, 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: