#include <Command_SaveTLCoupledLaneDet.h>

Definition at line 45 of file Command_SaveTLCoupledLaneDet.h.
Public Member Functions | |
| Command_SaveTLCoupledLaneDet (MSTLLogicControl::TLSLogicVariants &tlls, MSDetectorFileOutput *dtf, unsigned int begin, OutputDevice &device, MSLink *link) throw () | |
| Constructor. | |
| void | execute () throw () |
| Executes the command. | |
| ~Command_SaveTLCoupledLaneDet () throw () | |
| Destructor. | |
Protected Attributes | |
| MSDetectorFileOutput * | myDetector |
| The detector to use. | |
| OutputDevice & | myDevice |
| The file to write the output to. | |
| const MSTLLogicControl::TLSLogicVariants & | myLogics |
| The logic to use. | |
| SUMOTime | myStartTime |
| The last time the values were written. | |
Private Member Functions | |
| Command_SaveTLCoupledLaneDet (const Command_SaveTLCoupledLaneDet &) | |
| Invalidated copy constructor. | |
| Command_SaveTLCoupledLaneDet & | operator= (const Command_SaveTLCoupledLaneDet &) |
| Invalidated assignment operator. | |
Private Attributes | |
| bool | myHadOne |
| Whether the last link state was already saved. | |
| MSLink::LinkState | myLastState |
| The state the link had the last time. | |
| MSLink * | myLink |
| The link to observe. | |
| Command_SaveTLCoupledLaneDet::Command_SaveTLCoupledLaneDet | ( | MSTLLogicControl::TLSLogicVariants & | tlls, | |
| MSDetectorFileOutput * | dtf, | |||
| unsigned int | begin, | |||
| OutputDevice & | device, | |||
| MSLink * | link | |||
| ) | throw () |
Constructor.
| [in] | tlls | The logic to observe |
| [in] | dtf | The detector used to generate the values |
| [in] | begin | The begin simulation time |
| [in] | device | The output device to write the detector values into |
| [in] | link | The link that shall be observed |
Definition at line 48 of file Command_SaveTLCoupledLaneDet.cpp.
00053 : Command_SaveTLCoupledDet(tlls, dtf, begin, device), 00054 myLink(link), myLastState(MSLink::LINKSTATE_TL_RED), 00055 myHadOne(false) {}
| Command_SaveTLCoupledLaneDet::~Command_SaveTLCoupledLaneDet | ( | ) | throw () |
| Command_SaveTLCoupledLaneDet::Command_SaveTLCoupledLaneDet | ( | const Command_SaveTLCoupledLaneDet & | ) | [private] |
Invalidated copy constructor.
| void Command_SaveTLCoupledLaneDet::execute | ( | ) | throw () [virtual] |
Executes the command.
Called when an active tls program switches, this method checks whether the tls signal responsible for the link has switched to green. If so, the values collected so far are written using "writeXMLOutput". Otherwise, the values are reset.
Reimplemented from Command_SaveTLCoupledDet.
Definition at line 63 of file Command_SaveTLCoupledLaneDet.cpp.
References MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSLink::getState(), MSLink::LINKSTATE_TL_RED, Command_SaveTLCoupledDet::myDetector, Command_SaveTLCoupledDet::myDevice, myHadOne, myLastState, myLink, Command_SaveTLCoupledDet::myStartTime, MSDetectorFileOutput::reset(), and MSDetectorFileOutput::writeXMLOutput().
00063 { 00064 if (myLink->getState()==myLastState&&myHadOne) { 00065 return; 00066 } 00067 myHadOne = true; 00068 if (myLastState==MSLink::LINKSTATE_TL_RED&&myLink->getState()!=MSLink::LINKSTATE_TL_RED) { 00069 SUMOTime end = MSNet::getInstance()->getCurrentTimeStep(); 00070 if (myStartTime!=end) { 00071 myDetector->writeXMLOutput(myDevice, myStartTime, end); 00072 myStartTime = end; 00073 } 00074 } 00075 if (myLink->getState()!=MSLink::LINKSTATE_TL_RED) { 00076 myDetector->reset(); 00077 myStartTime = MSNet::getInstance()->getCurrentTimeStep(); 00078 } 00079 myLastState = myLink->getState(); 00080 }
| Command_SaveTLCoupledLaneDet& Command_SaveTLCoupledLaneDet::operator= | ( | const Command_SaveTLCoupledLaneDet & | ) | [private] |
Invalidated assignment operator.
MSDetectorFileOutput* Command_SaveTLCoupledDet::myDetector [protected, inherited] |
The detector to use.
Definition at line 91 of file Command_SaveTLCoupledDet.h.
Referenced by execute(), and Command_SaveTLCoupledDet::execute().
OutputDevice& Command_SaveTLCoupledDet::myDevice [protected, inherited] |
The file to write the output to.
Definition at line 85 of file Command_SaveTLCoupledDet.h.
Referenced by execute(), and Command_SaveTLCoupledDet::execute().
bool Command_SaveTLCoupledLaneDet::myHadOne [private] |
Whether the last link state was already saved.
Definition at line 85 of file Command_SaveTLCoupledLaneDet.h.
Referenced by execute().
The state the link had the last time.
Definition at line 82 of file Command_SaveTLCoupledLaneDet.h.
Referenced by execute().
MSLink* Command_SaveTLCoupledLaneDet::myLink [private] |
The link to observe.
Definition at line 79 of file Command_SaveTLCoupledLaneDet.h.
Referenced by execute().
const MSTLLogicControl::TLSLogicVariants& Command_SaveTLCoupledDet::myLogics [protected, inherited] |
SUMOTime Command_SaveTLCoupledDet::myStartTime [protected, inherited] |
The last time the values were written.
Definition at line 94 of file Command_SaveTLCoupledDet.h.
Referenced by execute(), and Command_SaveTLCoupledDet::execute().
1.5.6