36 OutputDevice& od,
bool saveDetectors,
bool saveConditions) :
39 mySaveDetectors(saveDetectors),
40 mySaveConditions(saveConditions) {
53 std::map<SumoXMLAttr, std::string> attrs;
55 std::vector<std::string> IDs;
57 IDs.push_back(item.first);
63 std::vector<std::string> IDs;
65 IDs.push_back(item.first);
81 std::vector<int> states;
83 states.push_back((
int)item.second);
89 std::vector<double> states;
91 states.push_back(item.second);
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SUMO_ATTR_STATE
The state of a link.
@ SUMO_ATTR_TIME
trigger: the time of the step
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
~Command_SaveTLSState()
Destructor.
OutputDevice & myOutputDevice
The device to write to.
const bool mySaveConditions
Command_SaveTLSState(const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od, bool saveDetectors, bool saveConditions)
Constructor.
SUMOTime execute(SUMOTime currentTime)
Writes the current state of the tls.
const bool mySaveDetectors
additiona logging
const MSTLLogicControl::TLSLogicVariants & myLogics
The traffic light logic to use.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
const std::string & getName() const
const std::string & getState() const
Returns the state within this phase.
Storage for all programs of a single tls.
MSTrafficLightLogic * getActive() const
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
virtual std::map< std::string, double > getConditions() const
return all named conditions defined for this traffic light
const std::string & getProgramID() const
Returns this tl-logic's id.
virtual std::map< std::string, double > getDetectorStates() const
return activation state of all detectors that affect this traffic light
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.