SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Command_SaveTLSSwitchStates Class Reference

Writes the switch times of a tls into a file when the tls switches. More...

#include <Command_SaveTLSSwitchStates.h>

Inheritance diagram for Command_SaveTLSSwitchStates:
Command

Public Member Functions

 Command_SaveTLSSwitchStates (const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od)
 Constructor.
 ~Command_SaveTLSSwitchStates ()
 Destructor.
Derived from Command
SUMOTime execute (SUMOTime currentTime)
 Writes the state of the tls if a change occured.

Private Member Functions

 Command_SaveTLSSwitchStates (const Command_SaveTLSSwitchStates &)
 Invalidated copy constructor.
Command_SaveTLSSwitchStatesoperator= (const Command_SaveTLSSwitchStates &)
 Invalidated assignment operator.

Private Attributes

const
MSTLLogicControl::TLSLogicVariants
myLogics
 The traffic light logic to use.
OutputDevicemyOutputDevice
 The device to write to.
std::string myPreviousProgramID
 Storage for prior sub-id.
std::string myPreviousState
 Storage for prior state.

Detailed Description

Writes the switch times of a tls into a file when the tls switches.

Todo:
Revalidate this - as tls are not seting the link information directly ater being switched, the computed information may be delayed

Definition at line 56 of file Command_SaveTLSSwitchStates.h.


Constructor & Destructor Documentation

Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates ( const MSTLLogicControl::TLSLogicVariants logics,
OutputDevice od 
)

Constructor.

Parameters:
[in]tllsThe logic to write state of
[in]odThe output device to write the state into

Definition at line 46 of file Command_SaveTLSSwitchStates.cpp.

References MSEventControl::ADAPT_AFTER_EXECUTION, MSEventControl::addEvent(), MSNet::getEndOfTimestepEvents(), MSNet::getInstance(), myOutputDevice, and OutputDevice::writeXMLHeader().

Command_SaveTLSSwitchStates::~Command_SaveTLSSwitchStates ( )

Destructor.

Definition at line 54 of file Command_SaveTLSSwitchStates.cpp.

Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates ( const Command_SaveTLSSwitchStates )
private

Invalidated copy constructor.


Member Function Documentation

SUMOTime Command_SaveTLSSwitchStates::execute ( SUMOTime  currentTime)
virtual

Writes the state of the tls if a change occured.

If the state or the active program has changed, the state is written to the output device.

Parameters:
[in]currentTimeThe current simulation time
Returns:
Always DELTA_T (will be executed in next time step)
See also:
Command
Todo:
Here, a discrete even (on switch / program change) would be appropriate

Implements Command.

Definition at line 59 of file Command_SaveTLSSwitchStates.cpp.

References DELTA_T, MSTLLogicControl::TLSLogicVariants::getActive(), MSTrafficLightLogic::getCurrentPhaseDef(), MSTrafficLightLogic::getCurrentPhaseIndex(), MSTrafficLightLogic::getID(), MSTrafficLightLogic::getProgramID(), MSPhaseDefinition::getState(), myLogics, myOutputDevice, myPreviousProgramID, myPreviousState, and time2string().

Command_SaveTLSSwitchStates& Command_SaveTLSSwitchStates::operator= ( const Command_SaveTLSSwitchStates )
private

Invalidated assignment operator.


Field Documentation

const MSTLLogicControl::TLSLogicVariants& Command_SaveTLSSwitchStates::myLogics
private

The traffic light logic to use.

Definition at line 93 of file Command_SaveTLSSwitchStates.h.

Referenced by execute().

OutputDevice& Command_SaveTLSSwitchStates::myOutputDevice
private

The device to write to.

Definition at line 90 of file Command_SaveTLSSwitchStates.h.

Referenced by Command_SaveTLSSwitchStates(), and execute().

std::string Command_SaveTLSSwitchStates::myPreviousProgramID
private

Storage for prior sub-id.

Definition at line 99 of file Command_SaveTLSSwitchStates.h.

Referenced by execute().

std::string Command_SaveTLSSwitchStates::myPreviousState
private

Storage for prior state.

Definition at line 96 of file Command_SaveTLSSwitchStates.h.

Referenced by execute().


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