1 // Copyright (C) 2007-2012 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
23 // File: SALOMEDSImpl_ChildNodeIterator.cxx
24 // Created: Wed Jan 26 16:43:08 2000
25 // Author: Denis PASCAL
26 // <dp@dingox.paris1.matra-dtv.fr>
28 #include "SALOMEDSImpl_ChildNodeIterator.hxx"
30 #define ChildNodeIterator_UpToBrother \
32 while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
33 myNode = myNode->myFather; \
34 if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
35 myNode = myNode->myNext; \
40 //=======================================================================
41 //function : SALOMEDSImpl_ChildNodeIterator
43 //=======================================================================
44 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator()
48 //=======================================================================
49 //function : SALOMEDSImpl_ChildNodeIterator
51 //=======================================================================
53 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode,
55 : myNode(aNode->myFirst),
56 myFirstLevel(allLevels ? aNode->Depth() : -1)
59 //=======================================================================
60 //function : Initialize
62 //=======================================================================
64 void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode,
67 myNode = aNode->myFirst;
68 myFirstLevel = allLevels ? aNode->Depth() : -1;
71 //=======================================================================
74 //=======================================================================
76 void SALOMEDSImpl_ChildNodeIterator::Next()
78 if (myFirstLevel == -1) {
79 myNode = myNode->myNext;
82 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
83 else ChildNodeIterator_UpToBrother;
87 //=======================================================================
88 //function : NextBrother
90 //=======================================================================
92 void SALOMEDSImpl_ChildNodeIterator::NextBrother()
94 if (myNode->myNext != NULL) myNode = myNode->myNext;
95 else ChildNodeIterator_UpToBrother;