SUMO - Simulation of Urban MObility
SAXWeightsHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2007-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 // An XML-handler for network weights
20 /****************************************************************************/
21 #ifndef SAXWeightsHandler_h
22 #define SAXWeightsHandler_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 <utils/common/SUMOTime.h>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class OptionsCont;
43 class RONet;
44 class ROEdge;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
76 public:
82  public:
85 
88 
96  virtual void addEdgeWeight(const std::string& id,
97  double val, double beg, double end) const = 0;
98 
99  private:
100  EdgeFloatTimeLineRetriever& operator=(const EdgeFloatTimeLineRetriever&); // just to avoid a compiler warning
101  };
102 
108  public:
110  ToRetrieveDefinition(const std::string& attributeName, bool edgeBased,
111  EdgeFloatTimeLineRetriever& destination);
112 
115 
116  public:
118  std::string myAttributeName;
119 
122 
125 
127  double myAggValue;
128 
131 
134 
135  private:
138 
141 
142  };
143 
150  SAXWeightsHandler(const std::vector<ToRetrieveDefinition*>& defs,
151  const std::string& file);
152 
153 
160  const std::string& file);
161 
162 
165 
166 
167 protected:
169 
170 
178  void myStartElement(int element,
179  const SUMOSAXAttributes& attrs);
180 
181 
188  void myEndElement(int elemente);
190 
191 
192 private:
194  void tryParse(const SUMOSAXAttributes& attrs, bool isEdge);
195 
196 
197 private:
199  std::vector<ToRetrieveDefinition*> myDefinitions;
200 
203 
206 
208  std::string myCurrentEdgeID;
209 
210 
211 private:
214 
217 
218 };
219 
220 
221 #endif
222 
223 /****************************************************************************/
224 
bool myHadAttribute
Information whether the attribute has been found for the current edge.
EdgeFloatTimeLineRetriever & operator=(const EdgeFloatTimeLineRetriever &)
Interface for a class which obtains read weights for named edges.
EdgeFloatTimeLineRetriever & myDestination
The class that shall be called when new data is avaiable.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
double myCurrentTimeBeg
the begin of the time period that is currently processed
An XML-handler for network weights.
std::string myAttributeName
The attribute name that shall be parsed.
virtual void addEdgeWeight(const std::string &id, double val, double beg, double end) const =0
Adds a weight for a given edge and time period.
SAX-handler base for SUMO-files.
~SAXWeightsHandler()
Destructor.
std::string myCurrentEdgeID
the edge which is currently being processed
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the efforts of a lane for the previously read times.
Encapsulated SAX-Attributes.
double myCurrentTimeEnd
the end of the time period that is currently processed
SAXWeightsHandler(const std::vector< ToRetrieveDefinition *> &defs, const std::string &file)
Constructor.
void myEndElement(int elemente)
Called when a closing tag occurs.
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file. ...
bool myAmEdgeBased
Information whether edge values shall be used (lane value if false)
A basic edge for routing applications.
Definition: ROEdge.h:77
int myNoLanes
The number of lanes read for the current edge.
Complete definition about what shall be retrieved and where to store it.
The router&#39;s network representation.
Definition: RONet.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:98
double myAggValue
aggregated value over the lanes read within the current edge