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.org/sumo
3 // Copyright (C) 2001-2022 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);
92 
93 
96 
110  void writeXMLOutput(OutputDevice& dev,
111  SUMOTime startTime, SUMOTime stopTime);
112 
113 
121  void writeXMLDetectorProlog(OutputDevice& dev) const;
123 
124  /* @brief sample a route from the routeDistribution
125  * @param[in] last Retrieve route from the previous (complete) collection interval
126  */
127  const MSRoute* sampleRoute(bool last = true) const;
128 
129  const MSEdge* getEdge() {
130  return myEdge;
131  }
132 
133 private:
135  std::pair<std::string, RandomDistributor<const MSRoute*>*> myLastRouteDistribution;
136 
138  std::pair<std::string, RandomDistributor<const MSRoute*>*> myCurrentRouteDistribution;
139 
141  const MSEdge* myEdge;
142 
143 
144 private:
147 
150 
151 
152 };
long long int SUMOTime
Definition: SUMOTime.h:32
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:82
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.
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Returns whether the vehicle shall be aware of this entry.
std::pair< std::string, RandomDistributor< const MSRoute * > * > myCurrentRouteDistribution
The current distribution of routes (probability->route)
Definition: MSRouteProbe.h:138
virtual ~MSRouteProbe()
Destructor.
MSRouteProbe & operator=(const MSRouteProbe &)
Invalidated assignment operator.
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:141
const MSRoute * sampleRoute(bool last=true) const
std::pair< std::string, RandomDistributor< const MSRoute * > * > myLastRouteDistribution
The previous distribution of routes (probability->route)
Definition: MSRouteProbe.h:135
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes values into the given stream.
const MSEdge * getEdge()
Definition: MSRouteProbe.h:129
void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "detector" as root element.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:75
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
Representation of a vehicle, person, or container.