SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSRouteHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Parser and container for routes during their loading
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSRouteHandler_h
23 #define MSRouteHandler_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
37 #include "MSContainer.h"
38 #include "MSVehicle.h"
40 #include <utils/common/SUMOTime.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSEdge;
47 class MSVehicleType;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
62 public:
64  MSRouteHandler(const std::string& file,
65  bool addVehiclesDirectly);
66 
68  virtual ~MSRouteHandler();
69 
70  static MTRand* getParsingRNG() {
71  return &myParsingRNG;
72  }
73 
74 protected:
76 
77 
85  virtual void myStartElement(int element,
86  const SUMOSAXAttributes& attrs);
87 
88 
95  virtual void myEndElement(int element);
97 
98 
105  void parseFromViaTo(std::string element,
106  const SUMOSAXAttributes& attrs);
107 
108 
111 
114 
116  void openRoute(const SUMOSAXAttributes& attrs);
117 
123  void closeRoute(const bool mayBeDisconnected = false);
124 
126  void openRouteDistribution(const SUMOSAXAttributes& attrs);
127 
129  void closeRouteDistribution();
130 
132  void closeVehicle();
133 
135  void closePerson();
136 
138  void closeContainer();
139 
141  void closeFlow();
142 
144  void addStop(const SUMOSAXAttributes& attrs);
145 
147  void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
148  const MSEdge* fromEdge, const MSEdge*& toEdge,
149  SUMOReal& departPos, SUMOReal& arrivalPos, MSStoppingPlace*& bs, bool& ok);
150  SUMOReal parseWalkPos(SumoXMLAttr attr, const std::string& id, const MSEdge* edge, const std::string& val);
151 
152 protected:
155 
158 
161 
164 
167 
170 
173 
176 
179 
180 private:
182  void deleteActivePlans();
183 
185  MSRouteHandler(const MSRouteHandler& s);
186 
189 
190 };
191 
192 
193 #endif
194 
195 /****************************************************************************/
196 
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)
void closeVehicle()
Ends the processing of a vehicle.
static MTRand myParsingRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
A lane area vehicles can halt at.
bool myAddVehiclesDirectly
Information whether vehicles shall be directly added to the network or kept within the buffer...
static MTRand * getParsingRNG()
void closePerson()
Ends the processing of a person.
void openRoute(const SUMOSAXAttributes &attrs)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
The car-following model and parameter.
Definition: MSVehicleType.h:74
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()
SUMOReal parseWalkPos(SumoXMLAttr attr, const std::string &id, const MSEdge *edge, const std::string &val)
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 parseWalkPositions(const SUMOSAXAttributes &attrs, const std::string &personID, const MSEdge *fromEdge, const MSEdge *&toEdge, SUMOReal &departPos, SUMOReal &arrivalPos, MSStoppingPlace *&bs, bool &ok)
@ brief parse depart- and arrival positions of a walk
void openRouteDistribution(const SUMOSAXAttributes &attrs)
virtual void myEndElement(int element)
Called when a closing tag occurs.
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
MSRouteHandler & operator=(const MSRouteHandler &s)
Invalidated assignment operator.
#define SUMOReal
Definition: config.h:214
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.