Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEHierarchicalStructureChildren.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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// Structure for // Structure for GNEHierarchicalElements centered in children
19/****************************************************************************/
20
29
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
37
38// get functions
39
44
45
50
51
56
57
62
63
68
69
74
75
80
81// add functions
82
83template <> void
87
88
89template <> void
93
94
95template <> void
99
100
101template <> void
105
106
107template <> void
111
112
113template <> void
117
118
119template <> void
123
124// remove functions
125
126template <> void
128 auto it = std::find(myChildJunctions.begin(), myChildJunctions.end(), child);
129 if (it != myChildJunctions.end()) {
130 myChildJunctions.erase(it);
131 } else {
132 throw ProcessError(child->getTagStr() + " is not a child element");
133 }
134}
135
136
137template <> void
139 auto it = std::find(myChildEdges.begin(), myChildEdges.end(), child);
140 if (it != myChildEdges.end()) {
141 myChildEdges.erase(it);
142 } else {
143 throw ProcessError(child->getTagStr() + " is not a child element");
144 }
145}
146
147
148template <> void
150 auto it = std::find(myChildLanes.begin(), myChildLanes.end(), child);
151 if (it != myChildLanes.end()) {
152 myChildLanes.erase(it);
153 } else {
154 throw ProcessError(child->getTagStr() + " is not a child element");
155 }
156}
157
158
159template <> void
161 auto it = std::find(myChildAdditionals.begin(), myChildAdditionals.end(), child);
162 if (it != myChildAdditionals.end()) {
163 myChildAdditionals.erase(it);
164 } else {
165 throw ProcessError(child->getTagStr() + " is not a child element");
166 }
167}
168
169
170template <> void
172 auto it = myChildSourceSinks.find(child);
173 if (it != myChildSourceSinks.end()) {
174 myChildSourceSinks.erase(it);
175 } else {
176 throw ProcessError(child->getTagStr() + " is not a child element");
177 }
178}
179
180template <> void
182 auto it = std::find(myChildDemandElements.begin(), myChildDemandElements.end(), child);
183 if (it != myChildDemandElements.end()) {
184 myChildDemandElements.erase(it);
185 } else {
186 throw ProcessError(child->getTagStr() + " is not a child element");
187 }
188}
189
190
191template <> void
193 auto it = std::find(myChildGenericDatas.begin(), myChildGenericDatas.end(), child);
194 if (it != myChildGenericDatas.end()) {
195 myChildGenericDatas.erase(it);
196 } else {
197 throw ProcessError(child->getTagStr() + " is not a child element");
198 }
199}
200
201// replaceAll functions
202
203template <> void
207
208
209template <> void
213
214
215template <> void
219
220
221template <> void
225
226
227template <> void
229 myChildSourceSinks.clear();
230 for (const auto child : children) {
231 myChildSourceSinks.insert(child);
232 }
233}
234
235
236template <> void
240
241
242template <> void
246
247/****************************************************************************/
std::set< ChildType > GNEHierarchicalContainerChildrenSet
std::vector< ChildType > GNEHierarchicalContainerChildren
const std::string & getTagStr() const
get tag assigned to this object in string format
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > myChildSourceSinks
children TAZSourceSinks elements (set)
GNEHierarchicalContainerChildren< GNEJunction * > myChildJunctions
children junctions
GNEHierarchicalContainerChildren< GNEGenericData * > myChildGenericDatas
children genericdata elements
void remove(ChildType child)
remove child element
void add(ChildType child)
add child element
void replaceAll(const GNEHierarchicalContainerChildren< ChildType > &children)
update all children
GNEHierarchicalContainerChildren< GNELane * > myChildLanes
children lanes
GNEHierarchicalContainerChildren< GNEDemandElement * > myChildDemandElements
children demand elements
const GNEHierarchicalContainerChildren< ChildType > & get() const
get children
GNEHierarchicalContainerChildren< GNEEdge * > myChildEdges
children edges
GNEHierarchicalContainerChildren< GNEAdditional * > myChildAdditionals
children additional elements
const GNEHierarchicalContainerChildrenSet< ChildType > & getSet() const
get children (set)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46