Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEHierarchicalContainer.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// Container for GNEHierarchicalElements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23
24// ===========================================================================
25// class declarations
26// ===========================================================================
27
29class GNEJunction;
30class GNEEdge;
31class GNELane;
32class GNEAdditional;
34class GNEGenericData;
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
40
43
44public:
47
50 const std::vector<GNEJunction*>& parentJunctions,
51 const std::vector<GNEEdge*>& parentEdges,
52 const std::vector<GNELane*>& parentLanes,
53 const std::vector<GNEAdditional*>& parentAdditionals,
54 const std::vector<GNEDemandElement*>& ParentDemandElements,
55 const std::vector<GNEGenericData*>& parentGenericDatas);
56
58 size_t getContainerSize() const;
59
61 template<typename T>
62 void addParentElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
63
65 template<typename T>
66 void removeParentElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
67
69 template<typename T>
70 void addChildElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
71
73 template<typename T>
74 void removeChildElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
75
77 template<typename T>
78 const T& getParents() const;
79
81 template<typename T>
82 void setParents(const T& newParents);
83
85 template<typename T>
86 const T& getChildren() const;
87
89 template<typename T>
90 void setChildren(const T& newChildren);
91
92private:
94 std::vector<GNEJunction*> myParentJunctions;
95
97 std::vector<GNEEdge*> myParentEdges;
98
100 std::vector<GNELane*> myParentLanes;
101
103 std::vector<GNEAdditional*> myParentAdditionals;
104
106 std::vector<GNEDemandElement*> myParentDemandElements;
107
109 std::vector<GNEGenericData*> myParentGenericDatas;
110
112 std::vector<GNEJunction*> myChildJunctions;
113
115 std::vector<GNEEdge*> myChildEdges;
116
118 std::vector<GNELane*> myChildLanes;
119
121 std::vector<GNEAdditional*> myChildAdditionals;
122
124 std::vector<GNEDemandElement*> myChildDemandElements;
125
127 std::vector<GNEGenericData*> myChildGenericDatas;
128
130 static const bool checkContainer;
131};
An Element which don't belong to GNENet but has influence in the simulation.
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
An Element which don't belong to GNENet but has influence in the simulation.
Hierarchical container (used for keep myParent and myChildren.
std::vector< GNEEdge * > myChildEdges
vector with the child edges
std::vector< GNEDemandElement * > myChildDemandElements
vector with the child demand elements
std::vector< GNEDemandElement * > myParentDemandElements
vector of parent demand elements
GNEHierarchicalContainer()
default constructor
std::vector< GNELane * > myParentLanes
vector of parent lanes
void addParentElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
add parent element
size_t getContainerSize() const
get container size
std::vector< GNEAdditional * > myChildAdditionals
vector with the child additional
const T & getChildren() const
get children
std::vector< GNEEdge * > myParentEdges
vector of parent edges
void addChildElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
add child element
std::vector< GNEJunction * > myChildJunctions
vector with the child junctions
void removeParentElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
remove parent element
std::vector< GNEJunction * > myParentJunctions
vector of parent junctions
std::vector< GNEAdditional * > myParentAdditionals
vector of parent additionals
std::vector< GNEGenericData * > myParentGenericDatas
vector of parent generic datas
static const bool checkContainer
flag for enable/disable check duplicate elements (only used for debug purposes)
std::vector< GNEGenericData * > myChildGenericDatas
vector with the generic child data elements
void setChildren(const T &newChildren)
set children
void setParents(const T &newParents)
set parents
void removeChildElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
remove child element
const T & getParents() const
get parents
std::vector< GNELane * > myChildLanes
vector with the child lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46