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 /****************************************************************************/
16 // Parser and container for routes during their loading
17 /****************************************************************************/
18 #ifndef MSRouteHandler_h
19 #define MSRouteHandler_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <utils/common/SUMOTime.h>
31 #include "MSContainer.h"
32 #include "MSVehicle.h"
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class MSEdge;
39 class MSVehicleType;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 public:
56  MSRouteHandler(const std::string& file, bool addVehiclesDirectly);
57 
59  virtual ~MSRouteHandler();
60 
62  static std::mt19937* getParsingRNG() {
63  return &myParsingRNG;
64  }
65 
66 protected:
68 
69 
77  virtual void myStartElement(int element,
78  const SUMOSAXAttributes& attrs);
80 
87  void parseFromViaTo(std::string element,
88  const SUMOSAXAttributes& attrs);
89 
92 
95 
97  void openRoute(const SUMOSAXAttributes& attrs);
98 
100  void openFlow(const SUMOSAXAttributes& attrs);
101 
103  void openTrip(const SUMOSAXAttributes& attrs);
104 
111  void closeRoute(const bool mayBeDisconnected = false);
112 
114  void openRouteDistribution(const SUMOSAXAttributes& attrs);
115 
117  void closeRouteDistribution();
118 
120  virtual void closeVehicle();
121 
123  void closeVType();
124 
126  void closePerson();
127 
129  void closePersonFlow();
130 
132  void closeContainer();
133 
135  void closeFlow();
136 
138  void closeTrip();
139 
141  void addStop(const SUMOSAXAttributes& attrs);
142 
144  void addPersonTrip(const SUMOSAXAttributes& attrs);
145 
147  void addWalk(const SUMOSAXAttributes& attrs);
148 
150  void addPerson(const SUMOSAXAttributes& attrs);
151 
153  void addContainer(const SUMOSAXAttributes& attrs);
154 
156  void addRide(const SUMOSAXAttributes& attrs);
157 
159  void addTransport(const SUMOSAXAttributes& attrs);
160 
162  void addTranship(const SUMOSAXAttributes& attrs);
163 
165  void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
166  const MSEdge* fromEdge, const MSEdge*& toEdge,
167  double& departPos, double& arrivalPos, MSStoppingPlace*& bs,
168  const MSTransportable::Stage* const lastStage, bool& ok);
169 
170 protected:
173 
176 
179 
182 
185 
188 
191 
194 
197 
199  static std::mt19937 myParsingRNG;
200 
201 private:
203  void deleteActivePlans();
204 
206  void addFlowPerson(SUMOTime depart, MSVehicleType* type, const std::string& baseID, int i);
207 
209  MSRouteHandler(const MSRouteHandler& s) = delete;
210 
213 };
214 
215 
216 #endif
217 
218 /****************************************************************************/
219 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:59
MSRouteHandler::myActivePlan
MSTransportable::MSTransportablePlan * myActivePlan
The plan of the current person.
Definition: MSRouteHandler.h:175
SUMOTime.h
MSRouteHandler::closeContainer
void closeContainer()
Ends the processing of a container.
Definition: MSRouteHandler.cpp:820
MSRouteHandler::MSRouteHandler
MSRouteHandler(const MSRouteHandler &s)=delete
Invalidated copy constructor.
MSRouteHandler::myAmLoadingState
bool myAmLoadingState
whether a state file is being loaded
Definition: MSRouteHandler.h:196
MSRouteHandler::myCurrentVTypeDistributionID
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
Definition: MSRouteHandler.h:187
MSRouteHandler::closeTrip
void closeTrip()
Ends the processing of a trip.
Definition: MSRouteHandler.cpp:894
MSRouteHandler::myActiveContainerPlan
MSTransportable::MSTransportablePlan * myActiveContainerPlan
The plan of the current container.
Definition: MSRouteHandler.h:178
MSRouteHandler::addPerson
void addPerson(const SUMOSAXAttributes &attrs)
Processing of a person.
Definition: MSRouteHandler.cpp:1245
MSRouteHandler::~MSRouteHandler
virtual ~MSRouteHandler()
standard destructor
Definition: MSRouteHandler.cpp:59
MSRouteHandler::openVehicleTypeDistribution
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
opens a type distribution for reading
Definition: MSRouteHandler.cpp:350
MSRouteHandler::openRoute
void openRoute(const SUMOSAXAttributes &attrs)
opens a route for reading
Definition: MSRouteHandler.cpp:392
MSTransportable::Stage
Definition: MSTransportable.h:73
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSRouteHandler::parseFromViaTo
void parseFromViaTo(std::string element, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
Definition: MSRouteHandler.cpp:83
MSRouteHandler::addRide
void addRide(const SUMOSAXAttributes &attrs)
Processing of a ride.
Definition: MSRouteHandler.cpp:1255
ConstMSEdgeVector
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:75
MSRouteHandler::operator=
MSRouteHandler & operator=(const MSRouteHandler &s)=delete
Invalidated assignment operator.
MSRouteHandler::openTrip
void openTrip(const SUMOSAXAttributes &attrs)
opens a trip for reading
Definition: MSRouteHandler.cpp:442
MSRouteHandler::closeVType
void closeVType()
Ends the processing of a vehicle type.
Definition: MSRouteHandler.cpp:803
MSRouteHandler::closeRoute
void closeRoute(const bool mayBeDisconnected=false)
closes (ends) the building of a route.
Definition: MSRouteHandler.cpp:448
MSRouteHandler::openRouteDistribution
void openRouteDistribution(const SUMOSAXAttributes &attrs)
opens a route distribution for reading
Definition: MSRouteHandler.cpp:518
MSRouteHandler::addContainer
void addContainer(const SUMOSAXAttributes &attrs)
Processing of a container.
Definition: MSRouteHandler.cpp:1250
MSVehicle.h
MSRouteHandler::closePersonFlow
void closePersonFlow()
Ends the processing of a personFlow.
Definition: MSRouteHandler.cpp:735
MSRouteHandler::myParsingRNG
static std::mt19937 myParsingRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
Definition: MSRouteHandler.h:199
MSRouteHandler::myActiveRoute
ConstMSEdgeVector myActiveRoute
The current route.
Definition: MSRouteHandler.h:172
MSRouteHandler::deleteActivePlans
void deleteActivePlans()
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...
Definition: MSRouteHandler.cpp:63
MSRouteHandler::addTranship
void addTranship(const SUMOSAXAttributes &attrs)
Processing of a tranship.
Definition: MSRouteHandler.cpp:1265
MSRouteHandler::closeVehicle
virtual void closeVehicle()
Ends the processing of a vehicle (note: is virtual because is reimplemented in MSStateHandler)
Definition: MSRouteHandler.cpp:587
MSRouteHandler::myCurrentRouteDistribution
RandomDistributor< const MSRoute * > * myCurrentRouteDistribution
The currently parsed distribution of routes (probability->route)
Definition: MSRouteHandler.h:190
MSRouteHandler::closeRouteDistribution
void closeRouteDistribution()
closes (ends) the building of a distribution
Definition: MSRouteHandler.cpp:565
MSRouteHandler::closeVehicleTypeDistribution
void closeVehicleTypeDistribution()
closes (ends) the building of a distribution
Definition: MSRouteHandler.cpp:372
MSRouteHandler::myCurrentVTypeDistribution
RandomDistributor< MSVehicleType * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
Definition: MSRouteHandler.h:184
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSContainer.h
MSRouteHandler::myCurrentRouteDistributionID
std::string myCurrentRouteDistributionID
The id of the currently parsed route distribution.
Definition: MSRouteHandler.h:193
MSRouteHandler::MSRouteHandler
MSRouteHandler(const std::string &file, bool addVehiclesDirectly)
standard constructor
Definition: MSRouteHandler.cpp:47
RandomDistributor< MSVehicleType * >
MSPerson.h
MSRouteHandler::myStartElement
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: MSRouteHandler.cpp:132
MSRouteHandler::closePerson
void closePerson()
Ends the processing of a person.
Definition: MSRouteHandler.cpp:702
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:587
MSRouteHandler::getParsingRNG
static std::mt19937 * getParsingRNG()
get parsing RNG
Definition: MSRouteHandler.h:62
SUMORouteHandler.h
MSRouteHandler
Parser and container for routes during their loading.
Definition: MSRouteHandler.h:53
MSRouteHandler::addFlowPerson
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...
Definition: MSRouteHandler.cpp:780
MSRouteHandler::addPersonTrip
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
Definition: MSRouteHandler.cpp:1126
MSRouteHandler::myAddVehiclesDirectly
bool myAddVehiclesDirectly
Information whether vehicles shall be directly added to the network or kept within the buffer.
Definition: MSRouteHandler.h:181
SUMORouteHandler
Parser for routes during their loading.
Definition: SUMORouteHandler.h:50
MSRouteHandler::addWalk
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
Definition: MSRouteHandler.cpp:1188
config.h
MSRouteHandler::closeFlow
void closeFlow()
Ends the processing of a flow.
Definition: MSRouteHandler.cpp:848
MSRouteHandler::addTransport
void addTransport(const SUMOSAXAttributes &attrs)
Processing of a transport.
Definition: MSRouteHandler.cpp:1260
MSRouteHandler::openFlow
void openFlow(const SUMOSAXAttributes &attrs)
opens a flow for reading
Definition: MSRouteHandler.cpp:436
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
MSRouteHandler::addStop
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
Definition: MSRouteHandler.cpp:902
MSRouteHandler::parseWalkPositions
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
Definition: MSRouteHandler.cpp:1070