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 /****************************************************************************/
15 // An instantaneous induction loop
16 /****************************************************************************/
17 #ifndef MSInstantInductLoop_h
18 #define MSInstantInductLoop_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <deque>
28 #include <map>
29 #include <functional>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSLane;
38 class MSVehicle;
39 class OutputDevice;
40 class SUMOTrafficObject;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
54  : public MSMoveReminder, public MSDetectorFileOutput {
55 public:
64  MSInstantInductLoop(const std::string& id, OutputDevice& od,
65  MSLane* const lane, double positionInMeters,
66  const std::string& vTypes);
67 
68 
71 
72 
73 
76 
93  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
94 
95 
110  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
112 
113 
114 
125  SUMOTime startTime, SUMOTime stopTime) {
126  UNUSED_PARAMETER(dev);
127  UNUSED_PARAMETER(startTime);
128  UNUSED_PARAMETER(stopTime);
129  }
130 
131 
140  void writeXMLDetectorProlog(OutputDevice& dev) const;
141 
142 
143 protected:
152  void write(const char* state, double t, SUMOTrafficObject& veh, double speed, const char* add = 0, double addValue = -1);
153 
154 
155 protected:
158 
160  const double myPosition;
161 
164 
166  std::map<SUMOTrafficObject*, double> myEntryTimes;
167 
168 private:
171 
174 
175 
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
MSDetectorFileOutput
Base of value-generating classes (detectors)
Definition: MSDetectorFileOutput.h:63
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSInstantInductLoop::myOutputDevice
OutputDevice & myOutputDevice
The output device to use.
Definition: MSInstantInductLoop.h:157
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSInstantInductLoop::writeXMLDetectorProlog
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
Definition: MSInstantInductLoop.cpp:139
MSInstantInductLoop::myPosition
const double myPosition
Detector's position on lane [m].
Definition: MSInstantInductLoop.h:160
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSInstantInductLoop::myEntryTimes
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
Definition: MSInstantInductLoop.h:166
MSDetectorFileOutput.h
MSInstantInductLoop::MSInstantInductLoop
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
Definition: MSInstantInductLoop.cpp:44
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:66
MSInstantInductLoop::~MSInstantInductLoop
~MSInstantInductLoop()
Destructor.
Definition: MSInstantInductLoop.cpp:56
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:61
MSMoveReminder.h
MSInstantInductLoop
An instantaneous induction loop.
Definition: MSInstantInductLoop.h:53
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:123
MSInstantInductLoop::writeXMLOutput
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
Definition: MSInstantInductLoop.h:124
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:109
config.h
MSInstantInductLoop::myLastExitTime
double myLastExitTime
The last exit time.
Definition: MSInstantInductLoop.h:163
MSInstantInductLoop::operator=
MSInstantInductLoop & operator=(const MSInstantInductLoop &)
Invalidated assignment operator.
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79