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-2018 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>
30 #include "MSContainer.h"
31 #include "MSVehicle.h"
33 #include <utils/common/SUMOTime.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,
58  bool addVehiclesDirectly);
59 
61  virtual ~MSRouteHandler();
62 
63  static std::mt19937* getParsingRNG() {
64  return &myParsingRNG;
65  }
66 
67 protected:
69 
70 
78  virtual void myStartElement(int element,
79  const SUMOSAXAttributes& attrs);
80 
81 
88  virtual void myEndElement(int element);
90 
91 
98  void parseFromViaTo(std::string element,
99  const SUMOSAXAttributes& attrs);
100 
101 
104 
107 
109  void openRoute(const SUMOSAXAttributes& attrs);
110 
116  void closeRoute(const bool mayBeDisconnected = false);
117 
119  void openRouteDistribution(const SUMOSAXAttributes& attrs);
120 
122  void closeRouteDistribution();
123 
125  virtual void closeVehicle();
126 
128  void closePerson();
129 
131  void closeContainer();
132 
134  void closeFlow();
135 
137  void addStop(const SUMOSAXAttributes& attrs);
138 
140  void addPersonTrip(const SUMOSAXAttributes& attrs);
141 
143  void addWalk(const SUMOSAXAttributes& attrs);
144 
146  void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
147  const MSEdge* fromEdge, const MSEdge*& toEdge,
148  double& departPos, double& arrivalPos, MSStoppingPlace*& bs,
149  const MSTransportable::Stage* const lastStage, bool& ok);
150 
151 protected:
154 
157 
160 
163 
166 
169 
172 
175 
178 
180  static std::mt19937 myParsingRNG;
181 
182 private:
184  void deleteActivePlans();
185 
187  MSRouteHandler(const MSRouteHandler& s);
188 
191 
192 };
193 
194 
195 #endif
196 
197 /****************************************************************************/
198 
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
MSRouteHandler(const std::string &file, bool addVehiclesDirectly)
standard constructor
ConstMSEdgeVector myActiveRoute
The current route.
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.
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)
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:72
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
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
static std::mt19937 * getParsingRNG()
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
A road/street connecting two junctions.
Definition: MSEdge.h:75
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()
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()
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)
virtual void myEndElement(int element)
Called when a closing tag occurs.
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.
MSRouteHandler & operator=(const MSRouteHandler &s)
Invalidated assignment operator.
virtual ~MSRouteHandler()
standard destructor
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
void closeRoute(const bool mayBeDisconnected=false)
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.