OCC18056 Exception during copying Array attribute with array(0,0)
[occt.git] / src / TDataStd / TDataStd_TreeNode.cdl
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
6
7
8
9 class TreeNode from TDataStd inherits Attribute from TDF
10
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.
18         
19 uses 
20
21   GUID            from Standard,   
22   OStream         from Standard,
23   Attribute       from TDF, 
24   RelocationTable from TDF,  
25   DataSet         from TDF, 
26   AttributeDelta  from TDF,  
27   Label           from TDF,
28   PtrTreeNode     from TDataStd 
29      
30 is  
31
32     ---Purpose: class  methods working on the node 
33     --          ===================================
34
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;           
40
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
45     --          attribute.
46     returns TreeNode from TDataStd;
47     
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;
54     
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;  
60    
61     ---Purpose: Instance methods: 
62     --          ================ 
63      
64     Create returns mutable TreeNode from TDataStd;
65     
66
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;                   
71     
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;                   
76
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;                   
81
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;                   
86
87     Remove (me : mutable)
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;      
91
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. 
95
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 ...)
101     
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;
107     
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;
113
114     IsRoot(me)
115     ---Purpose: Returns true if this tree node attribute is the
116     --          ultimate father in the tree.
117     returns Boolean; 
118     
119     Root(me)
120     ---Purpose: Returns the ultimate father of this tree node attribute.
121     returns TreeNode from TDataStd;
122
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;    
126
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;
130     
131     HasFather(me)
132     ---Purpose: Returns true if this tree node attribute has a father tree node.
133     ---C++: inline
134     returns Boolean;    
135
136     Father (me)
137     ---Purpose: Returns the father TreeNode of <me>. Null if root.
138     returns TreeNode from TDataStd;
139     
140     HasNext(me)
141     ---Purpose: Returns true if this tree node attribute has a next tree node.
142     ---C++: inline
143     returns Boolean; 
144     
145     Next (me)
146     ---Purpose:  Returns the next tree node in this tree node attribute.
147     --           Warning
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;
151      
152     HasPrevious(me)
153     ---Purpose: Returns true if this tree node attribute has a previous tree node.
154     ---C++: inline
155     returns Boolean;     
156     
157     Previous (me)
158     ---Purpose: Returns the previous tree node of this tree node attribute.
159     --          Warning
160     --          This tree node is null if it is the first one in this tree node attribute.
161     returns TreeNode from TDataStd;
162      
163     HasFirst (me)
164     ---Purpose: Returns true if this tree node attribute has a first child tree node.
165     ---C++: inline
166     returns Boolean;      
167     
168     First (me)
169     ---Purpose: Returns the first child tree node in this tree node object.
170     returns TreeNode from TDataStd; 
171
172     HasLast (me)
173     ---Purpose: Returns true if this tree node attribute has a last child tree node.
174     ---C++: inline
175     returns Boolean;      
176     
177     Last (me : mutable)
178     ---Purpose: Returns the last child tree node in this tree node object.
179     returns TreeNode from TDataStd;
180
181     FindLast (me : mutable)
182     ---Purpose: Returns the last child tree node in this tree node object.
183     returns TreeNode from TDataStd;
184
185     ---Purpose: to set fields
186     --          =============
187     
188     SetTreeID (me : mutable; explicitID : GUID  from Standard);
189
190     SetFather(me : mutable;F : TreeNode from TDataStd);
191
192     SetNext (me : mutable;F : TreeNode from TDataStd);
193
194     SetPrevious (me : mutable;F : TreeNode from TDataStd);
195
196     SetFirst (me : mutable;F : TreeNode from TDataStd);
197
198     SetLast (me : mutable;F : TreeNode from TDataStd);
199
200     ---Purpose: TreeNode callback: 
201     --          ==================
202
203     AfterAddition(me: mutable)
204     ---Purpose: Connect the TreeNode to its father child list
205     is redefined;
206     
207     BeforeForget(me: mutable)
208     ---Purpose: Disconnect the TreeNode from its Father child list
209     is redefined;
210
211     AfterResume(me: mutable)
212     ---Purpose: Reconnect the TreeNode to its father child list.
213     is redefined;
214
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
219     is redefined;
220
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
225     is redefined;
226
227      
228     ---Purpose: Implementation of Attribute methods:  
229     --          ===================================  
230      
231     ID (me)
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;
236
237     Restore (me: mutable; with : Attribute from TDF) 
238     is virtual;
239
240     Paste (me; into : mutable Attribute from TDF;
241                RT   : mutable RelocationTable from TDF) 
242     is virtual;    
243
244     NewEmpty(me)
245     returns mutable Attribute from TDF
246     is redefined;
247         
248     References(me;
249                aDataSet : DataSet from TDF)
250     is redefined;
251         
252     Dump(me; anOS : in out OStream from Standard) 
253     returns OStream from Standard   
254     ---C++: return &
255     is redefined; 
256
257 fields
258
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;
265
266 friends 
267  
268     class ChildNodeIterator from TDataStd
269     
270 end TreeNode;