SUMO - Simulation of Urban MObility
MSInstantInductLoop.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2011-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // An instantaneous induction loop
19 /****************************************************************************/
20 #ifndef MSInstantInductLoop_h
21 #define MSInstantInductLoop_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <deque>
35 #include <map>
36 #include <functional>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSLane;
45 class MSVehicle;
46 class OutputDevice;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
60  : public MSMoveReminder, public MSDetectorFileOutput {
61 public:
70  MSInstantInductLoop(const std::string& id, OutputDevice& od,
71  MSLane* const lane, double positionInMeters,
72  const std::string& vTypes);
73 
74 
77 
78 
79 
82 
99  bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed);
100 
101 
116  bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
118 
119 
120 
131  SUMOTime startTime, SUMOTime stopTime) {
132  UNUSED_PARAMETER(dev);
133  UNUSED_PARAMETER(startTime);
134  UNUSED_PARAMETER(stopTime);
135  }
136 
137 
146  void writeXMLDetectorProlog(OutputDevice& dev) const;
147 
148 
149 protected:
158  void write(const char* state, double t, SUMOVehicle& veh, double speed, const char* add = 0, double addValue = -1);
159 
160 
161 protected:
164 
166  const double myPosition;
167 
170 
172  std::map<SUMOVehicle*, double> myEntryTimes;
173 
174 private:
177 
180 
181 
182 };
183 
184 
185 #endif
186 
187 /****************************************************************************/
188 
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
Notification
Definition of a vehicle state.
An instantaneous induction loop.
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Dismisses the vehicle if it is on the detector due to a lane change.
double myLastExitTime
The last exit time.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
std::map< SUMOVehicle *, double > myEntryTimes
The last exit time.
~MSInstantInductLoop()
Destructor.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
MSInstantInductLoop & operator=(const MSInstantInductLoop &)
Invalidated assignment operator.
Something on a lane to be noticed about vehicle movement.
const double myPosition
Detector&#39;s position on lane [m].
OutputDevice & myOutputDevice
The output device to use.
void write(const char *state, double t, SUMOVehicle &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
Base of value-generating classes (detectors)