Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
DataHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-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/****************************************************************************/
18// The XML-Handler for data elements loading
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "CommonHandler.h"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
36class DataHandler : public CommonHandler, private SUMOSAXHandler {
37
38public:
42 DataHandler(const std::string& file);
43
46
48 bool parse();
49
52
54 virtual bool postParserTasks() = 0;
55
58
64 virtual bool buildDataInterval(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& dataSetID,
65 const double begin, const double end) = 0;
66
72 virtual bool buildEdgeData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID,
73 const Parameterised::Map& parameters) = 0;
74
81 virtual bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromEdgeID,
82 const std::string& toEdgeID, const Parameterised::Map& parameters) = 0;
83
90 virtual bool buildTAZRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromTAZID,
91 const std::string& toTAZID, const Parameterised::Map& parameters) = 0;
93
94private:
97
105 virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);
106
114 virtual void myEndElement(int element);
116
120 void parseInterval(const SUMOSAXAttributes& attrs);
121
123 void parseEdgeData(const SUMOSAXAttributes& attrs);
124
126 void parseEdgeRelationData(const SUMOSAXAttributes& attrs);
127
129 void parseTAZRelationData(const SUMOSAXAttributes& attrs);
131
133 void getAttributes(const SUMOSAXAttributes& attrs, const std::vector<SumoXMLAttr> avoidAttributes) const;
134
136 void checkParent(const SumoXMLTag currentTag, const SumoXMLTag parentTag, bool& ok);
137
139 DataHandler(const DataHandler& s) = delete;
140
142 DataHandler& operator=(const DataHandler& s) = delete;
143};
SumoXMLTag
Numbers representing SUMO-XML - element names.
The XML-Handler for network loading.
The XML-Handler for network loading.
Definition DataHandler.h:36
virtual bool buildDataInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &dataSetID, const double begin, const double end)=0
Builds DataInterval.
void parseTAZRelationData(const SUMOSAXAttributes &attrs)
parse TAZRelationData attributes
~DataHandler()
Destructor.
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
bool parse()
parse
void parseEdgeRelationData(const SUMOSAXAttributes &attrs)
parse edgeRelationData attributes
virtual void myEndElement(int element)
Called when a closing tag occurs.
DataHandler(const DataHandler &s)=delete
invalidate copy constructor
void checkParent(const SumoXMLTag currentTag, const SumoXMLTag parentTag, bool &ok)
check parents
void parseEdgeData(const SUMOSAXAttributes &attrs)
parse edgeData attributes
virtual bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &fromEdgeID, const std::string &toEdgeID, const Parameterised::Map &parameters)=0
Builds edgeRelationData.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
virtual bool buildEdgeData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const Parameterised::Map &parameters)=0
Builds edgeData.
void getAttributes(const SUMOSAXAttributes &attrs, const std::vector< SumoXMLAttr > avoidAttributes) const
parse attributes as parameters
virtual bool buildTAZRelationData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &fromTAZID, const std::string &toTAZID, const Parameterised::Map &parameters)=0
Builds TAZRelationData.
DataHandler & operator=(const DataHandler &s)=delete
invalidate assignment operator
void parseInterval(const SUMOSAXAttributes &attrs)
virtual bool postParserTasks()=0
run post parser tasks
std::map< std::string, std::string > Map
parameters map
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.