b311480e |
1 | -- Created by: DAUTRY Philippe |
2 | -- Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
3 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
d5f74e42 |
7 | -- This library is free software; you can redistribute it and/or modify it under |
8 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | -- by the Free Software Foundation, with special exception defined in the file |
10 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | -- ------------ |
7fd59977 |
17 | |
18 | ---Version: 0.0 |
b311480e |
19 | --Version Date Purpose |
7fd59977 |
20 | -- 0.0 Mar 13 1997 Creation |
21 | |
22 | |
23 | class Tool from TDF |
24 | |
25 | ---Purpose: This class provides general services for a data framework. |
26 | |
27 | uses |
28 | |
29 | Data from TDF, |
30 | Label from TDF, |
31 | LabelList from TDF, |
32 | LabelIntegerMap from TDF, |
33 | IDFilter from TDF, |
34 | AttributeList from TDF, |
35 | AttributeMap from TDF, |
36 | AttributeIndexedMap from TDF, |
37 | AsciiString from TCollection, |
38 | ListOfInteger from TColStd, |
39 | OStream from Standard |
40 | |
41 | is |
42 | |
43 | -- Objects counting --------------------------------------------------- |
44 | |
45 | NbLabels(myclass; |
46 | aLabel : Label from TDF) |
47 | returns Integer from Standard; |
48 | ---Purpose: Returns the number of labels of the tree, |
49 | -- including <aLabel>. aLabel is also included in this figure. |
50 | -- This information is useful in setting the size of an array. |
51 | |
52 | NbAttributes(myclass; |
53 | aLabel : Label from TDF) |
54 | returns Integer from Standard; |
55 | ---Purpose: Returns the total number of attributes attached |
56 | -- to the labels dependent on the label aLabel. |
57 | -- The attributes of aLabel are also included in this figure. |
58 | -- This information is useful in setting the size of an array. |
59 | |
60 | NbAttributes(myclass; |
61 | aLabel : Label from TDF; |
62 | aFilter : IDFilter from TDF) |
63 | returns Integer from Standard; |
64 | ---Purpose: Returns the number of attributes of the tree, |
65 | -- selected by a<Filter>, including those of |
66 | -- <aLabel>. |
67 | |
68 | |
69 | -- Self Contained Label ----------------------------------------------- |
70 | |
71 | IsSelfContained(myclass; |
72 | aLabel : Label from TDF) |
73 | returns Boolean from Standard; |
74 | ---Purpose: Returns true if <aLabel> and its descendants |
75 | -- reference only attributes or labels attached to |
76 | -- themselves. |
77 | |
78 | IsSelfContained(myclass; |
79 | aLabel : Label from TDF; |
80 | aFilter : IDFilter from TDF) |
81 | returns Boolean from Standard; |
82 | ---Purpose: Returns true if <aLabel> and its descendants |
83 | -- reference only attributes or labels attached to |
84 | -- themselves and kept by <aFilter>. |
85 | |
86 | OutReferers(myclass; |
87 | theLabel : Label from TDF; |
88 | theAtts : in out AttributeMap from TDF); |
89 | ---Purpose: Returns in <theAtts> the attributes having out |
90 | -- references. |
91 | -- |
92 | -- Caution: <theAtts> is not cleared before use! |
93 | |
94 | OutReferers(myclass; |
95 | aLabel : Label from TDF; |
96 | aFilterForReferers : IDFilter from TDF; |
97 | aFilterForReferences : IDFilter from TDF; |
98 | atts : in out AttributeMap from TDF); |
99 | ---Purpose: Returns in <atts> the attributes having out |
100 | -- references and kept by <aFilterForReferers>. |
101 | -- It considers only the references kept by <aFilterForReferences>. |
102 | -- Caution: <atts> is not cleared before use! |
103 | |
104 | OutReferences(myclass; |
105 | aLabel : Label from TDF; |
106 | atts : in out AttributeMap from TDF); |
107 | ---Purpose: Returns in <atts> the referenced attributes. |
108 | -- Caution: <atts> is not cleared before use! |
109 | |
110 | OutReferences(myclass; |
111 | aLabel : Label from TDF; |
112 | aFilterForReferers : IDFilter from TDF; |
113 | aFilterForReferences : IDFilter from TDF; |
114 | atts : in out AttributeMap from TDF); |
115 | ---Purpose: Returns in <atts> the referenced attributes and kept by <aFilterForReferences>. |
116 | -- It considers only the referers kept by <aFilterForReferers>. |
117 | -- Caution: <atts> is not cleared before use! |
118 | |
119 | |
120 | -- Label Relocation --------------------------------------------------- |
121 | |
122 | RelocateLabel(myclass; |
123 | aSourceLabel, fromRoot, toRoot : Label from TDF; |
124 | aTargetLabel : in out Label from TDF; |
125 | create : Boolean from Standard = Standard_False); |
126 | ---Purpose: Returns the label having the same sub-entry as |
127 | -- <aLabel> but located as descendant as <toRoot> |
128 | -- instead of <fromRoot>. |
129 | -- |
130 | -- Exemple : |
131 | -- |
132 | -- aLabel = 0:3:24:7:2:7 |
133 | -- fromRoot = 0:3:24 |
134 | -- toRoot = 0:5 |
135 | -- returned label = 0:5:7:2:7 |
136 | |
137 | |
138 | -- Label -> Entry ----------------------------------------------------- |
139 | |
140 | Entry(myclass; |
141 | aLabel : Label from TDF; |
142 | anEntry : in out AsciiString from TCollection); |
143 | ---Purpose: Returns the entry for the label aLabel in the form |
144 | -- of the ASCII character string anEntry containing |
145 | -- the tag list for aLabel. |
146 | |
147 | TagList(myclass; |
148 | aLabel : Label from TDF; |
149 | aTagList : in out ListOfInteger from TColStd); |
150 | ---Purpose: Returns the entry of <aLabel> as list of integers |
151 | -- in <aTagList>. |
152 | |
153 | TagList(myclass; |
154 | anEntry : AsciiString from TCollection; |
155 | aTagList : in out ListOfInteger from TColStd); |
156 | ---Purpose: Returns the entry expressed by <anEntry> as list |
157 | -- of integers in <aTagList>. |
158 | |
159 | -- Entry -> Label ----------------------------------------------------- |
160 | |
161 | |
162 | Label(myclass; |
163 | aDF : Data from TDF; |
164 | anEntry : AsciiString from TCollection; |
165 | aLabel : in out Label from TDF; |
166 | create : Boolean from Standard = Standard_False); |
167 | ---Purpose: Returns the label expressed by <anEntry>; creates |
168 | -- the label if it does not exist and if <create> is |
169 | -- true. |
170 | |
171 | Label(myclass; |
172 | aDF : Data from TDF; |
173 | anEntry : CString from Standard; |
174 | aLabel : in out Label from TDF; |
175 | create : Boolean from Standard = Standard_False); |
176 | ---Purpose: Returns the label expressed by <anEntry>; creates |
177 | -- the label if it does not exist and if <create> is |
178 | -- true. |
179 | |
180 | Label(myclass; |
181 | aDF : Data from TDF; |
182 | aTagList : ListOfInteger from TColStd; |
183 | aLabel : in out Label from TDF; |
184 | create : Boolean from Standard = Standard_False); |
185 | ---Purpose: Returns the label expressed by <anEntry>; creates |
186 | -- the label if it does not exist and if <create> is |
187 | -- true. |
188 | |
189 | |
190 | -- Label count -------------------------------------------------------- |
191 | |
192 | CountLabels(myclass; |
193 | aLabelList : in out LabelList from TDF; |
194 | aLabelMap : in out LabelIntegerMap from TDF); |
195 | ---Purpose: Adds the labels of <aLabelList> to <aLabelMap> if |
196 | -- they are unbound, or increases their reference |
197 | -- counters. At the end of the process, <aLabelList> |
198 | -- contains only the ADDED labels. |
199 | |
200 | DeductLabels(myclass; |
201 | aLabelList : in out LabelList from TDF; |
202 | aLabelMap : in out LabelIntegerMap from TDF); |
203 | ---Purpose: Decreases the reference counters of the labels of |
204 | -- <aLabelList> to <aLabelMap>, and removes labels |
205 | -- with null counter. At the end of the process, |
206 | -- <aLabelList> contains only the SUPPRESSED labels. |
207 | |
208 | |
209 | -- Dump --------------------------------------------------------------- |
210 | |
211 | DeepDump(myclass; |
212 | anOS : in out OStream from Standard; |
213 | aDF : Data from TDF); |
214 | ---Purpose: Dumps <aDF> and its labels and their attributes. |
215 | |
216 | ExtendedDeepDump(myclass; |
217 | anOS : in out OStream from Standard; |
218 | aDF : Data from TDF; |
219 | aFilter : IDFilter from TDF); |
220 | ---Purpose: Dumps <aDF> and its labels and their attributes, |
221 | -- if their IDs are kept by <aFilter>. Dumps also the |
222 | -- attributes content. |
223 | |
224 | DeepDump(myclass; |
225 | anOS : in out OStream from Standard; |
226 | aLabel : Label from TDF); |
227 | ---Purpose: Dumps <aLabel>, its chilren and their attributes. |
228 | |
229 | ExtendedDeepDump(myclass; |
230 | anOS : in out OStream from Standard; |
231 | aLabel : Label from TDF; |
232 | aFilter : IDFilter from TDF); |
233 | ---Purpose: Dumps <aLabel>, its chilren and their attributes, |
234 | -- if their IDs are kept by <aFilter>. Dumps also the |
235 | -- attributes content. |
236 | |
237 | end Tool; |