summaryrefslogtreecommitdiff
path: root/src/PXCAFDoc/PXCAFDoc_GraphNode.cxx
blob: 377c65733ac85566c04f2eb71ad393bf787dadad (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// File:	PXCAFDoc_GraphNode.cxx
// Created:	Fri Sep 29 09:43:11 2000
// Author:	data exchange team
//		<det@nordox.nnov.matra-dtv.fr>


#include <PXCAFDoc_GraphNode.ixx>
#include <Standard_GUID.hxx>

//=======================================================================
//function : Constructor
//purpose  : 
//=======================================================================

PXCAFDoc_GraphNode::PXCAFDoc_GraphNode()
{
  myFathers  = new PXCAFDoc_GraphNodeSequence;
  myChildren = new PXCAFDoc_GraphNodeSequence;
}

//=======================================================================
//function : SetGraphID
//purpose  : 
//=======================================================================

void PXCAFDoc_GraphNode::SetGraphID (const Standard_GUID& explicitID)
{
  myGraphID = explicitID;
}

//=======================================================================
//function : GetGraphID
//purpose  : 
//=======================================================================

Standard_GUID PXCAFDoc_GraphNode::GetGraphID() const
{
  return myGraphID;
}

//=======================================================================
//function : SetFather
//purpose  : 
//=======================================================================

Standard_Integer PXCAFDoc_GraphNode::SetFather(const Handle(PXCAFDoc_GraphNode)& F) 
{
  Standard_Integer Findex = myFathers->Length();
  myFathers->Append(F);
  return ++Findex;
}

//=======================================================================
//function : SetChild
//purpose  : 
//=======================================================================

Standard_Integer PXCAFDoc_GraphNode::SetChild(const Handle(PXCAFDoc_GraphNode)& Ch) 
{
  Standard_Integer Chindex = myChildren->Length();
  myChildren->Append(Ch);
  return ++Chindex;
}

//=======================================================================
//function : GetFather
//purpose  : 
//=======================================================================

 Handle(PXCAFDoc_GraphNode) PXCAFDoc_GraphNode::GetFather(const Standard_Integer Findex) const
{
  Handle(PXCAFDoc_GraphNode) F = myFathers->Value(Findex);
  return F;
}

//=======================================================================
//function : GetChild
//purpose  : 
//=======================================================================

 Handle(PXCAFDoc_GraphNode) PXCAFDoc_GraphNode::GetChild(const Standard_Integer Chindex) const
{
  Handle(PXCAFDoc_GraphNode) Ch = myChildren->Value(Chindex);
  return Ch;
}

//=======================================================================
//function : FatherIndex
//purpose  : 
//=======================================================================

 Standard_Integer PXCAFDoc_GraphNode::FatherIndex(const Handle(PXCAFDoc_GraphNode)& F) const
{
  Standard_Integer Findex = 0;
  for ( ; Findex <= NbFathers(); Findex++) {
    if ( F == myFathers->Value(Findex)) return Findex;
  }
  return 0;
}

//=======================================================================
//function : ChildIndex
//purpose  : 
//=======================================================================

 Standard_Integer PXCAFDoc_GraphNode::ChildIndex(const Handle(PXCAFDoc_GraphNode)& Ch) const
{
  Standard_Integer Chindex = 0;
  for ( ; Chindex <= NbChildren(); Chindex++) {
    if ( Ch == myChildren->Value(Chindex)) return Chindex;
  }
  return 0;
}

//=======================================================================
//function : NbFathers
//purpose  : 
//=======================================================================

 Standard_Integer PXCAFDoc_GraphNode::NbFathers() const
{
  return myFathers->Length();
}

//=======================================================================
//function : NbChildren
//purpose  : 
//=======================================================================

 Standard_Integer PXCAFDoc_GraphNode::NbChildren() const
{
  return myChildren->Length();
}