SUMO - Simulation of Urban MObility
MSTrafficLightLogic::SwitchCommand Class Reference

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

#include <MSTrafficLightLogic.h>

Inheritance diagram for MSTrafficLightLogic::SwitchCommand:
Inheritance graph
Collaboration diagram for MSTrafficLightLogic::SwitchCommand:
Collaboration graph

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Class realising the switch between the traffic light phases.

Definition at line 339 of file MSTrafficLightLogic.h.

Constructor & Destructor Documentation

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 63 of file MSTrafficLightLogic.cpp.

MSTrafficLightLogic::SwitchCommand::~SwitchCommand ( )

Destructor.

Definition at line 69 of file MSTrafficLightLogic.cpp.

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

Invalidated copy constructor.

Member Function Documentation

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 100 of file MSTrafficLightLogic.cpp.

References myAmValid, myAssumedNextSwitch, and myTLLogic.

Referenced by MSPhasedTrafficLightLogic::changeStepAndDuration(), and MSSimpleTrafficLightLogic::changeStepAndDuration().

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 74 of file MSTrafficLightLogic.cpp.

References MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions(), MSTLLogicControl::get(), MSTrafficLightLogic::getCurrentPhaseIndex(), Named::getID(), MSTLLogicControl::isActive(), myAmValid, myAssumedNextSwitch, myTLControl, myTLLogic, MSTrafficLightLogic::setTrafficLightSignals(), and MSTrafficLightLogic::trySwitch().

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

Returns the assumed next switch time.

Returns
The assumed next switch time

Definition at line 369 of file MSTrafficLightLogic.h.

References myAssumedNextSwitch.

Referenced by MSTrafficLightLogic::getNextSwitchTime().

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

Invalidated assignment operator.

Field Documentation

bool MSTrafficLightLogic::SwitchCommand::myAmValid
private

Information whether this switch command is still valid.

Definition at line 385 of file MSTrafficLightLogic.h.

Referenced by deschedule(), and execute().

SUMOTime MSTrafficLightLogic::SwitchCommand::myAssumedNextSwitch
private

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

Definition at line 382 of file MSTrafficLightLogic.h.

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

MSTLLogicControl& MSTrafficLightLogic::SwitchCommand::myTLControl
private

The responsible traffic lights control.

Definition at line 376 of file MSTrafficLightLogic.h.

Referenced by execute().

MSTrafficLightLogic* MSTrafficLightLogic::SwitchCommand::myTLLogic
private

The logic to be executed on a switch.

Definition at line 379 of file MSTrafficLightLogic.h.

Referenced by deschedule(), and execute().


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