111 template<
typename ParentType>
114 parents.push_back(parent);
119 template<
typename ParentType>
125 template<
typename ChildType>
136 template<
typename ElementType,
typename ParentType>
137 static void insertParent(ElementType* element, ParentType* parent,
const int index = -1) {
138 element->myHierarchicalStructureParents.add(parent, index);
139 parent->myHierarchicalStructureChildren.add(element);
143 template<
typename ElementType,
typename ParentType>
145 element->myHierarchicalStructureParents.remove(parent);
146 parent->myHierarchicalStructureChildren.remove(element);
150 template<
typename ElementType,
typename ParentType>
151 static void updateParent(ElementType element,
const int index, ParentType newParent) {
153 auto oldParent = element->myHierarchicalStructureParents.template at<ParentType>(index);
154 oldParent->myHierarchicalStructureChildren.remove(element);
156 element->myHierarchicalStructureParents.replaceSingle(index, newParent);
158 newParent->myHierarchicalStructureChildren.add(element);
162 template<
typename ElementType,
typename ParentType>
165 for (
const auto parent : element->myHierarchicalStructureParents.template get<ParentType>()) {
166 parent->myHierarchicalStructureChildren.remove(element);
169 element->myHierarchicalStructureParents.replaceAll(newParents);
171 for (
const auto parent : element->myHierarchicalStructureParents.template get<ParentType>()) {
172 parent->myHierarchicalStructureChildren.add(element);
177 template<
typename ElementType,
typename ChildType>
179 element->myHierarchicalStructureChildren.add(child);
180 child->myHierarchicalStructureParents.add(element);
184 template<
typename ElementType,
typename ChildType>
186 element->myHierarchicalStructureChildren.remove(child);
187 child->myHierarchicalStructureParents.remove(element);
191 template<
typename ElementType,
typename ChildType>
194 for (
const auto children : element->myHierarchicalStructureChildren.template get<ChildType>()) {
195 children->myHierarchicalStructureParents.remove(element);
198 element->myHierarchicalStructureChildren.replaceAll(newChildren);
200 for (
const auto children : element->myHierarchicalStructureChildren.template get<ChildType>()) {
201 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 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 add(ChildType child)
add child element
Hierarchical structure used for keep parents.
void replaceAll(const GNEHierarchicalContainerParents< ParentType > &newParents)
update all parent element