12 #ifndef __ND_NODE_HIERARCHY_H__
13 #define __ND_NODE_HIERARCHY_H__
15 #include "ndCoreStdafx.h"
16 #include "ndContainersAlloc.h"
23 virtual T* CreateClone()
const;
29 T* GetLastChild()
const;
30 T* GetFirstChild()
const;
36 T* IteratorFirst()
const;
37 T* IteratorNext()
const;
57 ,m_firstChild(nullptr)
68 ,m_firstChild(nullptr)
72 T*
const child = obj->CreateClone();
89 m_next->m_prev =
nullptr;
91 m_parent->m_firstChild = m_next;
94 m_parent->m_lastChild =
nullptr;
99 m_next->m_prev =
nullptr;
103 ndAssert(!m_lastChild);
104 ndAssert(!m_firstChild);
120 if (m_parent->m_firstChild)
123 m_prev = m_parent->m_lastChild;
124 m_parent->m_lastChild->m_next =
this;
128 m_parent->m_firstChild =
this;
130 m_parent->m_lastChild =
this;
143 return (T*)m_firstChild;
149 return (T*)m_lastChild;
167 return (T*) m_parent;
174 for (; root->m_parent; root = root->m_parent);
182 for (; ptr->m_firstChild; ptr = ptr->m_firstChild);
191 return m_next->IteratorFirst();
196 for (; ptr && (x == ptr->m_next); ptr = ptr->m_parent)