Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSTrafficLightLogic::SwitchCommand Class Reference

Class realising the switch between the traffic light phases. More...

#include <MSTrafficLightLogic.h>

Inheritance diagram for MSTrafficLightLogic::SwitchCommand:
[legend]
Collaboration diagram for MSTrafficLightLogic::SwitchCommand:
[legend]

Public Member Functions

void deschedule (MSTrafficLightLogic *tlLogic)
 Marks this swicth as invalid (if the phase duration has changed, f.e.).
SUMOTime execute (SUMOTime currentTime)
 Executes the regarded junction's "trySwitch"- method.
SUMOTime getNextSwitchTime () const
 Returns the assumed next switch time.
SUMOTime shiftTime (SUMOTime currentTime, SUMOTime execTime, SUMOTime newTime)
 Reschedule or deschedule the command when quick-loading state.
 SwitchCommand (MSTLLogicControl &tlcontrol, MSTrafficLightLogic *tlLogic, SUMOTime nextSwitch)
 Constructor.
 ~SwitchCommand ()
 Destructor.

Data Fields

int priority = 0

Private Member Functions

SwitchCommandoperator= (const SwitchCommand &)
 Invalidated assignment operator.
 SwitchCommand (const SwitchCommand &)
 Invalidated copy constructor.

Private Attributes

bool myAmValid
 Information whether this switch command is still valid.
SUMOTime myAssumedNextSwitch
 Assumed switch time (may change in case of adaptive traffic lights).
MSTLLogicControlmyTLControl
 The responsible traffic lights control.
MSTrafficLightLogicmyTLLogic
 The logic to be executed on a switch.

Detailed Description

Class realising the switch between the traffic light phases.

Definition at line 441 of file MSTrafficLightLogic.h.

Constructor & Destructor Documentation

◆ SwitchCommand() [1/2]

MSTrafficLightLogic::SwitchCommand::SwitchCommand ( MSTLLogicControl & tlcontrol,
MSTrafficLightLogic * tlLogic,
SUMOTime nextSwitch )

Constructor.

Parameters
[in]tlcontrolThe responsible traffic lights control
[in]tlLogicThe controlled tls logic
[in]durationDuration till next switch

Definition at line 54 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::MSTrafficLightLogic(), myAmValid, myAssumedNextSwitch, myTLControl, myTLLogic, and Command::priority.

Referenced by operator=(), and SwitchCommand().

Here is the caller graph for this function:

◆ ~SwitchCommand()

MSTrafficLightLogic::SwitchCommand::~SwitchCommand ( )

Destructor.

Definition at line 63 of file MSTrafficLightLogic.cpp.

◆ SwitchCommand() [2/2]

MSTrafficLightLogic::SwitchCommand::SwitchCommand ( const SwitchCommand & )
private

Invalidated copy constructor.

References SwitchCommand().

Member Function Documentation

◆ deschedule()

void MSTrafficLightLogic::SwitchCommand::deschedule ( MSTrafficLightLogic * tlLogic)

Marks this swicth as invalid (if the phase duration has changed, f.e.).

Parameters
[in]tlLogicThe controlled tls logic

Definition at line 96 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::MSTrafficLightLogic(), myAmValid, myAssumedNextSwitch, and myTLLogic.

◆ execute()

SUMOTime MSTrafficLightLogic::SwitchCommand::execute ( SUMOTime currentTime)
virtual

Executes the regarded junction's "trySwitch"- method.

Parameters
[in]currentTimeThe current simulation time
Returns
The time after which the command shall be executed again (the time of next switch)

Implements Command.

Definition at line 68 of file MSTrafficLightLogic.cpp.

References MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions(), myAmValid, myAssumedNextSwitch, myTLControl, and myTLLogic.

◆ getNextSwitchTime()

SUMOTime MSTrafficLightLogic::SwitchCommand::getNextSwitchTime ( ) const
inline

Returns the assumed next switch time.

Returns
The assumed next switch time

Definition at line 471 of file MSTrafficLightLogic.h.

References myAssumedNextSwitch.

◆ operator=()

SwitchCommand & MSTrafficLightLogic::SwitchCommand::operator= ( const SwitchCommand & )
private

Invalidated assignment operator.

References SwitchCommand().

◆ shiftTime()

SUMOTime MSTrafficLightLogic::SwitchCommand::shiftTime ( SUMOTime currentTime,
SUMOTime execTime,
SUMOTime newTime )
virtual

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 from Command.

Definition at line 105 of file MSTrafficLightLogic.cpp.

References DELTA_T, myTLLogic, and UNUSED_PARAMETER.

Field Documentation

◆ myAmValid

bool MSTrafficLightLogic::SwitchCommand::myAmValid
private

Information whether this switch command is still valid.

Definition at line 499 of file MSTrafficLightLogic.h.

Referenced by deschedule(), execute(), and SwitchCommand().

◆ myAssumedNextSwitch

SUMOTime MSTrafficLightLogic::SwitchCommand::myAssumedNextSwitch
private

Assumed switch time (may change in case of adaptive traffic lights).

Definition at line 496 of file MSTrafficLightLogic.h.

Referenced by deschedule(), execute(), getNextSwitchTime(), and SwitchCommand().

◆ myTLControl

MSTLLogicControl& MSTrafficLightLogic::SwitchCommand::myTLControl
private

The responsible traffic lights control.

Definition at line 490 of file MSTrafficLightLogic.h.

Referenced by execute(), and SwitchCommand().

◆ myTLLogic

MSTrafficLightLogic* MSTrafficLightLogic::SwitchCommand::myTLLogic
private

The logic to be executed on a switch.

Definition at line 493 of file MSTrafficLightLogic.h.

Referenced by deschedule(), execute(), shiftTime(), and SwitchCommand().

◆ priority

int Command::priority = 0
inherited

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