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 
SUMOTime.h
SAXWeightsHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: SAXWeightsHandler.cpp:77
SAXWeightsHandler::ToRetrieveDefinition::myAggValue
double myAggValue
aggregated value over the lanes read within the current edge
Definition: SAXWeightsHandler.h:121
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:42
SAXWeightsHandler::EdgeFloatTimeLineRetriever::EdgeFloatTimeLineRetriever
EdgeFloatTimeLineRetriever()
Constructor.
Definition: SAXWeightsHandler.h:78
SAXWeightsHandler::ToRetrieveDefinition::~ToRetrieveDefinition
~ToRetrieveDefinition()
Destructor.
Definition: SAXWeightsHandler.cpp:48
SUMOSAXHandler.h
SAXWeightsHandler::ToRetrieveDefinition::myNoLanes
int myNoLanes
The number of lanes read for the current edge.
Definition: SAXWeightsHandler.h:124
RONet
The router's network representation.
Definition: RONet.h:64
SAXWeightsHandler::ToRetrieveDefinition::myHadAttribute
bool myHadAttribute
Information whether the attribute has been found for the current edge.
Definition: SAXWeightsHandler.h:127
SAXWeightsHandler::EdgeFloatTimeLineRetriever::addEdgeWeight
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.
SAXWeightsHandler::~SAXWeightsHandler
~SAXWeightsHandler()
Destructor.
Definition: SAXWeightsHandler.cpp:69
SAXWeightsHandler::myCurrentEdgeID
std::string myCurrentEdgeID
the edge which is currently being processed
Definition: SAXWeightsHandler.h:202
SAXWeightsHandler::operator=
SAXWeightsHandler & operator=(const SAXWeightsHandler &src)
we made the assignment operator invalid
SAXWeightsHandler::ToRetrieveDefinition
Complete definition about what shall be retrieved and where to store it.
Definition: SAXWeightsHandler.h:101
SAXWeightsHandler::ToRetrieveDefinition::myAmEdgeBased
bool myAmEdgeBased
Information whether edge values shall be used (lane value if false)
Definition: SAXWeightsHandler.h:115
SAXWeightsHandler::ToRetrieveDefinition::myDestination
EdgeFloatTimeLineRetriever & myDestination
The class that shall be called when new data is avaiable.
Definition: SAXWeightsHandler.h:118
SAXWeightsHandler::tryParse
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the efforts of a lane for the previously read times.
Definition: SAXWeightsHandler.cpp:103
SAXWeightsHandler::myCurrentTimeEnd
double myCurrentTimeEnd
the end of the time period that is currently processed
Definition: SAXWeightsHandler.h:199
SAXWeightsHandler::ToRetrieveDefinition::ToRetrieveDefinition
ToRetrieveDefinition(const std::string &attributeName, bool edgeBased, EdgeFloatTimeLineRetriever &destination)
Constructor.
Definition: SAXWeightsHandler.cpp:42
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
SAXWeightsHandler::SAXWeightsHandler
SAXWeightsHandler(const std::vector< ToRetrieveDefinition * > &defs, const std::string &file)
Constructor.
Definition: SAXWeightsHandler.cpp:55
SAXWeightsHandler::ToRetrieveDefinition::myAttributeName
std::string myAttributeName
The attribute name that shall be parsed.
Definition: SAXWeightsHandler.h:112
SAXWeightsHandler::myDefinitions
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file.
Definition: SAXWeightsHandler.h:193
SAXWeightsHandler::EdgeFloatTimeLineRetriever::~EdgeFloatTimeLineRetriever
virtual ~EdgeFloatTimeLineRetriever()
Destructor.
Definition: SAXWeightsHandler.h:81
SAXWeightsHandler::myEndElement
void myEndElement(int elemente)
Called when a closing tag occurs.
Definition: SAXWeightsHandler.cpp:142
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:73
config.h
SAXWeightsHandler::EdgeFloatTimeLineRetriever::operator=
EdgeFloatTimeLineRetriever & operator=(const EdgeFloatTimeLineRetriever &)
SAXWeightsHandler::myCurrentTimeBeg
double myCurrentTimeBeg
the begin of the time period that is currently processed
Definition: SAXWeightsHandler.h:196
SAXWeightsHandler
An XML-handler for network weights.
Definition: SAXWeightsHandler.h:69
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
SAXWeightsHandler::EdgeFloatTimeLineRetriever
Interface for a class which obtains read weights for named edges.
Definition: SAXWeightsHandler.h:75
SAXWeightsHandler::ToRetrieveDefinition::operator=
ToRetrieveDefinition & operator=(const ToRetrieveDefinition &)
Invalidated assignment operator.