Eclipse SUMO - Simulation of Urban MObility
GNEHierarchicalContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 
28 class GNENetworkElement;
29 class GNEJunction;
30 class GNEEdge;
31 class GNELane;
32 class GNEAdditional;
33 class GNEShape;
34 class GNETAZElement;
35 class GNEDemandElement;
36 class GNEGenericData;
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
42 
45 
46 public:
49 
52  const std::vector<GNEJunction*>& parentJunctions,
53  const std::vector<GNEEdge*>& parentEdges,
54  const std::vector<GNELane*>& parentLanes,
55  const std::vector<GNEAdditional*>& parentAdditionals,
56  const std::vector<GNEShape*>& parentShapes,
57  const std::vector<GNETAZElement*>& parentTAZElements,
58  const std::vector<GNEDemandElement*>& ParentDemandElements,
59  const std::vector<GNEGenericData*>& parentGenericDatas);
60 
62  size_t getContainerSize() const;
63 
65  template<typename T>
66  void addParentElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
67 
69  template<typename T>
70  void removeParentElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
71 
73  template<typename T>
74  void addChildElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
75 
77  template<typename T>
78  void removeChildElement(const GNEHierarchicalElement* hierarchicalElement, T* element);
79 
81  template<typename T>
82  const T& getParents() const;
83 
85  template<typename T>
86  void setParents(const T& newParents);
87 
89  template<typename T>
90  const T& getChildren() const;
91 
93  template<typename T>
94  void setChildren(const T& newChildren);
95 
96 private:
98  std::vector<GNEJunction*> myParentJunctions;
99 
101  std::vector<GNEEdge*> myParentEdges;
102 
104  std::vector<GNELane*> myParentLanes;
105 
107  std::vector<GNEAdditional*> myParentAdditionals;
108 
110  std::vector<GNEShape*> myParentShapes;
111 
113  std::vector<GNETAZElement*> myParentTAZElements;
114 
116  std::vector<GNEDemandElement*> myParentDemandElements;
117 
119  std::vector<GNEGenericData*> myParentGenericDatas;
120 
122  std::vector<GNEJunction*> myChildJunctions;
123 
125  std::vector<GNEEdge*> myChildEdges;
126 
128  std::vector<GNELane*> myChildLanes;
129 
131  std::vector<GNEAdditional*> myChildAdditionals;
132 
134  std::vector<GNEShape*> myChildShapes;
135 
137  std::vector<GNETAZElement*> myChildTAZElements;
138 
140  std::vector<GNEDemandElement*> myChildDemandElements;
141 
143  std::vector<GNEGenericData*> myChildGenericDatas;
144 
146  static const bool checkContainer;
147 };
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
An Element which don't belongs to GNENet but has influency 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 & getParents() const
get parents
std::vector< GNEEdge * > myParentEdges
vector of parent edges
void addChildElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
add child element
std::vector< GNETAZElement * > myParentTAZElements
vector of parent TAZElements
std::vector< GNEJunction * > myChildJunctions
vector with the child junctions
const T & getChildren() const
get children
void removeParentElement(const GNEHierarchicalElement *hierarchicalElement, T *element)
remove parent element
std::vector< GNEJunction * > myParentJunctions
vector of parent junctions
std::vector< GNEShape * > myParentShapes
vector of parent shapes
std::vector< GNEAdditional * > myParentAdditionals
vector of parent additionals
std::vector< GNEGenericData * > myParentGenericDatas
vector of parent generic datas
std::vector< GNETAZElement * > myChildTAZElements
vector with the child TAZ Elements
std::vector< GNEShape * > myChildShapes
vector with the child lanes
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
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
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45