Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // An XML-handler for network weights
18 /****************************************************************************/
19 #ifndef SAXWeightsHandler_h
20 #define SAXWeightsHandler_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
30 #include <utils/common/SUMOTime.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OptionsCont;
37 class RONet;
38 class ROEdge;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
70 public:
76  public:
79 
82 
90  virtual void addEdgeWeight(const std::string& id,
91  double val, double beg, double end) const = 0;
92 
93  private:
94  EdgeFloatTimeLineRetriever& operator=(const EdgeFloatTimeLineRetriever&); // just to avoid a compiler warning
95  };
96 
102  public:
104  ToRetrieveDefinition(const std::string& attributeName, bool edgeBased,
105  EdgeFloatTimeLineRetriever& destination);
106 
109 
110  public:
112  std::string myAttributeName;
113 
116 
119 
121  double myAggValue;
122 
125 
128 
129  private:
132 
135 
136  };
137 
144  SAXWeightsHandler(const std::vector<ToRetrieveDefinition*>& defs,
145  const std::string& file);
146 
147 
154  const std::string& file);
155 
156 
159 
160 
161 protected:
163 
164 
172  void myStartElement(int element,
173  const SUMOSAXAttributes& attrs);
174 
175 
182  void myEndElement(int elemente);
184 
185 
186 private:
188  void tryParse(const SUMOSAXAttributes& attrs, bool isEdge);
189 
190 
191 private:
193  std::vector<ToRetrieveDefinition*> myDefinitions;
194 
197 
200 
202  std::string myCurrentEdgeID;
203 
204 
205 private:
208 
211 
212 };
213 
214 
215 #endif
216 
217 /****************************************************************************/
218 
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:73
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:64
A storage for options typed value containers)
Definition: OptionsCont.h:90
double myAggValue
aggregated value over the lanes read within the current edge