1 // File: SALOMEDSImpl_ChildNodeIterator.cxx
2 // Created: Wed Jan 26 16:43:08 2000
3 // Author: Denis PASCAL
4 // <dp@dingox.paris1.matra-dtv.fr>
7 #include <SALOMEDSImpl_ChildNodeIterator.hxx>
9 #define ChildNodeIterator_UpToBrother \
11 while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
12 myNode = myNode->myFather; \
13 if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
14 myNode = myNode->myNext; \
19 //=======================================================================
20 //function : SALOMEDSImpl_ChildNodeIterator
22 //=======================================================================
23 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator()
27 //=======================================================================
28 //function : SALOMEDSImpl_ChildNodeIterator
30 //=======================================================================
32 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
33 const Standard_Boolean allLevels)
34 : myNode(aNode->myFirst),
35 myFirstLevel(allLevels ? aNode->Depth() : -1)
38 //=======================================================================
39 //function : Initialize
41 //=======================================================================
43 void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
44 const Standard_Boolean allLevels)
46 myNode = aNode->myFirst;
47 myFirstLevel = allLevels ? aNode->Depth() : -1;
50 //=======================================================================
53 //=======================================================================
55 void SALOMEDSImpl_ChildNodeIterator::Next()
57 if (myFirstLevel == -1) {
58 myNode = myNode->myNext;
61 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
62 else ChildNodeIterator_UpToBrother;
66 //=======================================================================
67 //function : NextBrother
69 //=======================================================================
71 void SALOMEDSImpl_ChildNodeIterator::NextBrother()
73 if (myNode->myNext != NULL) myNode = myNode->myNext;
74 else ChildNodeIterator_UpToBrother;