Path: blob/main/src/netedit/elements/GNEHierarchicalStructureParents.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 GNEHierarchicalStructureParents.h14/// @author Pablo Alvarez Lopez15/// @date Feb 202516///17// Structure for GNEHierarchicalElements centered in parents18/****************************************************************************/19#pragma once20#include <config.h>2122#include <vector>2324// ===========================================================================25// template declarations26// ===========================================================================2728template <typename ParentType>29using GNEHierarchicalContainerParents = std::vector<ParentType>;3031// ===========================================================================32// class declarations33// ===========================================================================3435class GNENetworkElement;36class GNEJunction;37class GNEEdge;38class GNELane;39class GNEAdditional;40class GNETAZSourceSink;41class GNEDemandElement;42class GNEGenericData;43class GNEHierarchicalElement;4445// ===========================================================================46// class definitions47// ===========================================================================4849/// @brief Hierarchical structure used for keep parents50class GNEHierarchicalStructureParents {5152public:53/// @brief default constructor54GNEHierarchicalStructureParents();5556/// @brief clear container57void clear();5859/// @brief get parents60template<typename ParentType>61const GNEHierarchicalContainerParents<ParentType>& get() const;6263/// @brief get parent at the given position64template<typename ParentType>65ParentType at(const int index) const;6667/**@brief add parent element68* @param parent new parent element to be inserted69* @param index position (-1 means push back)70*/71template<typename ParentType>72void add(ParentType parent, const int index = -1);7374/// @brief remove parent element75template<typename ParentType>76void remove(ParentType parent);7778/**@brief update single parent element79* @param index position80* @param parent new parent element to be updated81*/82template<typename ParentType>83void replaceSingle(const int index, ParentType newParent);8485/// @brief update all parent element86template<typename ParentType>87void replaceAll(const GNEHierarchicalContainerParents<ParentType>& newParents);8889private:90/// @brief parents junctions91GNEHierarchicalContainerParents<GNEJunction*> myParentJunctions;9293/// @brief parents edges94GNEHierarchicalContainerParents<GNEEdge*> myParentEdges;9596/// @brief parents lanes97GNEHierarchicalContainerParents<GNELane*> myParentLanes;9899/// @brief parents additionals100GNEHierarchicalContainerParents<GNEAdditional*> myParentAdditionals;101102/// @brief parents TAZSourceSinks (Unused, but needed for function addElementInParentsAndChildren)103GNEHierarchicalContainerParents<GNETAZSourceSink*> myParentTAZSourceSinks;104105/// @brief parents demand elements106GNEHierarchicalContainerParents<GNEDemandElement*> myParentDemandElements;107108/// @brief parents generic datas109GNEHierarchicalContainerParents<GNEGenericData*> myParentGenericDatas;110};111112113