0024750: Replace instantiations of TCollection generic classes by NCollection templat...
[occt.git] / src / XSControl / XSControl_TransferReader.cdl
CommitLineData
b311480e 1-- Created on: 1995-12-05
2-- Created by: Christian CAILLET
3-- Copyright (c) 1995-1999 Matra Datavision
973c2be1 4-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5--
973c2be1 6-- This file is part of Open CASCADE Technology software library.
b311480e 7--
d5f74e42 8-- This library is free software; you can redistribute it and/or modify it under
9-- the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10-- by the Free Software Foundation, with special exception defined in the file
11-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12-- distribution for complete text of the license and disclaimer of any warranty.
b311480e 13--
973c2be1 14-- Alternatively, this file may be used under the terms of Open CASCADE
15-- commercial license or contractual agreement.
7fd59977 16
17class TransferReader from XSControl inherits TShared
18
19 ---Purpose : A TransferReader performs, manages, handles results of,
20 -- transfers done when reading a file (i.e. from entities of an
21 -- InterfaceModel, to objects for Imagine)
22 --
23 -- Running is organised around basic tools : TransientProcess and
24 -- its Actor, results are Binders and CheckIterators. It implies
25 -- control by a Controller (which prepares the Actor as required)
26 --
27 -- Getting results can be done directly on TransientProcess, but
28 -- these are immediate "last produced" results. Each transfer of
29 -- an entity gives a final result, but also possible intermediate
30 -- data, and checks, which can be attached to sub-entities.
31 --
32 -- Hence, final results (which intermediates and checks) are
33 -- recorded as ResultFromModel and can be queried individually.
34 --
35 -- Some more direct access are given for results which are
36 -- Transient or Shapes
37
38uses CString, AsciiString, Transient,
39 DataMapOfIntegerTransient, HSequenceOfTransient, DictionaryOfTransient,
40 InterfaceModel, CheckIterator, Graph, HGraph,
41 TransientProcess, ActorOfTransientProcess, Binder, ResultFromModel,
42 CheckStatus from Interface, Controller from XSControl,
43 Shape from TopoDS, HSequenceOfShape from TopTools
44
45is
46
6e33d3ce 47 Create returns TransferReader;
7fd59977 48 ---Purpose : Creates a TransferReader, empty
49
50 -- General Management --
51
6e33d3ce 52 SetController (me : mutable; control : Controller from XSControl);
7fd59977 53 ---Purpose : Sets a Controller. It is required to generate the Actor.
54 -- Elsewhere, the Actor must be provided directly
55
6e33d3ce 56 SetActor (me : mutable; actor : ActorOfTransientProcess);
7fd59977 57 ---Purpose : Sets the Actor directly : this value will be used if the
58 -- Controller is not set
59
6e33d3ce 60 Actor (me : mutable) returns ActorOfTransientProcess;
7fd59977 61 ---Purpose : Returns the Actor, determined by the Controller, or if this
62 -- one is unknown, directly set.
63 -- Once it has been defined, it can then be edited.
64
65 SetModel (me : mutable; model : InterfaceModel);
66 ---Purpose : Sets an InterfaceModel. This causes former results, computed
67 -- from another one, to be lost (see also Clear)
68
69 SetGraph (me : mutable; graph : HGraph);
70 ---Purpose : Sets a Graph and its InterfaceModel (calls SetModel)
71
72 Model (me) returns InterfaceModel;
73 ---Purpose : Returns the currently set InterfaceModel
74
75 SetContext (me : mutable; name : CString; ctx : Transient);
76 ---Purpose : Sets a Context : according to receiving appli, to be
77 -- interpreted by the Actor
78
79 GetContext (me; name : CString; type : Type; ctx : out Transient)
80 returns Boolean;
81 ---Purpose : Returns the Context attached to a name, if set and if it is
82 -- Kind of the type, else a Null Handle
83 -- Returns True if OK, False if no Context
84
85 Context (me : mutable) returns DictionaryOfTransient;
86 ---Purpose : Returns (modifiable) the whole definition of Context
87 -- Rather for internal use (ex.: preparing and setting in once)
88 ---C++ : return &
89
90 SetFileName (me : mutable; name : CString);
91 ---Purpose : Sets a new value for (loaded) file name
92
93 FileName (me) returns CString;
94 ---Purpose : Returns actual value of file name
95
96 Clear (me : mutable; mode : Integer);
97 ---Purpose : Clears data, according mode :
98 -- -1 all
99 -- 0 nothing done
100 -- +1 final results
101 -- +2 working data (model, context, transfer process)
102
6e33d3ce 103 TransientProcess (me) returns TransientProcess;
7fd59977 104 ---Purpose : Returns the currently used TransientProcess
105 -- It is computed from the model by TransferReadRoots, or by
106 -- BeginTransferRead
107
6e33d3ce 108 SetTransientProcess (me : mutable; TP : TransientProcess);
7fd59977 109 ---Purpose : Forces the TransientProcess
110 -- Remark : it also changes the Model and the Actor, from those
111 -- recorded in the new TransientProcess
112
113
114 -- Recording and Querying Results --
115 -- these methods work mainly on recorded data
116 -- i.e. they don't need Controller and Actor
117
118 RecordResult (me : mutable; ent : Transient) returns Boolean;
119 ---Purpose : Records a final result of transferring an entity
120 -- This result is recorded as a ResultFromModel, taken from
121 -- the TransientProcess
122 -- Returns True if a result is available, False else
123
124 IsRecorded (me; ent : Transient) returns Boolean;
125 ---Purpose : Returns True if a final result is recorded for an entity
126 -- Remark that it can bring no effective result if transfer has
127 -- completely failed (FinalResult brings only fail messages ...)
128
129 HasResult (me; ent : Transient) returns Boolean;
130 ---Purpose : Returns True if a final result is recorded AND BRINGS AN
131 -- EFFECTIVE RESULT (else, it brings only fail messages)
132
133 RecordedList (me) returns HSequenceOfTransient;
134 ---Purpose : Returns the list of entities to which a final result is
135 -- attached (i.e. processed by RecordResult)
136
137 Skip (me : mutable; ent : Transient) returns Boolean;
138 ---Purpose : Note that an entity has been required for transfer but no
139 -- result at all is available (typically : case not implemented)
140 -- It is not an error, but it gives a specific status : Skipped
141 -- Returns True if done, False if <ent> is not in starting model
142
143 IsSkipped (me; ent : Transient) returns Boolean;
144 ---Purpose : Returns True if an entity is noted as skipped
145
146 IsMarked (me; ent : Transient) returns Boolean;
147 ---Purpose : Returns True if an entity has been asked for transfert, hence
148 -- it is marked, as : Recorded (a computation has ran, with or
149 -- without an effective result), or Skipped (case ignored)
150
151
152 FinalResult (me; ent : Transient) returns ResultFromModel;
153 ---Purpose : Returns the final result recorded for an entity, as such
154
155 FinalEntityLabel (me; ent : Transient) returns CString;
156 ---Purpose : Returns the label attached to an entity recorded for final,
157 -- or an empty string if not recorded
158
159 FinalEntityNumber (me; ent : Transient) returns Integer;
160 ---Purpose : Returns the number attached to the entity recorded for final,
161 -- or zero if not recorded (looks in the ResultFromModel)
162
163 ResultFromNumber (me; num : Integer) returns ResultFromModel;
164 ---Purpose : Returns the final result recorded for a NUMBER of entity
165 -- (internal use). Null if out of range
166
6e33d3ce 167 TransientResult (me; ent : Transient) returns Transient;
7fd59977 168 ---Purpose : Returns the resulting object as a Transient
169 -- Null Handle if no result or result not transient
170
171 ShapeResult (me; ent : Transient) returns Shape from TopoDS;
172 ---Purpose : Returns the resulting object as a Shape
173 -- Null Shape if no result or result not a shape
174
175 ClearResult (me : mutable; ent : Transient; mode : Integer) returns Boolean;
176 ---Purpose : Clears recorded result for an entity, according mode
177 -- <mode> = -1 : true, complete, clearing (erasing result)
178 -- <mode> >= 0 : simple "stripping", see ResultFromModel,
179 -- in particular, 0 for simple internal strip,
180 -- 10 for all but final result,
181 -- 11 for all : just label, status and filename are kept
182 -- Returns True when done, False if nothing was to clear
183
184
185 EntityFromResult (me; res : Transient; mode : Integer=0) returns Transient;
186 ---Purpose : Returns an entity from which a given result was produced.
187 -- If <mode> = 0 (D), searches in last root transfers
188 -- If <mode> = 1, searches in last (root & sub) transfers
189 -- If <mode> = 2, searches in root recorded results
190 -- If <mode> = 3, searches in all (root & sub) recordeds
191 -- <res> can be, either a transient object (result itself) or
192 -- a binder. For a binder of shape, calls EntityFromShapeResult
193 -- Returns a Null Handle if <res> not recorded
194
195 EntityFromShapeResult (me; res : Shape from TopoDS; mode : Integer=0)
196 returns Transient;
197 ---Purpose : Returns an entity from which a given shape result was produced
198 -- Returns a Null Handle if <res> not recorded or not a Shape
199
200 EntitiesFromShapeList (me; res : HSequenceOfShape from TopTools; mode : Integer = 0)
201 returns HSequenceOfTransient from TColStd;
202 ---Purpose : Returns the list of entities from which some shapes were
203 -- produced : it corresponds to a loop on EntityFromShapeResult,
204 -- but is optimised
205
206
207 CheckList (me; ent : Transient; level : Integer = 0) returns CheckIterator;
208 ---Purpose : Returns the CheckList resulting from transferring <ent>, i.e.
209 -- stored in its recorded form ResultFromModel
210 -- (empty if transfer successful or not recorded ...)
211 --
212 -- If <ent> is the Model, returns the complete cumulated
213 -- check-list, <level> is ignored
214 --
215 -- If <ent> is an entity of the Model, <level> applies as follows
216 -- <level> : -1 for <ent> only, LAST transfer (TransientProcess)
217 -- <level> : 0 for <ent> only (D)
218 -- 1 for <ent> and its immediate subtransfers, if any
219 -- 2 for <ent> and subtransferts at all levels
220
221 HasChecks (me; ent : Transient; failsonly : Boolean) returns Boolean;
222 ---Purpose : Returns True if an entity (with a final result) has checks :
223 -- - failsonly = False : any kind of check message
224 -- - failsonly = True : fails only
225 -- Returns False if <ent> is not recorded
226
227 CheckedList (me; ent : Transient;
228 withcheck : CheckStatus = Interface_CheckAny; result : Boolean = Standard_True)
229 returns HSequenceOfTransient;
230 ---Purpose : Returns the list of starting entities to which a given check
231 -- status is attached, IN FINAL RESULTS
232 -- <ent> can be an entity, or the model to query all entities
233 -- Below, "entities" are, either <ent> plus its sub-transferred,
234 -- or all the entities of the model
235 --
236 -- <check> = -2 , all entities whatever the check (see result)
237 -- <check> = -1 , entities with no fail (warning allowed)
238 -- <check> = 0 , entities with no check at all
239 -- <check> = 1 , entities with warning but no fail
240 -- <check> = 2 , entities with fail
241 -- <result> : if True, only entities with an attached result
242 -- Remark : result True and check=0 will give an empty list
243
244 -- Actions for Transfer (Read) --
245
246 BeginTransfer (me : mutable) returns Boolean;
247 ---Purpose : Defines a new TransferProcess for reading transfer
248 -- Returns True if done, False if data are not properly defined
249 -- (the Model, the Actor for Read)
250
251 Recognize (me : mutable; ent : Transient) returns Boolean;
252 ---Purpose : Tells if an entity is recognized as a valid candidate for
253 -- Transfer. Calls method Recognize from the Actor (if known)
254
255 TransferOne (me : mutable; ent : Transient;
256 rec : Boolean = Standard_True) returns Integer;
257 ---Purpose : Commands the transfer on reading for an entity to data for
258 -- Imagine, using the selected Actor for Read
259 -- Returns count of transferred entities, ok or with fails (0/1)
260 -- If <rec> is True (D), the result is recorded by RecordResult
261
262 TransferList (me : mutable; list : HSequenceOfTransient;
263 rec : Boolean = Standard_True) returns Integer;
264 ---Purpose : Commands the transfer on reading for a list of entities to
265 -- data for Imagine, using the selected Actor for Read
266 -- Returns count of transferred entities, ok or with fails (0/1)
267 -- If <rec> is True (D), the results are recorded by RecordResult
268
269 TransferRoots (me : mutable; G : Graph) returns Integer;
270 ---Purpose : Transfers the content of the current Interface Model to
271 -- data handled by Imagine, starting from its Roots (determined
272 -- by the Graph <G>), using the selected Actor for Read
273 -- Returns the count of performed root transfers (i.e. 0 if none)
274 -- or -1 if no actor is defined
275
276 TransferClear (me : mutable; ent : Transient; level : Integer = 0);
277 ---Purpose : Clears the results attached to an entity
278 -- if <ents> equates the starting model, clears all results
279
280 PrintStats (me; what : Integer; mode : Integer = 0);
281 ---Purpose : Prints statistics on current Trace File, according <what> and
282 -- <mode>. See PrintStatsProcess for details
283
284 -- Querying last transfer (i.e. TransientProcess) --
285
286 LastCheckList (me) returns CheckIterator;
287 ---Purpose : Returns the CheckList resulting from last TransferRead
288 -- i.e. from TransientProcess itself, recorded from last Clear
289
290 LastTransferList (me; roots : Boolean) returns HSequenceOfTransient;
291 ---Purpose : Returns the list of entities recorded as lastly transferred
292 -- i.e. from TransientProcess itself, recorded from last Clear
293 -- If <roots> is True , considers only roots of transfer
294 -- If <roots> is False, considers all entities bound with result
295
296 ShapeResultList (me : mutable; rec : Boolean)
297 returns HSequenceOfShape from TopTools;
298 ---Purpose : Returns a list of result Shapes
299 -- If <rec> is True , sees RecordedList
300 -- If <rec> is False, sees LastTransferList (last ROOT transfers)
301 -- For each one, if it is a Shape, it is cumulated to the list
302 -- If no Shape is found, returns an empty Sequence
303
304 PrintStatsProcess (myclass; TP : TransientProcess;
305 what : Integer; mode : Integer = 0);
306 ---Purpose : This routines prints statistics about a TransientProcess
307 -- It can be called, by a TransferReader, or isolately
308 -- Prints are done on the default trace file
309 -- <what> defines what kind of statistics are to be printed :
310 -- 0 : basic figures
311 -- 1 : root results
312 -- 2 : all recorded (roots, intermediate, checked entities)
313 -- 3 : abnormal records
314 -- 4 : check messages (warnings and fails)
315 -- 5 : fail messages
316 --
317 -- <mode> is used according <what> :
318 -- <what> = 0 : <mode> is ignored
319 -- <what> = 1,2,3 : <mode> as follows :
320 -- 0 (D) : just lists numbers of concerned entities in the model
321 -- 1 : for each entity, gives number,label, type and result
322 -- type and/or status (fail/warning...)
323 -- 2 : for each entity, gives maximal information (i.e. checks)
324 -- 3 : counts per type of starting entity (class type)
325 -- 4 : counts per result type and/or status
326 -- 5 : counts per couple (starting type / result type/status)
327 -- 6 : idem plus gives for each item, the list of numbers of
328 -- entities in the starting model
329 --
330 -- <what> = 4,5 : modes relays on an enum PrintCount :
331 -- 0 (D) : ItemsByEntity (sequential list by entity)
332 -- 1 : CountByItem
333 -- 2 : ShortByItem (count + 5 first numbers)
334 -- 3 : ListByItem (count + entity numbers)
335 -- 4 : EntitiesByItem (count + entity numbers and labels)
336
337 PrintStatsOnList (myclass; TP : TransientProcess;
338 list : HSequenceOfTransient;
339 what : Integer; mode : Integer = 0);
340 ---Purpose : Works as PrintStatsProcess, but displays data only on the
341 -- entities which are in <list> (filter)
342
343fields
344
345 theController : Controller;
346
347 theFilename : AsciiString;
348 theModel : InterfaceModel;
349 theGraph : HGraph;
350 theContext : DictionaryOfTransient;
351
352 theActor : ActorOfTransientProcess;
353 theTransfer : TransientProcess;
354
355 theResults : DataMapOfIntegerTransient;
356 theShapeResult : HSequenceOfShape from TopTools;
357
358end TransferReader;