NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
NetSignalGroupController Class Reference

The NetSignalGroupController class represents a controller for handling network signal groups in a simulation. More...

#include <netsignalgroupcontroller.h>

Public Member Functions

 NetSignalGroupController (std::set< std::shared_ptr< NetNode > > nodes)
 Constructor.
 
void clear ()
 Clears the controller to its initial state.
 
void addNode (std::shared_ptr< NetNode > node)
 Adds a node to the group controller.
 
void sendPassRequestToControlTo (std::shared_ptr< NetSignal > networkSignal, double &simulationTime, Vector< std::shared_ptr< NetSignal > > &sameDirectionSignals)
 Sends a pass request to control a specific network signal.
 
void updateTimeStep (double &timeStep)
 Updates the controller state based on the time step.
 
std::pair< std::shared_ptr< NetSignal >, Vector< std::shared_ptr< NetSignal > > > getFeedback ()
 Gets the feedback on which signals should be turned on/off.
 
void setSignalsInSameDirection (Vector< std::shared_ptr< NetSignal > > sameDirectionSignals)
 Sets the signals in the same direction as the train.
 

Public Attributes

Vector< std::shared_ptr< NetSignal > > networkSignalsGroup
 The network signals in the group.
 
Vector< std::shared_ptr< NetNode > > atNodes
 The nodes confined by this group controller.
 
Vector< std::shared_ptr< NetLink > > confinedLinks
 The confined links in the group.
 
Map< std::shared_ptr< NetSignal >, bool > movements
 The movement status of the signals.
 
double timeStamp
 The timestamp of the controller.
 
std::shared_ptr< NetSignallockedOnSignal
 The locked network signal.
 
Vector< std::shared_ptr< NetSignal > > otherDirectionSignals
 The signals in the opposite direction.
 

Friends

ostream & operator<< (ostream &ostr, const NetSignalGroupController &group)
 Overloaded ostream operator for printing the NetSignalGroupController object.
 

Detailed Description

The NetSignalGroupController class represents a controller for handling network signal groups in a simulation.

Constructor & Destructor Documentation

◆ NetSignalGroupController()

NetSignalGroupController::NetSignalGroupController ( std::set< std::shared_ptr< NetNode > >  nodes)

Constructor.

Parameters
nodesThe set of nodes confined by this group controller.

Member Function Documentation

◆ addNode()

void NetSignalGroupController::addNode ( std::shared_ptr< NetNode node)

Adds a node to the group controller.

Parameters
nodeThe node to add.

◆ clear()

void NetSignalGroupController::clear ( )

Clears the controller to its initial state.

◆ getFeedback()

std::pair< std::shared_ptr< NetSignal >, Vector< std::shared_ptr< NetSignal > > > NetSignalGroupController::getFeedback ( )

Gets the feedback on which signals should be turned on/off.

Returns
A pair of the locked network signal and the signals to be turned off.

◆ sendPassRequestToControlTo()

void NetSignalGroupController::sendPassRequestToControlTo ( std::shared_ptr< NetSignal networkSignal,
double &  simulationTime,
Vector< std::shared_ptr< NetSignal > > &  sameDirectionSignals 
)

Sends a pass request to control a specific network signal.

Parameters
networkSignalThe network signal to control.
simulationTimeThe current simulation time.
sameDirectionSignalsThe signals in the same direction as the train.

◆ setSignalsInSameDirection()

void NetSignalGroupController::setSignalsInSameDirection ( Vector< std::shared_ptr< NetSignal > >  sameDirectionSignals)

Sets the signals in the same direction as the train.

Parameters
sameDirectionSignalsThe signals in the same direction.

◆ updateTimeStep()

void NetSignalGroupController::updateTimeStep ( double &  timeStep)

Updates the controller state based on the time step.

Parameters
timeStepThe time step.

Friends And Related Symbol Documentation

◆ operator<<

ostream & operator<< ( ostream &  ostr,
const NetSignalGroupController group 
)
friend

Overloaded ostream operator for printing the NetSignalGroupController object.

Parameters
ostrThe output stream object.
groupThe NetSignalGroupController object to be printed.
Returns
The output stream object.

Member Data Documentation

◆ atNodes

Vector<std::shared_ptr<NetNode> > NetSignalGroupController::atNodes

The nodes confined by this group controller.

◆ confinedLinks

Vector<std::shared_ptr<NetLink> > NetSignalGroupController::confinedLinks

The confined links in the group.

◆ lockedOnSignal

std::shared_ptr<NetSignal> NetSignalGroupController::lockedOnSignal

The locked network signal.

◆ movements

Map<std::shared_ptr<NetSignal>, bool> NetSignalGroupController::movements

The movement status of the signals.

◆ networkSignalsGroup

Vector<std::shared_ptr<NetSignal> > NetSignalGroupController::networkSignalsGroup

The network signals in the group.

◆ otherDirectionSignals

Vector<std::shared_ptr<NetSignal> > NetSignalGroupController::otherDirectionSignals

The signals in the opposite direction.

◆ timeStamp

double NetSignalGroupController::timeStamp

The timestamp of the controller.