Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSTLLogicControl::SwitchInitCommand Class Reference

This event-class is used to initialise a WAUT switch at a certain time. More...

#include <MSTLLogicControl.h>

Inheritance diagram for MSTLLogicControl::SwitchInitCommand:
[legend]
Collaboration diagram for MSTLLogicControl::SwitchInitCommand:
[legend]

Public Member Functions

int & getIndex ()
 Returns a reference to the index.
 
const std::string & getWAUTID () const
 Returns the WAUT-id.
 
virtual SUMOTime shiftTime (SUMOTime, SUMOTime, SUMOTime)
 Reschedule or deschedule the command when quick-loading state.
 
 SwitchInitCommand (MSTLLogicControl &p, const std::string &wautid, int index)
 Constructor.
 
 ~SwitchInitCommand ()
 Destructor.
 
Derived from Command
SUMOTime execute (SUMOTime)
 Begins a WAUT switch by executing the command.
 

Data Fields

int priority = 0
 

Protected Attributes

int myIndex
 The current index within the WAUT switch table.
 
MSTLLogicControlmyParent
 The control to call.
 
std::string myWAUTID
 The id of the WAUT that shall switch.
 

Private Member Functions

SwitchInitCommandoperator= (const SwitchInitCommand &)
 Invalidated assignment operator.
 
 SwitchInitCommand (const SwitchInitCommand &)
 Invalidated copy constructor.
 

Detailed Description

This event-class is used to initialise a WAUT switch at a certain time.

This command is reused. The index of the WAUT-switch is incremented at each call to the control.

Definition at line 376 of file MSTLLogicControl.h.

Constructor & Destructor Documentation

◆ SwitchInitCommand() [1/2]

MSTLLogicControl::SwitchInitCommand::SwitchInitCommand ( MSTLLogicControl p,
const std::string &  wautid,
int  index 
)
inline

Constructor.

Parameters
[in]pThe logic control
[in]wautidThe id of the WAUT
[in]indexThe first position within the WAUT table

Definition at line 383 of file MSTLLogicControl.h.

◆ ~SwitchInitCommand()

MSTLLogicControl::SwitchInitCommand::~SwitchInitCommand ( )
inline

Destructor.

Definition at line 388 of file MSTLLogicControl.h.

◆ SwitchInitCommand() [2/2]

MSTLLogicControl::SwitchInitCommand::SwitchInitCommand ( const SwitchInitCommand )
private

Invalidated copy constructor.

Member Function Documentation

◆ execute()

SUMOTime MSTLLogicControl::SwitchInitCommand::execute ( SUMOTime  )
inlinevirtual

Begins a WAUT switch by executing the command.

The parent's "initWautSwitch" method is called supporting this command as an argument. The result of "initWautSwitch" is returned.

"initWautSwitch" may throw an ProcessError if the program to switch to is not known.

Parameters
[in]currentTimeThe current simulation time (unused)
Returns
The time after which the command shall be executed again
Exceptions
ProcessErrorIf the program to switch to does not exist
See also
MSTLLogicControl::initWautSwitch

Implements Command.

Definition at line 409 of file MSTLLogicControl.h.

References MSTLLogicControl::initWautSwitch(), and myParent.

◆ getIndex()

int & MSTLLogicControl::SwitchInitCommand::getIndex ( )
inline

Returns a reference to the index.

Returns
A reference to the index

Definition at line 427 of file MSTLLogicControl.h.

References myIndex.

Referenced by MSTLLogicControl::initWautSwitch().

Here is the caller graph for this function:

◆ getWAUTID()

const std::string & MSTLLogicControl::SwitchInitCommand::getWAUTID ( ) const
inline

Returns the WAUT-id.

Returns
The WAUT id

Definition at line 419 of file MSTLLogicControl.h.

References myWAUTID.

Referenced by MSTLLogicControl::initWautSwitch().

Here is the caller graph for this function:

◆ operator=()

SwitchInitCommand & MSTLLogicControl::SwitchInitCommand::operator= ( const SwitchInitCommand )
private

Invalidated assignment operator.

◆ shiftTime()

virtual SUMOTime Command::shiftTime ( SUMOTime  ,
SUMOTime  ,
SUMOTime   
)
inlinevirtualinherited

Reschedule or deschedule the command when quick-loading state.

The implementations should return -1 if the command shall not be re-scheduled, or a value >= 0 that describe the new time at which the command shall be executed again.

Parameters
[in]currentTimeThe current simulation time
[in]execTimeThe time at which the command would have been executed
[in]newTimeThe simulation time at which the simulation is restarted
Returns
The time at which the command shall be executed again

Reimplemented in MSTrafficLightLogic::SwitchCommand, and MSCalibrator::CalibratorCommand.

Definition at line 83 of file Command.h.

Field Documentation

◆ myIndex

int MSTLLogicControl::SwitchInitCommand::myIndex
protected

The current index within the WAUT switch table.

Definition at line 440 of file MSTLLogicControl.h.

Referenced by getIndex().

◆ myParent

MSTLLogicControl& MSTLLogicControl::SwitchInitCommand::myParent
protected

The control to call.

Definition at line 434 of file MSTLLogicControl.h.

Referenced by execute().

◆ myWAUTID

std::string MSTLLogicControl::SwitchInitCommand::myWAUTID
protected

The id of the WAUT that shall switch.

Definition at line 437 of file MSTLLogicControl.h.

Referenced by getWAUTID().

◆ priority

int Command::priority = 0
inherited

Definition at line 87 of file Command.h.

Referenced by MSTrafficLightLogic::SwitchCommand::SwitchCommand().


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