Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SAXWeightsHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2007-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// An XML-handler for network weights
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <string>
28
29
30// ===========================================================================
31// class definitions
32// ===========================================================================
59public:
65
66 public:
69
72
80 virtual void addEdgeWeight(const std::string& id, double val, double beg, double end) const {
85 }
86
87 virtual void addEdgeRelWeight(const std::string& from, const std::string& to,
88 double val, double beg, double end) const {
89 UNUSED_PARAMETER(from);
94 }
95
97 virtual void addTazRelWeight(const std::string intervalID, const std::string& from, const std::string& to,
98 double val, double beg, double end) {
99 UNUSED_PARAMETER(intervalID);
100 UNUSED_PARAMETER(from);
102 UNUSED_PARAMETER(val);
103 UNUSED_PARAMETER(beg);
104 UNUSED_PARAMETER(end);
105 }
106
107 private:
110 };
111
117 public:
119 ToRetrieveDefinition(const std::string& attributeName, bool edgeBased,
120 EdgeFloatTimeLineRetriever& destination);
121
124
125 public:
127 std::string myAttributeName;
128
131
134
137
140
143
144 private:
147
150 };
151
158 SAXWeightsHandler(const std::vector<ToRetrieveDefinition*>& defs, const std::string& file);
159
165 SAXWeightsHandler(ToRetrieveDefinition* def, const std::string& file);
166
169
170protected:
172
173
181 void myStartElement(int element, const SUMOSAXAttributes& attrs);
182
189 void myEndElement(int elemente);
190
192
193private:
195 void tryParse(const SUMOSAXAttributes& attrs, bool isEdge);
196
198 void tryParseEdgeRel(const SUMOSAXAttributes& attrs);
199
201 void tryParseTazRel(const SUMOSAXAttributes& attrs);
202
204 std::vector<ToRetrieveDefinition*> myDefinitions;
205
207 std::string myCurrentID;
208
211
214
216 std::string myCurrentEdgeID;
217
220
223};
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
Interface for a class which obtains read weights for named edges.
EdgeFloatTimeLineRetriever & operator=(const EdgeFloatTimeLineRetriever &)=delete
we made the assignment operator invalid
virtual void addTazRelWeight(const std::string intervalID, const std::string &from, const std::string &to, double val, double beg, double end)
virtual void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a weight for a given edge and time period.
virtual void addEdgeRelWeight(const std::string &from, const std::string &to, double val, double beg, double end) const
Complete definition about what shall be retrieved and where to store it.
std::string myAttributeName
The attribute name that shall be parsed.
EdgeFloatTimeLineRetriever & myDestination
The class that shall be called when new data is avaiable.
int myNoLanes
The number of lanes read for the current edge.
double myAggValue
Aggregated value over the lanes read within the current edge.
bool myAmEdgeBased
Information whether edge values shall be used (lane value if false)
ToRetrieveDefinition(const ToRetrieveDefinition &)=delete
Invalidated copy constructor.
bool myHadAttribute
Information whether the attribute has been found for the current edge.
ToRetrieveDefinition & operator=(const ToRetrieveDefinition &)=delete
Invalidated assignment operator.
An XML-handler for network weights.
SAXWeightsHandler(const SAXWeightsHandler &src)=delete
we made the copy constructor invalid
double myCurrentTimeEnd
the end of the time period that is currently processed
double myCurrentTimeBeg
the begin of the time period that is currently processed
void myEndElement(int elemente)
Called when a closing tag occurs.
SAXWeightsHandler & operator=(const SAXWeightsHandler &src)=delete
we made the assignment operator invalid
void tryParseTazRel(const SUMOSAXAttributes &attrs)
Parses the data of an tazRelation for the previously read times.
~SAXWeightsHandler()
Destructor.
void tryParseEdgeRel(const SUMOSAXAttributes &attrs)
Parses the data of an edgeRelation for the previously read times.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the data of an edge or lane for the previously read times.
std::string myCurrentEdgeID
the edge which is currently being processed
std::string myCurrentID
the id of the interval being parsed
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.