Eclipse SUMO - Simulation of Urban MObility
MSRouteHandler.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-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 /****************************************************************************/
17 // Parser and container for routes during their loading
18 /****************************************************************************/
19 #ifndef MSRouteHandler_h
20 #define MSRouteHandler_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <utils/common/SUMOTime.h>
32 #include "MSContainer.h"
33 #include "MSVehicle.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class MSEdge;
40 class MSVehicleType;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
55 public:
57  MSRouteHandler(const std::string& file, bool addVehiclesDirectly);
58 
60  virtual ~MSRouteHandler();
61 
63  static std::mt19937* getParsingRNG() {
64  return &myParsingRNG;
65  }
66 
67 protected:
69 
70 
78  virtual void myStartElement(int element,
79  const SUMOSAXAttributes& attrs);
81 
88  void parseFromViaTo(std::string element,
89  const SUMOSAXAttributes& attrs);
90 
93 
96 
98  void openRoute(const SUMOSAXAttributes& attrs);
99 
101  void openFlow(const SUMOSAXAttributes& attrs);
102 
104  void openTrip(const SUMOSAXAttributes& attrs);
105 
112  void closeRoute(const bool mayBeDisconnected = false);
113 
115  void openRouteDistribution(const SUMOSAXAttributes& attrs);
116 
118  void closeRouteDistribution();
119 
121  virtual void closeVehicle();
122 
124  void closeVType();
125 
127  void closePerson();
128 
130  void closePersonFlow();
131 
133  void closeContainer();
134 
136  void closeFlow();
137 
139  void closeTrip();
140 
142  void addStop(const SUMOSAXAttributes& attrs);
143 
145  void addPersonTrip(const SUMOSAXAttributes& attrs);
146 
148  void addWalk(const SUMOSAXAttributes& attrs);
149 
151  void addPerson(const SUMOSAXAttributes& attrs);
152 
154  void addContainer(const SUMOSAXAttributes& attrs);
155 
157  void addRide(const SUMOSAXAttributes& attrs);
158 
160  void addTransport(const SUMOSAXAttributes& attrs);
161 
163  void addTranship(const SUMOSAXAttributes& attrs);
164 
166  void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
167  const MSEdge* fromEdge, const MSEdge*& toEdge,
168  double& departPos, double& arrivalPos, MSStoppingPlace*& bs,
169  const MSTransportable::Stage* const lastStage, bool& ok);
170 
171 protected:
174 
177 
180 
183 
186 
189 
192 
195 
198 
200  static std::mt19937 myParsingRNG;
201 
202 private:
204  void deleteActivePlans();
205 
207  void addFlowPerson(SUMOTime depart, MSVehicleType* type, const std::string& baseID, int i);
208 
210  MSRouteHandler(const MSRouteHandler& s) = delete;
211 
213  MSRouteHandler& operator=(const MSRouteHandler& s) = delete;
214 };
215 
216 
217 #endif
218 
219 /****************************************************************************/
220 
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
MSRouteHandler(const std::string &file, bool addVehiclesDirectly)
standard constructor
void openTrip(const SUMOSAXAttributes &attrs)
opens a trip for reading
ConstMSEdgeVector myActiveRoute
The current route.
long long int SUMOTime
Definition: SUMOTime.h:35
void parseFromViaTo(std::string element, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
RandomDistributor< const MSRoute * > * myCurrentRouteDistribution
The currently parsed distribution of routes (probability->route)
virtual void closeVehicle()
Ends the processing of a vehicle (note: is virtual because is reimplemented in MSStateHandler) ...
A lane area vehicles can halt at.
Represents a generic random distribution.
bool myAddVehiclesDirectly
Information whether vehicles shall be directly added to the network or kept within the buffer...
void closePerson()
Ends the processing of a person.
void openRoute(const SUMOSAXAttributes &attrs)
opens a route for reading
void addTransport(const SUMOSAXAttributes &attrs)
Processing of a transport.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:73
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
void addPerson(const SUMOSAXAttributes &attrs)
Processing of a person.
void closeTrip()
Ends the processing of a trip.
void parseWalkPositions(const SUMOSAXAttributes &attrs, const std::string &personID, const MSEdge *fromEdge, const MSEdge *&toEdge, double &departPos, double &arrivalPos, MSStoppingPlace *&bs, const MSTransportable::Stage *const lastStage, bool &ok)
@ brief parse depart- and arrival positions of a walk
The car-following model and parameter.
Definition: MSVehicleType.h:66
void addRide(const SUMOSAXAttributes &attrs)
Processing of a ride.
static std::mt19937 * getParsingRNG()
get parsing RNG
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
A road/street connecting two junctions.
Definition: MSEdge.h:76
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
RandomDistributor< MSVehicleType * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
void closeRouteDistribution()
closes (ends) the building of a distribution
Encapsulated SAX-Attributes.
void deleteActivePlans()
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...
void closeContainer()
Ends the processing of a container.
void closeVehicleTypeDistribution()
closes (ends) the building of a distribution
void addTranship(const SUMOSAXAttributes &attrs)
Processing of a tranship.
void closePersonFlow()
Ends the processing of a personFlow.
void closeVType()
Ends the processing of a vehicle type.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
MSTransportable::MSTransportablePlan * myActivePlan
The plan of the current person.
Parser for routes during their loading.
std::string myCurrentRouteDistributionID
The id of the currently parsed route distribution.
void openRouteDistribution(const SUMOSAXAttributes &attrs)
opens a route distribution for reading
MSRouteHandler & operator=(const MSRouteHandler &s)=delete
Invalidated assignment operator.
void addContainer(const SUMOSAXAttributes &attrs)
Processing of a container.
bool myAmLoadingState
whether a state file is being loaded
static std::mt19937 myParsingRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
virtual ~MSRouteHandler()
standard destructor
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
opens a type distribution for reading
void openFlow(const SUMOSAXAttributes &attrs)
opens a flow for reading
void closeRoute(const bool mayBeDisconnected=false)
closes (ends) the building of a route.
Parser and container for routes during their loading.
void closeFlow()
Ends the processing of a flow.
MSTransportable::MSTransportablePlan * myActiveContainerPlan
The plan of the current container.
void addFlowPerson(SUMOTime depart, MSVehicleType *type, const std::string &baseID, int i)
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...