111 template<
typename ParentType>
114 parents.push_back(parent);
119 template<
typename ParentType>
125 template<
typename ChildType>
131 template<
typename ChildType>
134 for (
auto child : sortedChildrens) {
137 for (
auto child : sortedChildrens) {
148 template<
typename ElementType,
typename ParentType>
149 static void insertParent(ElementType* element, ParentType* parent,
const int index = -1) {
150 element->myHierarchicalStructureParents.add(parent, index);
151 parent->myHierarchicalStructureChildren.add(element);
155 template<
typename ElementType,
typename ParentType>
157 element->myHierarchicalStructureParents.remove(parent);
158 parent->myHierarchicalStructureChildren.remove(element);
162 template<
typename ElementType,
typename ParentType>
163 static void updateParent(ElementType element,
const int index, ParentType newParent) {
165 auto oldParent = element->myHierarchicalStructureParents.template at<ParentType>(index);
167 oldParent->myHierarchicalStructureChildren.remove(element);
170 element->myHierarchicalStructureParents.replaceSingle(index, newParent);
173 newParent->myHierarchicalStructureChildren.add(element);
178 template<
typename ElementType,
typename ParentType>
181 for (
const auto parent : element->myHierarchicalStructureParents.template get<ParentType>()) {
183 parent->myHierarchicalStructureChildren.remove(element);
187 element->myHierarchicalStructureParents.replaceAll(newParents);
189 for (
const auto parent : element->myHierarchicalStructureParents.template get<ParentType>()) {
191 parent->myHierarchicalStructureChildren.add(element);
197 template<
typename ElementType,
typename ChildType>
200 element->myHierarchicalStructureChildren.add(child);
203 child->myHierarchicalStructureParents.add(element);
208 template<
typename ElementType,
typename ChildType>
211 element->myHierarchicalStructureChildren.remove(child);
214 child->myHierarchicalStructureParents.remove(element);
219 template<
typename ElementType,
typename ChildType>
222 for (
const auto children : element->myHierarchicalStructureChildren.template get<ChildType>()) {
224 children->myHierarchicalStructureParents.remove(element);
228 element->myHierarchicalStructureChildren.replaceAll(newChildren);
230 for (
const auto children : element->myHierarchicalStructureChildren.template get<ChildType>()) {
232 children->myHierarchicalStructureParents.add(element);
std::set< ChildType > GNEHierarchicalContainerChildrenSet
std::vector< ChildType > GNEHierarchicalContainerChildren
std::vector< ParentType > GNEHierarchicalContainerParents
const GNEHierarchicalContainerChildren< GNEEdge * > & getChildEdges() const
get child edges
GNEHierarchicalStructureChildren myHierarchicalStructureChildren
hierarchical structure with children
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
static void updateChildren(ElementType element, GNEHierarchicalContainerChildren< ChildType > newChildren)
update all children elements
GNEHierarchicalElement()
default Constructor
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerParents< GNEGenericData * > & getParentGenericDatas() const
get parent demand elements
static void insertChild(ElementType element, ChildType child)
insert child element
~GNEHierarchicalElement()
Destructor.
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
void sortChildren(std::vector< ChildType * > sortedChildrens)
Sort childrens.
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
const GNEHierarchicalStructureChildren & getChildren() const
get child container
const GNEHierarchicalContainerChildren< GNEJunction * > & getChildJunctions() const
get child junctions
GNEHierarchicalStructureParents myHierarchicalStructureParents
hierarchical structure with parents
void setParent(ParentType parent)
edit parent and childrens without maintain integrity (use carefully)
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
static void removeChild(ElementType element, ChildType child)
remove child element
static void insertParent(ElementType *element, ParentType *parent, const int index=-1)
insert parent element
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
const GNEHierarchicalContainerParents< GNEAdditional * > getParentStoppingPlaces() const
get parent stoppingPlaces (used by plans)
const GNEHierarchicalStructureParents & getParents() const
get parents container
static void updateParent(ElementType element, const int index, ParentType newParent)
update single parent element
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
GNEHierarchicalElement(const GNEHierarchicalElement &)=delete
Invalidated copy constructor.
void clearParents()
clear hierarchical structure parents (used in GNE_Change)
static void removeParent(ElementType *element, ParentType *parent)
remove parent element
static void updateParents(ElementType element, GNEHierarchicalContainerParents< ParentType > newParents)
update all parent elements
void setParents(const GNEHierarchicalContainerParents< ParentType > &parents)
set multiple parent element (ONLY use in constructors)
const GNEHierarchicalContainerParents< GNEAdditional * > getParentTAZs() const
get parent TAZs (used by plans)
Hierarchical structure used for keep children.
void remove(ChildType child)
remove child element
void add(ChildType child)
add child element
Hierarchical structure used for keep parents.
void replaceAll(const GNEHierarchicalContainerParents< ParentType > &newParents)
update all parent element