summaryrefslogtreecommitdiff
path: root/src/TDF/TDF_ChildIDIterator.cxx
blob: 1e029f03b1048687fc50ad82481bddbb36d14a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// File:	TDF_ChildIDIterator.cxx
//      	-----------------------
// Author:	DAUTRY Philippe
//		<fid@fox.paris1.matra-dtv.fr>
// Copyright:	Matra Datavision 1997

// Version:	0.0
// History:	Version	Date		Purpose
//		0.0	Nov 20 1997	Creation



#include <TDF_ChildIDIterator.ixx>

#include <TDF_ChildIterator.ixx>
#include <TDF_Label.hxx>
#include <TDF_LabelNode.hxx>
#include <TDF_LabelNodePtr.hxx>

#define ChildIDIterator_FindNext \
{ while( myItr.More() &&  !myItr.Value().FindAttribute(myID,myAtt)) myItr.Next(); }



//=======================================================================
//function : TDF_ChildIDIterator
//purpose  : 
//=======================================================================

TDF_ChildIDIterator::TDF_ChildIDIterator()
{}


//=======================================================================
//function : TDF_ChildIDIterator
//purpose  : 
//=======================================================================

TDF_ChildIDIterator::TDF_ChildIDIterator
(const TDF_Label& aLabel,
 const Standard_GUID& anID,
 const Standard_Boolean allLevels)
: myID(anID),
  myItr(aLabel,allLevels)
{ ChildIDIterator_FindNext; }


//=======================================================================
//function : Initialize
//purpose  : 
//=======================================================================

void TDF_ChildIDIterator::Initialize
(const TDF_Label& aLabel,
 const Standard_GUID& anID,
 const Standard_Boolean allLevels)
{
  myID = anID;
  myItr.Initialize(aLabel,allLevels);
  myAtt.Nullify();
  ChildIDIterator_FindNext;
}


//=======================================================================
//function : Next
//purpose  : 
//=======================================================================

void TDF_ChildIDIterator::Next() 
{
  myAtt.Nullify();
  if (myItr.More()) {
    myItr.Next();
    ChildIDIterator_FindNext;
  }
}


//=======================================================================
//function : NextBrother
//purpose  : 
//=======================================================================

void TDF_ChildIDIterator::NextBrother() 
{
  myAtt.Nullify();
  if (myItr.More()) {
    myItr.NextBrother();
    while (myItr.More() && !myItr.Value().FindAttribute(myID,myAtt))
      myItr.NextBrother();
  }
}