/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file DataHandler.h14/// @author Jakob Erdmann15/// @date Jun 202116///17// The XML-Handler for data elements loading18/****************************************************************************/19#pragma once20#include <config.h>2122#include "CommonHandler.h"2324// ===========================================================================25// class definitions26// ===========================================================================27/**28* @class DataHandler29* @brief The XML-Handler for network loading30*31* The SAX2-handler responsible for parsing networks and routes to load.32* This is an extension of the MSRouteHandler as routes and vehicles may also33* be loaded from network descriptions.34*/35class DataHandler : public CommonHandler, private SUMOSAXHandler {3637public:38/**@brief Constructor39* @param[in] bucket FileBucket in which place the element40*/41DataHandler(FileBucket* fileBucket);4243/// @brief Destructor44~DataHandler();4546/// @brief parse47bool parse();4849/// @brief parse SumoBaseObject (it's called recursivelly)50void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject* obj);5152/// @name build functions53/// @{54/**@brief Builds DataInterval55* @param[in] sumoBaseObject sumo base object used for build56* @param[in] dataSetID interval's dataSet57* @param[in] begin interval begin58* @param[in] end interval end59*/60virtual bool buildDataInterval(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& dataSetID,61const double begin, const double end) = 0;6263/**@brief Builds edgeData64* @param[in] sumoBaseObject sumo base object used for build65* @param[in] edgeID edge ID66* @param[in] parameters parameters map67*/68virtual bool buildEdgeData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID,69const Parameterised::Map& parameters) = 0;7071/**@brief Builds edgeRelationData72* @param[in] sumoBaseObject sumo base object used for build73* @param[in] fromEdge edge from74* @param[in] toEdge edge to75* @param[in] parameters parameters map76*/77virtual bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromEdgeID,78const std::string& toEdgeID, const Parameterised::Map& parameters) = 0;7980/**@brief Builds TAZRelationData81* @param[in] sumoBaseObject sumo base object used for build82* @param[in] fromTAZ TAZ from83* @param[in] toTAZ TAZ to84* @param[in] parameters parameters map85*/86virtual bool buildTAZRelationData(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& fromTAZID,87const std::string& toTAZID, const Parameterised::Map& parameters) = 0;88/// @}8990private:91/// @name inherited from GenericSAXHandler92/// @{93/** @brief Called on the opening of a tag;94*95* @param[in] element ID of the currently opened element96* @param[in] attrs Attributes within the currently opened element97* @exception ProcessError If something fails98* @see GenericSAXHandler::myStartElement99* @todo Refactor/describe100*/101virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);102103/** @brief Called when a closing tag occurs104*105* @param[in] element ID of the currently opened element106* @exception ProcessError If something fails107* @see GenericSAXHandler::myEndElement108* @todo Refactor/describe109*/110virtual void myEndElement(int element);111/// @}112113/// @name parse data attributes114/// @{115/// @brief parse interval attributes116void parseInterval(const SUMOSAXAttributes& attrs);117118/// @brief parse edgeData attributes119void parseEdgeData(const SUMOSAXAttributes& attrs);120121/// @brief parse edgeRelationData attributes122void parseEdgeRelationData(const SUMOSAXAttributes& attrs);123124/// @brief parse TAZRelationData attributes125void parseTAZRelationData(const SUMOSAXAttributes& attrs);126/// @}127128/// @brief parse attributes as parameters129void getAttributes(const SUMOSAXAttributes& attrs, const std::vector<SumoXMLAttr> avoidAttributes) const;130131/// @brief check parents132void checkParent(const SumoXMLTag currentTag, const SumoXMLTag parentTag, bool& ok);133134/// @brief invalidate default onstructor135DataHandler() = delete;136137/// @brief invalidate copy constructor138DataHandler(const DataHandler& s) = delete;139140/// @brief invalidate assignment operator141DataHandler& operator=(const DataHandler& s) = delete;142};143144145