7fd59977 |
1 | // File: PXCAFDoc_GraphNode.cxx |
2 | // Created: Fri Sep 29 09:43:11 2000 |
3 | // Author: data exchange team |
4 | // <det@nordox.nnov.matra-dtv.fr> |
5 | |
6 | |
7 | #include <PXCAFDoc_GraphNode.ixx> |
8 | #include <Standard_GUID.hxx> |
9 | |
10 | //======================================================================= |
11 | //function : Constructor |
12 | //purpose : |
13 | //======================================================================= |
14 | |
15 | PXCAFDoc_GraphNode::PXCAFDoc_GraphNode() |
16 | { |
17 | myFathers = new PXCAFDoc_GraphNodeSequence; |
18 | myChildren = new PXCAFDoc_GraphNodeSequence; |
19 | } |
20 | |
21 | //======================================================================= |
22 | //function : SetGraphID |
23 | //purpose : |
24 | //======================================================================= |
25 | |
26 | void PXCAFDoc_GraphNode::SetGraphID (const Standard_GUID& explicitID) |
27 | { |
28 | myGraphID = explicitID; |
29 | } |
30 | |
31 | //======================================================================= |
32 | //function : GetGraphID |
33 | //purpose : |
34 | //======================================================================= |
35 | |
36 | Standard_GUID PXCAFDoc_GraphNode::GetGraphID() const |
37 | { |
38 | return myGraphID; |
39 | } |
40 | |
41 | //======================================================================= |
42 | //function : SetFather |
43 | //purpose : |
44 | //======================================================================= |
45 | |
46 | Standard_Integer PXCAFDoc_GraphNode::SetFather(const Handle(PXCAFDoc_GraphNode)& F) |
47 | { |
48 | Standard_Integer Findex = myFathers->Length(); |
49 | myFathers->Append(F); |
50 | return ++Findex; |
51 | } |
52 | |
53 | //======================================================================= |
54 | //function : SetChild |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | Standard_Integer PXCAFDoc_GraphNode::SetChild(const Handle(PXCAFDoc_GraphNode)& Ch) |
59 | { |
60 | Standard_Integer Chindex = myChildren->Length(); |
61 | myChildren->Append(Ch); |
62 | return ++Chindex; |
63 | } |
64 | |
65 | //======================================================================= |
66 | //function : GetFather |
67 | //purpose : |
68 | //======================================================================= |
69 | |
70 | Handle(PXCAFDoc_GraphNode) PXCAFDoc_GraphNode::GetFather(const Standard_Integer Findex) const |
71 | { |
72 | Handle(PXCAFDoc_GraphNode) F = myFathers->Value(Findex); |
73 | return F; |
74 | } |
75 | |
76 | //======================================================================= |
77 | //function : GetChild |
78 | //purpose : |
79 | //======================================================================= |
80 | |
81 | Handle(PXCAFDoc_GraphNode) PXCAFDoc_GraphNode::GetChild(const Standard_Integer Chindex) const |
82 | { |
83 | Handle(PXCAFDoc_GraphNode) Ch = myChildren->Value(Chindex); |
84 | return Ch; |
85 | } |
86 | |
87 | //======================================================================= |
88 | //function : FatherIndex |
89 | //purpose : |
90 | //======================================================================= |
91 | |
92 | Standard_Integer PXCAFDoc_GraphNode::FatherIndex(const Handle(PXCAFDoc_GraphNode)& F) const |
93 | { |
94 | Standard_Integer Findex = 0; |
95 | for ( ; Findex <= NbFathers(); Findex++) { |
96 | if ( F == myFathers->Value(Findex)) return Findex; |
97 | } |
98 | return 0; |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : ChildIndex |
103 | //purpose : |
104 | //======================================================================= |
105 | |
106 | Standard_Integer PXCAFDoc_GraphNode::ChildIndex(const Handle(PXCAFDoc_GraphNode)& Ch) const |
107 | { |
108 | Standard_Integer Chindex = 0; |
109 | for ( ; Chindex <= NbChildren(); Chindex++) { |
110 | if ( Ch == myChildren->Value(Chindex)) return Chindex; |
111 | } |
112 | return 0; |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : NbFathers |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | Standard_Integer PXCAFDoc_GraphNode::NbFathers() const |
121 | { |
122 | return myFathers->Length(); |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : NbChildren |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | Standard_Integer PXCAFDoc_GraphNode::NbChildren() const |
131 | { |
132 | return myChildren->Length(); |
133 | } |