SUMO - Simulation of Urban MObility
Command_SaveTLCoupledDet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Writes e2 state on each tls switch
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
33 #include <microsim/MSNet.h>
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
46  MSDetectorFileOutput* dtf, SUMOTime begin, OutputDevice& device)
47  : myDevice(device), myLogics(tlls), myDetector(dtf),
48  myStartTime(begin) {
49  tlls.addSwitchCommand(this);
50  dtf->writeXMLDetectorProlog(device);
51 }
52 
53 
55 }
56 
57 
58 void
61  if (myStartTime != end) {
63  myStartTime = end;
64  }
65 }
66 
67 
68 
69 /****************************************************************************/
70 
Storage for all programs of a single tls.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:158
Command_SaveTLCoupledDet(MSTLLogicControl::TLSLogicVariants &tlls, MSDetectorFileOutput *dtf, SUMOTime begin, OutputDevice &device)
Constructor.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const =0
Open the XML-output.
void addSwitchCommand(OnSwitchAction *c)
virtual void execute()
Executes the command.
SUMOTime myStartTime
The last time the values were written.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:257
virtual void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)=0
Write the generated output to the given device.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
long long int SUMOTime
Definition: TraCIDefs.h:52
OutputDevice & myDevice
The file to write the output to.
MSDetectorFileOutput * myDetector
The detector to use.
virtual ~Command_SaveTLCoupledDet()
Destructor.
Base of value-generating classes (detectors)