Eclipse SUMO - Simulation of Urban MObility
MSRouteProbe.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
20 // Writes route distributions at a certain edge
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class MSEdge;
35 class MSRoute;
36 class MSVehicle;
37 class OutputDevice;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
59 public:
67  MSRouteProbe(const std::string& id, const MSEdge* edge,
68  const std::string& distID, const std::string& lastID,
69  const std::string& vTypes);
70 
71 
73  virtual ~MSRouteProbe();
74 
75 
78 
90  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0) override;
92 
93 
96 
110  void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime) override;
111 
112 
120  void writeXMLDetectorProlog(OutputDevice& dev) const override;
122 
123  /* @brief sample a route from the routeDistribution
124  * @param[in] last Retrieve route from the previous (complete) collection interval
125  */
126  ConstMSRoutePtr sampleRoute(bool last = true) const;
127 
128  const MSEdge* getEdge() {
129  return myEdge;
130  }
131 
132  void clearState(SUMOTime step) override;
133 
134 private:
135  void initDistributions();
136 
137 private:
138  std::string myDistID;
139  std::string myLastID;
140 
143 
146 
148  const MSEdge* myEdge;
149 
150 
151 private:
154 
157 
158 
159 };
long long int SUMOTime
Definition: GUI.h:35
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:31
Base of value-generating classes (detectors)
A road/street connecting two junctions.
Definition: MSEdge.h:77
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.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:58
MSRouteProbe(const MSRouteProbe &)
Invalidated copy constructor.
void clearState(SUMOTime step) override
Remove all vehicles before quick-loading state.
std::string myLastID
Definition: MSRouteProbe.h:139
void writeXMLDetectorProlog(OutputDevice &dev) const override
Opens the XML-output using "detector" as root element.
virtual ~MSRouteProbe()
Destructor.
MSRouteProbe & operator=(const MSRouteProbe &)
Invalidated assignment operator.
RandomDistributor< ConstMSRoutePtr > * myCurrentRouteDistribution
The current distribution of routes (probability->route)
Definition: MSRouteProbe.h:145
MSRouteProbe(const std::string &id, const MSEdge *edge, const std::string &distID, const std::string &lastID, const std::string &vTypes)
Constructor.
const MSEdge * myEdge
the edge of this route probe
Definition: MSRouteProbe.h:148
RandomDistributor< ConstMSRoutePtr > * myLastRouteDistribution
The previous distribution of routes (probability->route)
Definition: MSRouteProbe.h:142
void initDistributions()
std::string myDistID
Definition: MSRouteProbe.h:138
const MSEdge * getEdge()
Definition: MSRouteProbe.h:128
ConstMSRoutePtr sampleRoute(bool last=true) const
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0) override
Returns whether the vehicle shall be aware of this entry.
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime) override
Writes values into the given stream.
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.