40 : myOutputDevice(od), myLogics(logics) {
55 for (
int i = 0; i < (int) links.size(); i++) {
70 for (
int j = 0; j < (int) currLinks.size(); j++) {
71 MSLink* link = currLinks[j];
74 <<
"\" fromLane=\"" << currLanes[j]->getID()
78 <<
"\" duration=\"" <<
time2string(currentTime - lastOn)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
SUMOTime execute(SUMOTime currentTime)
Writes the output if a change occurred.
std::map< int, SUMOTime > myPreviousLinkStates
Storage for prior states; map from signal group to last green time begin.
const MSTLLogicControl::TLSLogicVariants & myLogics
The traffic light logic to use.
~Command_SaveTLSSwitches()
Destructor.
OutputDevice & myOutputDevice
The device to write to.
Command_SaveTLSSwitches(const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od)
Constructor.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
MSLane * getLane() const
Returns the connected lane.
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 & getState() const
Returns the state within this phase.
Storage for all programs of a single tls.
MSTrafficLightLogic * getActive() const
The parent class for traffic light logics.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
const std::string & getProgramID() const
Returns this tl-logic's id.
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
std::vector< MSLink * > LinkVector
Definition of the list of links that are subjected to this tls.
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
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.