1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: SALOMEDSImpl_ChildNodeIterator.cxx
23 // Created: Wed Jan 26 16:43:08 2000
24 // Author: Denis PASCAL
25 // <dp@dingox.paris1.matra-dtv.fr>
27 #include "SALOMEDSImpl_ChildNodeIterator.hxx"
29 #define ChildNodeIterator_UpToBrother \
31 while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
32 myNode = myNode->myFather; \
33 if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
34 myNode = myNode->myNext; \
39 //=======================================================================
40 //function : SALOMEDSImpl_ChildNodeIterator
42 //=======================================================================
43 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator()
47 //=======================================================================
48 //function : SALOMEDSImpl_ChildNodeIterator
50 //=======================================================================
52 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode,
54 : myNode(aNode->myFirst),
55 myFirstLevel(allLevels ? aNode->Depth() : -1)
58 //=======================================================================
59 //function : Initialize
61 //=======================================================================
63 void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode,
66 myNode = aNode->myFirst;
67 myFirstLevel = allLevels ? aNode->Depth() : -1;
70 //=======================================================================
73 //=======================================================================
75 void SALOMEDSImpl_ChildNodeIterator::Next()
77 if (myFirstLevel == -1) {
78 myNode = myNode->myNext;
81 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
82 else ChildNodeIterator_UpToBrother;
86 //=======================================================================
87 //function : NextBrother
89 //=======================================================================
91 void SALOMEDSImpl_ChildNodeIterator::NextBrother()
93 if (myNode->myNext != NULL) myNode = myNode->myNext;
94 else ChildNodeIterator_UpToBrother;