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.dev/sumo
3 // Copyright (C) 2011-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // An instantaneous induction loop
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <string>
25 #include <deque>
26 #include <map>
27 #include <functional>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MSLane;
36 class MSVehicle;
37 class OutputDevice;
38 class SUMOTrafficObject;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
52  : public MSMoveReminder, public MSDetectorFileOutput {
53 public:
62  MSInstantInductLoop(const std::string& id, OutputDevice& od,
63  MSLane* const lane, double positionInMeters,
64  const std::string name, const std::string& vTypes,
65  const std::string& nextEdges);
66 
67 
70 
71 
72 
75 
92  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
93 
94 
108  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
110 
111 
112 
123  SUMOTime startTime, SUMOTime stopTime) {
124  UNUSED_PARAMETER(dev);
125  UNUSED_PARAMETER(startTime);
126  UNUSED_PARAMETER(stopTime);
127  }
128 
129 
138  void writeXMLDetectorProlog(OutputDevice& dev) const;
139 
140 
141 protected:
150  void write(const char* state, double t, SUMOTrafficObject& veh, double speed, const char* add = 0, double addValue = -1);
151 
152 
153 protected:
155  const std::string myName;
156 
159 
161  const double myPosition;
162 
165 
167  std::map<SUMOTrafficObject*, double> myEntryTimes;
168 
169 private:
172 
175 
176 
177 };
long long int SUMOTime
Definition: GUI.h:35
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
Base of value-generating classes (detectors)
An instantaneous induction loop.
MSInstantInductLoop(const MSInstantInductLoop &)
Invalidated copy constructor.
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
OutputDevice & myOutputDevice
The output device to use.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
~MSInstantInductLoop()
Destructor.
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
MSInstantInductLoop & operator=(const MSInstantInductLoop &)
Invalidated assignment operator.
const double myPosition
Detector's position on lane [m].
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string name, const std::string &vTypes, const std::string &nextEdges)
Constructor.
const std::string myName
name
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.
double myLastExitTime
The last exit time.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
Representation of a vehicle, person, or container.