Eclipse SUMO - Simulation of Urban MObility
|
Writes the switch times of a tls into a file when the tls switches. More...
#include <Command_SaveTLSProgram.h>
Public Member Functions | |
Command_SaveTLSProgram (const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od) | |
Constructor. | |
virtual SUMOTime | shiftTime (SUMOTime, SUMOTime, SUMOTime) |
Reschedule or deschedule the command when quick-loading state. | |
~Command_SaveTLSProgram () | |
Destructor. | |
Derived from Command | |
SUMOTime | execute (SUMOTime currentTime) |
Writes the state of the tls if a change occurred. | |
Data Fields | |
int | priority = 0 |
Private Member Functions | |
Command_SaveTLSProgram (const Command_SaveTLSProgram &) | |
Invalidated copy constructor. | |
Command_SaveTLSProgram & | operator= (const Command_SaveTLSProgram &) |
Invalidated assignment operator. | |
void | writeCurrent () |
Write the current program. | |
Private Attributes | |
const MSTLLogicControl::TLSLogicVariants & | myLogics |
The traffic light logic to use. | |
OutputDevice & | myOutputDevice |
The device to write to. | |
std::string | myPreviousProgramID |
Storage for prior sub-id. | |
std::vector< MSPhaseDefinition > | myPreviousStates |
Storage for prior state. | |
std::string | myTLSID |
Storage for the tls ID (needed in destructor) | |
Writes the switch times of a tls into a file when the tls switches.
Definition at line 46 of file Command_SaveTLSProgram.h.
Command_SaveTLSProgram::Command_SaveTLSProgram | ( | const MSTLLogicControl::TLSLogicVariants & | logics, |
OutputDevice & | od | ||
) |
Constructor.
[in] | tlls | The logic to write state of |
[in] | od | The output device to write the state into |
Definition at line 34 of file Command_SaveTLSProgram.cpp.
References MSEventControl::addEvent(), MSNet::getEndOfTimestepEvents(), MSNet::getInstance(), myOutputDevice, and OutputDevice::writeXMLHeader().
Command_SaveTLSProgram::~Command_SaveTLSProgram | ( | ) |
|
private |
Invalidated copy constructor.
Writes the state of the tls if a change occurred.
If the state or the active program has changed, the state is written to the output device.
[in] | currentTime | The current simulation time |
Implements Command.
Definition at line 48 of file Command_SaveTLSProgram.cpp.
References DELTA_T, MSTLLogicControl::TLSLogicVariants::getActive(), MSTrafficLightLogic::getCurrentPhaseDef(), Named::getID(), MSPhaseDefinition::getName(), MSTrafficLightLogic::getProgramID(), MSPhaseDefinition::getState(), myLogics, myPreviousProgramID, myPreviousStates, myTLSID, and writeCurrent().
|
private |
Invalidated assignment operator.
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.
[in] | currentTime | The current simulation time |
[in] | execTime | The time at which the command would have been executed |
[in] | newTime | The simulation time at which the simulation is restarted |
Reimplemented in MSTrafficLightLogic::SwitchCommand, and MSCalibrator::CalibratorCommand.
|
private |
Write the current program.
Definition at line 64 of file Command_SaveTLSProgram.cpp.
References OutputDevice::closeTag(), myOutputDevice, myPreviousProgramID, myPreviousStates, myTLSID, OutputDevice::openTag(), STEPS2TIME, SUMO_ATTR_DURATION, SUMO_ATTR_ID, SUMO_ATTR_NAME, SUMO_ATTR_PROGRAMID, SUMO_ATTR_STATE, SUMO_ATTR_TYPE, SUMO_TAG_PHASE, SUMO_TAG_TLLOGIC, TIME2STEPS, OutputDevice::writeAttr(), and OutputDevice::writePadding().
Referenced by execute(), and ~Command_SaveTLSProgram().
|
private |
The traffic light logic to use.
Definition at line 86 of file Command_SaveTLSProgram.h.
Referenced by execute().
|
private |
The device to write to.
Definition at line 83 of file Command_SaveTLSProgram.h.
Referenced by Command_SaveTLSProgram(), and writeCurrent().
|
private |
Storage for prior sub-id.
Definition at line 92 of file Command_SaveTLSProgram.h.
Referenced by execute(), and writeCurrent().
|
private |
Storage for prior state.
Definition at line 89 of file Command_SaveTLSProgram.h.
Referenced by execute(), and writeCurrent().
|
private |
Storage for the tls ID (needed in destructor)
Definition at line 95 of file Command_SaveTLSProgram.h.
Referenced by execute(), and writeCurrent().
|
inherited |
Definition at line 87 of file Command.h.
Referenced by MSTransportableDevice_FCDReplay::MovePedestrians::MovePedestrians(), and MSTrafficLightLogic::SwitchCommand::SwitchCommand().