SUMO - Simulation of Urban MObility
SAXWeightsHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // An XML-handler for network weights
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2007-2017 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 SAXWeightsHandler_h
23 #define SAXWeightsHandler_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 <utils/common/SUMOTime.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class OptionsCont;
44 class RONet;
45 class ROEdge;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
77 public:
83  public:
86 
89 
97  virtual void addEdgeWeight(const std::string& id,
98  double val, double beg, double end) const = 0;
99 
100  private:
101  EdgeFloatTimeLineRetriever& operator=(const EdgeFloatTimeLineRetriever&); // just to avoid a compiler warning
102  };
103 
109  public:
111  ToRetrieveDefinition(const std::string& attributeName, bool edgeBased,
112  EdgeFloatTimeLineRetriever& destination);
113 
116 
117  public:
119  std::string myAttributeName;
120 
123 
126 
128  double myAggValue;
129 
132 
135 
136  private:
139 
142 
143  };
144 
151  SAXWeightsHandler(const std::vector<ToRetrieveDefinition*>& defs,
152  const std::string& file);
153 
154 
161  const std::string& file);
162 
163 
166 
167 
168 protected:
170 
171 
179  void myStartElement(int element,
180  const SUMOSAXAttributes& attrs);
181 
182 
189  void myEndElement(int elemente);
191 
192 
193 private:
195  void tryParse(const SUMOSAXAttributes& attrs, bool isEdge);
196 
197 
198 private:
200  std::vector<ToRetrieveDefinition*> myDefinitions;
201 
204 
207 
209  std::string myCurrentEdgeID;
210 
211 
212 private:
215 
218 
219 };
220 
221 
222 #endif
223 
224 /****************************************************************************/
225 
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:76
A storage for options typed value containers)
Definition: OptionsCont.h:99
double myAggValue
aggregated value over the lanes read within the current edge