Path: blob/main/src/netedit/elements/GNEGeneralHandler.h
169678 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 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 GNEGeneralHandler.h14/// @author Pablo Alvarez Lopez15/// @date Sep 202116///17// General element handler for netedit18/****************************************************************************/19#pragma once20#include <config.h>212223// ===========================================================================24// included modules25// ===========================================================================2627#include <utils/handlers/GeneralHandler.h>28#include <netedit/elements/additional/GNEAdditionalHandler.h>29#include <netedit/elements/demand/GNERouteHandler.h>30#include <netedit/elements/data/GNEMeanDataHandler.h>3132// ===========================================================================33// class declarations34// ===========================================================================35class GNENet;3637// ===========================================================================38// class definitions39// ===========================================================================4041class GNEGeneralHandler : public GeneralHandler {4243public:44/**@brief Constructor45* @param[in] net GNENet46* @param[in] file Name of the parsed file47* @param[in] allowUndoRedo enable or disable undoRedo48*/49GNEGeneralHandler(GNENet* net, const std::string& file, const bool allowUndoRedo);5051/// @brief Destructor52~GNEGeneralHandler();5354/// @brief force overwritte elements (used if we're reloading elements)55void forceOverwriteElements();5657/// @brief run post parser tasks58bool postParserTasks();5960/// @brief get flag for check if a element wasn't created61bool isErrorCreatingElement() const;6263/// @brief check if the parser file is a additional file64bool isAdditionalFile() const;6566/// @brief check if the parser file is a route file67bool isRouteFile() const;6869/// @brief check if the parser file is a meanData file70bool isMeanDataFile() const;7172private:73/// @brief tagType74struct TagType {7576enum class Type {77NONE,78NETWORK,79ADDITIONAL,80DEMAND,81DATA,82MEANDATA,83};8485/// @brief constructor86TagType(SumoXMLTag tag, Type type);8788/// @brief is network element89bool isNetwork() const;9091/// @brief is network element92bool isAdditional() const;9394/// @brief is network element95bool isDemand() const;9697/// @brief is network element98bool isData() const;99100/// @brief is network element101bool isMeanData() const;102103/// @brief tag related with this TagType104const SumoXMLTag tag;105106private:107/// @brief tag type108const Type myType;109};110111/// @brief queue with the inserted tags112std::list<TagType> myQueue;113114/// @brief additional handler115GNEAdditionalHandler myAdditionalHandler;116117/// @brief demand handler118GNERouteHandler myDemandHandler;119120/// @brief meanData handler121GNEMeanDataHandler myMeanDataHandler;122123/// @brief flag for set file type124TagType::Type fileType = TagType::Type::NONE;125126/// @brief start element127void beginTag(SumoXMLTag tag, const SUMOSAXAttributes& attrs);128129/// @brief end element130void endTag();131132/// @brief invalidate copy constructor133GNEGeneralHandler(const GNEGeneralHandler& s) = delete;134135/// @brief invalidate assignment operator136GNEGeneralHandler& operator=(const GNEGeneralHandler& s) = delete;137};138139/****************************************************************************/140141142