1 -- File: TFunction_Function.cdl
2 -- Created: Thu Jun 10 19:25:22 1999
3 -- Author: Vladislav ROMASHKO
4 -- <vro@flox.nnov.matra-dtv.fr>
5 ---Copyright: Matra Datavision 1999
9 class TreeNode from TDataStd inherits Attribute from TDF
11 ---Purpose: Allows you to define an explicit tree of labels
12 -- which you can also edit.
13 -- Without this class, the data structure cannot be fully edited.
14 -- This service is required if for presentation
15 -- purposes, you want to create an application with
16 -- a tree which allows you to organize and link data
17 -- as a function of application features.
22 OStream from Standard,
24 RelocationTable from TDF,
26 AttributeDelta from TDF,
28 PtrTreeNode from TDataStd
32 ---Purpose: class methods working on the node
33 -- ===================================
35 Find (myclass; L : Label from TDF;
36 T : out TreeNode from TDataStd)
37 ---Purpose: Returns true if the tree node T is found on the label L.
38 -- Otherwise, false is returned.
39 returns Boolean from Standard;
41 Set (myclass; L : Label from TDF)
42 ---Purpose: Finds or Creates a TreeNode attribute on the label <L>
43 -- with the default tree ID, returned by the method
44 -- <GetDefaultTreeID>. Returns the created/found TreeNode
46 returns TreeNode from TDataStd;
48 Set (myclass; L : Label from TDF; ExplicitTreeID : GUID from Standard)
49 ---Purpose: Finds or Creates a TreeNode attribute on the label
50 -- <L>, with an explicit tree ID. <ExplicitTreeID> is
51 -- the ID returned by <TDF_Attribute::ID> method.
52 -- Returns the found/created TreeNode attribute.
53 returns TreeNode from TDataStd;
55 GetDefaultTreeID (myclass)
56 ---Purpose: returns a default tree ID. this ID is used by the
57 -- <Set> method without explicit tree ID.
58 ---C++: return const &
59 returns GUID from Standard;
61 ---Purpose: Instance methods:
64 Create returns mutable TreeNode from TDataStd;
67 Append (me : mutable; Child : TreeNode from TDataStd)
68 ---Purpose: Insert the TreeNode <Child> as last child of <me>. If
69 -- the insertion is successful <me> becomes the Father of <Child>.
70 returns Boolean from Standard;
72 Prepend (me : mutable; Child : TreeNode from TDataStd)
73 ---Purpose: Insert the the TreeNode <Child> as first child of
74 -- <me>. If the insertion is successful <me> becomes the Father of <Child>
75 returns Boolean from Standard;
77 InsertBefore (me : mutable; Node : TreeNode from TDataStd)
78 ---Purpose: Inserts the TreeNode <Node> before <me>. If insertion is successful <me>
79 -- and <Node> belongs to the same Father.
80 returns Boolean from Standard;
82 InsertAfter(me : mutable; Node : TreeNode from TDataStd)
83 ---Purpose: Inserts the TreeNode <Node> after <me>. If insertion is successful <me>
84 -- and <Node> belongs to the same Father.
85 returns Boolean from Standard;
88 ---Purpose: Removes this tree node attribute from its father
89 -- node. The result is that this attribute becomes a root node.
90 returns Boolean from Standard;
92 Depth (me) returns Integer from Standard;
93 ---Purpose: Returns the depth of this tree node in the overall tree node structure.
94 -- In other words, the number of father tree nodes of this one is returned.
96 NbChildren (me; allLevels : Boolean from Standard = Standard_False)
97 returns Integer from Standard;
98 ---Purpose: Returns the number of child nodes.
99 -- If <allLevels> is true, the method counts children of all levels
100 -- (children of children ...)
102 IsAscendant (me; of : TreeNode from TDataStd)
103 ---Purpose: Returns true if this tree node attribute is an
104 -- ascendant of of. In other words, if it is a father or
105 -- the father of a father of of.
106 returns Boolean from Standard;
108 IsDescendant (me; of : TreeNode from TDataStd)
109 ---Purpose: Returns true if this tree node attribute is a
110 -- descendant of of. In other words, if it is a child or
111 -- the child of a child of of.
112 returns Boolean from Standard;
115 ---Purpose: Returns true if this tree node attribute is the
116 -- ultimate father in the tree.
120 ---Purpose: Returns the ultimate father of this tree node attribute.
121 returns TreeNode from TDataStd;
123 IsFather (me; of : TreeNode from TDataStd)
124 ---Purpose: Returns true if this tree node attribute is a father of of.
125 returns Boolean from Standard;
127 IsChild (me; of : TreeNode from TDataStd)
128 ---Purpose: Returns true if this tree node attribute is a child of of.
129 returns Boolean from Standard;
132 ---Purpose: Returns true if this tree node attribute has a father tree node.
137 ---Purpose: Returns the father TreeNode of <me>. Null if root.
138 returns TreeNode from TDataStd;
141 ---Purpose: Returns true if this tree node attribute has a next tree node.
146 ---Purpose: Returns the next tree node in this tree node attribute.
148 -- This tree node is null if it is the last one in this
149 -- tree node attribute.Returns the next TreeNode of <me>. Null if last.
150 returns TreeNode from TDataStd;
153 ---Purpose: Returns true if this tree node attribute has a previous tree node.
158 ---Purpose: Returns the previous tree node of this tree node attribute.
160 -- This tree node is null if it is the first one in this tree node attribute.
161 returns TreeNode from TDataStd;
164 ---Purpose: Returns true if this tree node attribute has a first child tree node.
169 ---Purpose: Returns the first child tree node in this tree node object.
170 returns TreeNode from TDataStd;
173 ---Purpose: Returns true if this tree node attribute has a last child tree node.
178 ---Purpose: Returns the last child tree node in this tree node object.
179 returns TreeNode from TDataStd;
181 FindLast (me : mutable)
182 ---Purpose: Returns the last child tree node in this tree node object.
183 returns TreeNode from TDataStd;
185 ---Purpose: to set fields
188 SetTreeID (me : mutable; explicitID : GUID from Standard);
190 SetFather(me : mutable;F : TreeNode from TDataStd);
192 SetNext (me : mutable;F : TreeNode from TDataStd);
194 SetPrevious (me : mutable;F : TreeNode from TDataStd);
196 SetFirst (me : mutable;F : TreeNode from TDataStd);
198 SetLast (me : mutable;F : TreeNode from TDataStd);
200 ---Purpose: TreeNode callback:
201 -- ==================
203 AfterAddition(me: mutable)
204 ---Purpose: Connect the TreeNode to its father child list
207 BeforeForget(me: mutable)
208 ---Purpose: Disconnect the TreeNode from its Father child list
211 AfterResume(me: mutable)
212 ---Purpose: Reconnect the TreeNode to its father child list.
215 BeforeUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
216 forceIt : Boolean from Standard = Standard_False)
217 ---Purpose: Disconnect the TreeNode, if necessary.
218 returns Boolean from Standard
221 AfterUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
222 forceIt : Boolean from Standard = Standard_False)
223 ---Purpose: Reconnect the TreeNode, if necessary.
224 returns Boolean from Standard
228 ---Purpose: Implementation of Attribute methods:
229 -- ===================================
232 ---Purpose: Returns the tree ID (default or explicit one depending
233 -- onthe Set method used).
234 ---C++: return const &
235 returns GUID from Standard;
237 Restore (me: mutable; with : Attribute from TDF)
240 Paste (me; into : mutable Attribute from TDF;
241 RT : mutable RelocationTable from TDF)
245 returns mutable Attribute from TDF
249 aDataSet : DataSet from TDF)
252 Dump(me; anOS : in out OStream from Standard)
253 returns OStream from Standard
259 myFather : PtrTreeNode from TDataStd;
260 myPrevious : PtrTreeNode from TDataStd;
261 myNext : PtrTreeNode from TDataStd;
262 myFirst : PtrTreeNode from TDataStd;
263 myLast : PtrTreeNode from TDataStd;
264 myTreeID : GUID from Standard;
268 class ChildNodeIterator from TDataStd