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-2020 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& vTypes);
65 
66 
69 
70 
71 
74 
91  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
92 
93 
107  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
109 
110 
111 
122  SUMOTime startTime, SUMOTime stopTime) {
123  UNUSED_PARAMETER(dev);
124  UNUSED_PARAMETER(startTime);
125  UNUSED_PARAMETER(stopTime);
126  }
127 
128 
137  void writeXMLDetectorProlog(OutputDevice& dev) const;
138 
139 
140 protected:
149  void write(const char* state, double t, SUMOTrafficObject& veh, double speed, const char* add = 0, double addValue = -1);
150 
151 
152 protected:
155 
157  const double myPosition;
158 
161 
163  std::map<SUMOTrafficObject*, double> myEntryTimes;
164 
165 private:
168 
171 
172 
173 };
long long int SUMOTime
Definition: SUMOTime.h:31
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:29
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.
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.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
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:82
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:60
Representation of a vehicle, person, or container.