Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RouteHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The XML-Handler for route elements loading
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "CommonHandler.h"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
28
30
31public:
36 RouteHandler(const std::string& filename, const bool hardFail);
37
39 virtual ~RouteHandler();
40
43
45 void endParseAttributes();
46
49
51 virtual bool postParserTasks() = 0;
52
55
57 virtual bool buildVType(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVTypeParameter& vTypeParameter) = 0;
58
60 virtual bool buildVTypeDistribution(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const int deterministic,
61 const std::vector<std::string>& vTypeIDs, const std::vector<double>& probabilities) = 0;
62
64 virtual bool buildRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, SUMOVehicleClass vClass,
65 const std::vector<std::string>& edgeIDs, const RGBColor& color, const int repeat, const SUMOTime cycleTime,
66 const double probability, const Parameterised::Map& routeParameters) = 0;
67
69 virtual bool buildEmbeddedRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::vector<std::string>& edgeIDs,
70 const RGBColor& color, const int repeat, const SUMOTime cycleTime,
71 const Parameterised::Map& routeParameters) = 0;
72
74 virtual bool buildRouteDistribution(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id,
75 const std::vector<std::string>& vTypeIDs, const std::vector<double>& probabilities) = 0;
76
78 virtual bool buildVehicleOverRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters) = 0;
79
81 virtual bool buildFlowOverRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters) = 0;
82
84 virtual bool buildTrip(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
85 const std::string& fromEdgeID, const std::string& toEdgeID) = 0;
86
88 virtual bool buildTripJunctions(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
89 const std::string& fromJunctionID, const std::string& toJunctionID) = 0;
90
92 virtual bool buildTripTAZs(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
93 const std::string& fromTazID, const std::string& toTazID) = 0;
94
96 virtual bool buildFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
97 const std::string& fromEdgeID, const std::string& toEdgeID) = 0;
98
100 virtual bool buildFlowJunctions(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
101 const std::string& fromJunctionID, const std::string& toJunctionID) = 0;
102
104 virtual bool buildFlowTAZs(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
105 const std::string& fromTAZID, const std::string& toTAZID) = 0;
106
108 virtual bool buildPerson(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& personParameters) = 0;
109
111 virtual bool buildPersonFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& personFlowParameters) = 0;
112
114 virtual bool buildPersonTrip(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
115 const double arrivalPos, const std::vector<std::string>& types, const std::vector<std::string>& modes,
116 const std::vector<std::string>& lines, const double walkFactor, const std::string& group) = 0;
117
119 virtual bool buildWalk(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
120 const double arrivalPos, const double speed, const SUMOTime duration) = 0;
121
123 virtual bool buildRide(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
124 const double arrivalPos, const std::vector<std::string>& lines, const std::string& group) = 0;
125
127 virtual bool buildContainer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& containerParameters) = 0;
128
130 virtual bool buildContainerFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& containerFlowParameters) = 0;
131
133 virtual bool buildTransport(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
134 const double arrivalPos, const std::vector<std::string>& lines, const std::string& group) = 0;
135
137 virtual bool buildTranship(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
138 const double arrivalPosition, const double departPosition, const double speed, const SUMOTime duration) = 0;
139
141 virtual bool buildStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
142 const SUMOVehicleParameter::Stop& stopParameters) = 0;
143
145
146private:
148 const std::string myFilename;
149
151 const bool myHardFail;
152
155
158
162 void parseVType(const SUMOSAXAttributes& attrs);
163
165 void parseVTypeDistribution(const SUMOSAXAttributes& attrs);
166
168 void parseRoute(const SUMOSAXAttributes& attrs);
169
171 void parseRouteDistribution(const SUMOSAXAttributes& attrs);
172
174 void parseTrip(const SUMOSAXAttributes& attrs);
175
177 void parseVehicle(const SUMOSAXAttributes& attrs);
178
180 void parseFlow(const SUMOSAXAttributes& attrs);
181
183 void parseStop(const SUMOSAXAttributes& attrs);
184
186 void parsePerson(const SUMOSAXAttributes& attrs);
187
189 void parsePersonFlow(const SUMOSAXAttributes& attrs);
190
192 void parsePersonTrip(const SUMOSAXAttributes& attrs);
193
195 void parseWalk(const SUMOSAXAttributes& attrs);
196
198 void parseRide(const SUMOSAXAttributes& attrs);
199
201 void parseContainer(const SUMOSAXAttributes& attrs);
202
204 void parseContainerFlow(const SUMOSAXAttributes& attrs);
205
207 void parseTransport(const SUMOSAXAttributes& attrs);
208
210 void parseTranship(const SUMOSAXAttributes& attrs);
211
213 void parseInterval(const SUMOSAXAttributes& attrs);
214
216 bool parseNestedCFM(const SumoXMLTag tag, const SUMOSAXAttributes& attrs,
218
221
223
225 bool isEmbeddedRoute(const SUMOSAXAttributes& attrs) const;
226
228 RouteHandler(const RouteHandler& s) = delete;
229
232};
long long int SUMOTime
Definition GUI.h:36
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
The XML-Handler for network loading.
plan parameters (used for group all from-to parameters related with plans)
std::map< std::string, std::string > Map
parameters map
void parseWalk(const SUMOSAXAttributes &attrs)
parse walk
virtual bool buildTranship(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPosition, const double departPosition, const double speed, const SUMOTime duration)=0
build tranship
void parseContainerFlow(const SUMOSAXAttributes &attrs)
parse container flow
void parseFlow(const SUMOSAXAttributes &attrs)
parse flow (including flows, flows over routes and flows with embedded routes)
bool parseNestedCFM(const SumoXMLTag tag, const SUMOSAXAttributes &attrs, CommonXMLStructure::SumoBaseObject *vTypeObject)
parse nested CarFollowingModel
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
begin parse attributes
virtual bool buildEmbeddedRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map &routeParameters)=0
build embedded route
bool isEmbeddedRoute(const SUMOSAXAttributes &attrs) const
check embedded route
virtual bool buildFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeID)=0
build flow (from-to edges)
void parsePerson(const SUMOSAXAttributes &attrs)
parse person
virtual bool buildRouteDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &vTypeIDs, const std::vector< double > &probabilities)=0
build route distribution
void parseTransport(const SUMOSAXAttributes &attrs)
parse transport
void endParseAttributes()
end parse attributes
virtual bool buildPerson(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personParameters)=0
build person
virtual bool buildPersonFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personFlowParameters)=0
build person flow
virtual bool buildContainer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerParameters)=0
build container
virtual bool buildVTypeDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const int deterministic, const std::vector< std::string > &vTypeIDs, const std::vector< double > &probabilities)=0
build vType distribution
virtual bool buildWalk(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const double speed, const SUMOTime duration)=0
build walk
void parseVTypeDistribution(const SUMOSAXAttributes &attrs)
parse vType distribution
virtual bool buildRide(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)=0
build ride
const std::string myFilename
filename (needed for parsing vTypes)
virtual bool postParserTasks()=0
run post parser tasks
virtual bool buildFlowOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)=0
build a flow over an existent route
void parseStop(const SUMOSAXAttributes &attrs)
parse stop
void parseContainer(const SUMOSAXAttributes &attrs)
parse container
void parsePersonTrip(const SUMOSAXAttributes &attrs)
parse person trip
void parseRoute(const SUMOSAXAttributes &attrs)
parse route
void parseTrip(const SUMOSAXAttributes &attrs)
parse trip
SUMOTime myFlowEndDefault
The default value for flow ends.
virtual ~RouteHandler()
Destructor.
virtual bool buildTripTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTazID, const std::string &toTazID)=0
build trip (from-to TAZs)
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
void parsePersonFlow(const SUMOSAXAttributes &attrs)
parse person flow
void parseInterval(const SUMOSAXAttributes &attrs)
parse interval
virtual bool buildPersonTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &types, const std::vector< std::string > &modes, const std::vector< std::string > &lines, const double walkFactor, const std::string &group)=0
build person trip
void parseVType(const SUMOSAXAttributes &attrs)
void parseRide(const SUMOSAXAttributes &attrs)
parse ride
virtual bool buildFlowJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)=0
build flow (from-to junctions)
virtual bool buildVType(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVTypeParameter &vTypeParameter)=0
build vType
virtual bool buildFlowTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTAZID, const std::string &toTAZID)=0
build flow (from-to TAZs)
SUMOTime myFlowBeginDefault
The default value for flow begins.
virtual bool buildRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, SUMOVehicleClass vClass, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const double probability, const Parameterised::Map &routeParameters)=0
build route
void parseVehicle(const SUMOSAXAttributes &attrs)
parse vehicle (including vehicles over routes and vehicles with embedded routes)
virtual bool buildStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const SUMOVehicleParameter::Stop &stopParameters)=0
build stop
virtual bool buildTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeID)=0
build trip (from-to edges)
virtual bool buildContainerFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerFlowParameters)=0
build container flow
virtual bool buildVehicleOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)=0
build a vehicle over an existent route
bool parseStopParameters(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs)
parse stop parameters
virtual bool buildTripJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)=0
build trip (from-to junctions)
const bool myHardFail
enable or disable hardFail (stop parsing if parameter aren't correct)
virtual bool buildTransport(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)=0
build transport
void parseRouteDistribution(const SUMOSAXAttributes &attrs)
parse route distribution
RouteHandler & operator=(const RouteHandler &s)=delete
invalidate assignment operator
RouteHandler(const RouteHandler &s)=delete
invalidate copy constructor
void parseTranship(const SUMOSAXAttributes &attrs)
parse tranship
Encapsulated SAX-Attributes.
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.