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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // Parser and container for routes during their loading
20 /****************************************************************************/
21 #ifndef MSRouteHandler_h
22 #define MSRouteHandler_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
36 #include "MSContainer.h"
37 #include "MSVehicle.h"
39 #include <utils/common/SUMOTime.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class MSEdge;
46 class MSVehicleType;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
61 public:
63  MSRouteHandler(const std::string& file,
64  bool addVehiclesDirectly);
65 
67  virtual ~MSRouteHandler();
68 
69  static std::mt19937* getParsingRNG() {
70  return &myParsingRNG;
71  }
72 
73 protected:
75 
76 
84  virtual void myStartElement(int element,
85  const SUMOSAXAttributes& attrs);
86 
87 
94  virtual void myEndElement(int element);
96 
97 
104  void parseFromViaTo(std::string element,
105  const SUMOSAXAttributes& attrs);
106 
107 
110 
113 
115  void openRoute(const SUMOSAXAttributes& attrs);
116 
122  void closeRoute(const bool mayBeDisconnected = false);
123 
125  void openRouteDistribution(const SUMOSAXAttributes& attrs);
126 
128  void closeRouteDistribution();
129 
131  virtual void closeVehicle();
132 
134  void closePerson();
135 
137  void closeContainer();
138 
140  void closeFlow();
141 
143  void addStop(const SUMOSAXAttributes& attrs);
144 
146  void addPersonTrip(const SUMOSAXAttributes& attrs);
147 
149  void addWalk(const SUMOSAXAttributes& attrs);
150 
152  void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
153  const MSEdge* fromEdge, const MSEdge*& toEdge,
154  double& departPos, double& arrivalPos, MSStoppingPlace*& bs,
155  const MSTransportable::Stage* const lastStage, bool& ok);
156 
157 protected:
160 
163 
166 
169 
172 
175 
178 
181 
184 
186  static std::mt19937 myParsingRNG;
187 
188 private:
190  void deleteActivePlans();
191 
193  MSRouteHandler(const MSRouteHandler& s);
194 
197 
198 };
199 
200 
201 #endif
202 
203 /****************************************************************************/
204 
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:78
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:72
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:80
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.