SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMORouteHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Parser for routes during their loading
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 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 SUMORouteHandler_h
23 #define SUMORouteHandler_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 
36 #include <utils/common/SUMOTime.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MsgHandler;
45 class SUMOVTypeParameter;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
59 public:
61  SUMORouteHandler(const std::string& file);
62 
64  virtual ~SUMORouteHandler();
65 
67  SUMOTime getLastDepart() const;
68 
70  static bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength,
71  const SUMOReal minLength, const bool friendlyPos);
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 
99  virtual void openVehicleTypeDistribution(const SUMOSAXAttributes& attrs) = 0;
100 
102  virtual void closeVehicleTypeDistribution() = 0;
103 
105  virtual void openRoute(const SUMOSAXAttributes& attrs) = 0;
106 
112  virtual void closeRoute(const bool mayBeDisconnected = false) = 0;
113 
115  virtual void openRouteDistribution(const SUMOSAXAttributes& attrs) = 0;
116 
118  virtual void closeRouteDistribution() = 0;
119 
121  virtual void closeVehicle() = 0;
122 
124  virtual void closePerson() = 0;
125 
127  virtual void closeFlow() = 0;
128 
130  virtual void addStop(const SUMOSAXAttributes& attrs) = 0;
131 
133  bool checkLastDepart();
134 
136  void registerLastDepart();
137 
139  void addParam(const SUMOSAXAttributes& attrs);
140 
142  bool parseStop(SUMOVehicleParameter::Stop& stop, const SUMOSAXAttributes& attrs, std::string errorSuffix, MsgHandler* const errorOutput);
143 
144 protected:
147 
150 
152  std::string myActiveRouteID;
153 
155  std::string myActiveRouteRefID;
156 
159 
162 
164  std::vector<SUMOVehicleParameter::Stop> myActiveRouteStops;
165 
168 
171 
174 
177 
178 private:
181 
184 
185 };
186 
187 
188 #endif
189 
190 /****************************************************************************/