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 /****************************************************************************/
16 // An XML-handler for network weights
17 /****************************************************************************/
18 #ifndef SAXWeightsHandler_h
19 #define SAXWeightsHandler_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
29 #include <utils/common/SUMOTime.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class OptionsCont;
36 class RONet;
37 class ROEdge;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
69 public:
75  public:
78 
81 
89  virtual void addEdgeWeight(const std::string& id,
90  double val, double beg, double end) const = 0;
91 
92  private:
93  EdgeFloatTimeLineRetriever& operator=(const EdgeFloatTimeLineRetriever&); // just to avoid a compiler warning
94  };
95 
101  public:
103  ToRetrieveDefinition(const std::string& attributeName, bool edgeBased,
104  EdgeFloatTimeLineRetriever& destination);
105 
108 
109  public:
111  std::string myAttributeName;
112 
115 
118 
120  double myAggValue;
121 
124 
127 
128  private:
131 
134 
135  };
136 
143  SAXWeightsHandler(const std::vector<ToRetrieveDefinition*>& defs,
144  const std::string& file);
145 
146 
153  const std::string& file);
154 
155 
158 
159 
160 protected:
162 
163 
171  void myStartElement(int element,
172  const SUMOSAXAttributes& attrs);
173 
174 
181  void myEndElement(int elemente);
183 
184 
185 private:
187  void tryParse(const SUMOSAXAttributes& attrs, bool isEdge);
188 
189 
190 private:
192  std::vector<ToRetrieveDefinition*> myDefinitions;
193 
196 
199 
201  std::string myCurrentEdgeID;
202 
203 
204 private:
207 
210 
211 };
212 
213 
214 #endif
215 
216 /****************************************************************************/
217 
SUMOTime.h
SAXWeightsHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: SAXWeightsHandler.cpp:76
SAXWeightsHandler::ToRetrieveDefinition::myAggValue
double myAggValue
aggregated value over the lanes read within the current edge
Definition: SAXWeightsHandler.h:120
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
SAXWeightsHandler::EdgeFloatTimeLineRetriever::EdgeFloatTimeLineRetriever
EdgeFloatTimeLineRetriever()
Constructor.
Definition: SAXWeightsHandler.h:77
SAXWeightsHandler::ToRetrieveDefinition::~ToRetrieveDefinition
~ToRetrieveDefinition()
Destructor.
Definition: SAXWeightsHandler.cpp:47
SUMOSAXHandler.h
SAXWeightsHandler::ToRetrieveDefinition::myNoLanes
int myNoLanes
The number of lanes read for the current edge.
Definition: SAXWeightsHandler.h:123
RONet
The router's network representation.
Definition: RONet.h:63
SAXWeightsHandler::ToRetrieveDefinition::myHadAttribute
bool myHadAttribute
Information whether the attribute has been found for the current edge.
Definition: SAXWeightsHandler.h:126
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:68
SAXWeightsHandler::myCurrentEdgeID
std::string myCurrentEdgeID
the edge which is currently being processed
Definition: SAXWeightsHandler.h:201
SAXWeightsHandler::operator=
SAXWeightsHandler & operator=(const SAXWeightsHandler &src)
we made the assignment operator invalid
SAXWeightsHandler::SAXWeightsHandler
SAXWeightsHandler(const SAXWeightsHandler &src)
we made the copy constructor invalid
SAXWeightsHandler::ToRetrieveDefinition
Complete definition about what shall be retrieved and where to store it.
Definition: SAXWeightsHandler.h:100
SAXWeightsHandler::ToRetrieveDefinition::myAmEdgeBased
bool myAmEdgeBased
Information whether edge values shall be used (lane value if false)
Definition: SAXWeightsHandler.h:114
SAXWeightsHandler::ToRetrieveDefinition::myDestination
EdgeFloatTimeLineRetriever & myDestination
The class that shall be called when new data is avaiable.
Definition: SAXWeightsHandler.h:117
SAXWeightsHandler::tryParse
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the efforts of a lane for the previously read times.
Definition: SAXWeightsHandler.cpp:102
SAXWeightsHandler::myCurrentTimeEnd
double myCurrentTimeEnd
the end of the time period that is currently processed
Definition: SAXWeightsHandler.h:198
SAXWeightsHandler::ToRetrieveDefinition::ToRetrieveDefinition
ToRetrieveDefinition(const std::string &attributeName, bool edgeBased, EdgeFloatTimeLineRetriever &destination)
Constructor.
Definition: SAXWeightsHandler.cpp:41
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
SAXWeightsHandler::ToRetrieveDefinition::ToRetrieveDefinition
ToRetrieveDefinition(const ToRetrieveDefinition &)
Invalidated copy constructor.
SAXWeightsHandler::SAXWeightsHandler
SAXWeightsHandler(const std::vector< ToRetrieveDefinition * > &defs, const std::string &file)
Constructor.
Definition: SAXWeightsHandler.cpp:54
SAXWeightsHandler::ToRetrieveDefinition::myAttributeName
std::string myAttributeName
The attribute name that shall be parsed.
Definition: SAXWeightsHandler.h:111
SAXWeightsHandler::myDefinitions
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file.
Definition: SAXWeightsHandler.h:192
SAXWeightsHandler::EdgeFloatTimeLineRetriever::~EdgeFloatTimeLineRetriever
virtual ~EdgeFloatTimeLineRetriever()
Destructor.
Definition: SAXWeightsHandler.h:80
SAXWeightsHandler::myEndElement
void myEndElement(int elemente)
Called when a closing tag occurs.
Definition: SAXWeightsHandler.cpp:141
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
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:195
SAXWeightsHandler
An XML-handler for network weights.
Definition: SAXWeightsHandler.h:68
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
SAXWeightsHandler::EdgeFloatTimeLineRetriever
Interface for a class which obtains read weights for named edges.
Definition: SAXWeightsHandler.h:74
SAXWeightsHandler::ToRetrieveDefinition::operator=
ToRetrieveDefinition & operator=(const ToRetrieveDefinition &)
Invalidated assignment operator.