Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // An instantaneous induction loop
17 /****************************************************************************/
18 #ifndef MSInstantInductLoop_h
19 #define MSInstantInductLoop_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <deque>
29 #include <map>
30 #include <functional>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class MSLane;
39 class MSVehicle;
40 class OutputDevice;
41 class SUMOTrafficObject;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
55  : public MSMoveReminder, public MSDetectorFileOutput {
56 public:
65  MSInstantInductLoop(const std::string& id, OutputDevice& od,
66  MSLane* const lane, double positionInMeters,
67  const std::string& vTypes);
68 
69 
72 
73 
74 
77 
94  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
95 
96 
111  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
113 
114 
115 
126  SUMOTime startTime, SUMOTime stopTime) {
127  UNUSED_PARAMETER(dev);
128  UNUSED_PARAMETER(startTime);
129  UNUSED_PARAMETER(stopTime);
130  }
131 
132 
141  void writeXMLDetectorProlog(OutputDevice& dev) const;
142 
143 
144 protected:
153  void write(const char* state, double t, SUMOTrafficObject& veh, double speed, const char* add = 0, double addValue = -1);
154 
155 
156 protected:
159 
161  const double myPosition;
162 
165 
167  std::map<SUMOTrafficObject*, double> myEntryTimes;
168 
169 private:
172 
175 
176 
177 };
178 
179 
180 #endif
181 
182 /****************************************************************************/
183 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
MSDetectorFileOutput
Base of value-generating classes (detectors)
Definition: MSDetectorFileOutput.h:64
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSInstantInductLoop::myOutputDevice
OutputDevice & myOutputDevice
The output device to use.
Definition: MSInstantInductLoop.h:158
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSInstantInductLoop::writeXMLDetectorProlog
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
Definition: MSInstantInductLoop.cpp:137
MSInstantInductLoop::myPosition
const double myPosition
Detector's position on lane [m].
Definition: MSInstantInductLoop.h:161
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSInstantInductLoop::myEntryTimes
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
Definition: MSInstantInductLoop.h:167
MSDetectorFileOutput.h
MSInstantInductLoop::MSInstantInductLoop
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
Definition: MSInstantInductLoop.cpp:45
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:64
MSInstantInductLoop::~MSInstantInductLoop
~MSInstantInductLoop()
Destructor.
Definition: MSInstantInductLoop.cpp:57
MSInstantInductLoop::notifyMove
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
Definition: MSInstantInductLoop.cpp:62
MSMoveReminder.h
MSInstantInductLoop
An instantaneous induction loop.
Definition: MSInstantInductLoop.h:54
MSInstantInductLoop::notifyLeave
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Dismisses the vehicle if it is on the detector due to a lane change.
Definition: MSInstantInductLoop.cpp:121
MSInstantInductLoop::writeXMLOutput
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
Definition: MSInstantInductLoop.h:125
MSInstantInductLoop::write
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
Definition: MSInstantInductLoop.cpp:107
config.h
MSInstantInductLoop::myLastExitTime
double myLastExitTime
The last exit time.
Definition: MSInstantInductLoop.h:164
MSInstantInductLoop::operator=
MSInstantInductLoop & operator=(const MSInstantInductLoop &)
Invalidated assignment operator.
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80