0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_ModelCopier.cdl
CommitLineData
b311480e 1-- Created on: 1993-08-26
2-- Created by: Christian CAILLET
3-- Copyright (c) 1993-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23class ModelCopier from IFSelect inherits TShared
24
25 ---Purpose : This class performs the Copy operations involved by the
26 -- description of a ShareOut (evaluated by a ShareOutResult)
27 -- plus, if there are, the Modifications on the results, with
28 -- the help of Modifiers. Each Modifier can work on one or more
29 -- resulting packets, accoding its criteria : it operates on a
30 -- Model once copied and filled with the content of the packet.
31 --
32 -- Modifiers can be :
33 -- - Model Modifiers, inheriting from the specific class Modifier
34 -- able to run on the content of a Model (header or entities),
35 -- activated by the ModelCopier itself
36 -- - File Modifiers, inheriting directly from GeneralModifier,
37 -- intended to be activated under the control of a WorkLibrary,
38 -- once the Model has been produced (i.e. to act on output
39 -- format, or other specific file features)
40 --
41 -- The Copy operations can be :
42 -- - immediately put to files : for each packet, a Model is
43 -- created and filled, then the file is output, at that's all
44 -- - memorized : for each packet, a Model is created and filled,
45 -- it is memorized with the corresponding file name.
46 -- it is possible to query the result of memorization (list of
47 -- produced Models and their file names)
48 -- -> it is also possible to send it into the files :
49 -- once files are written, the result is cleared
50 --
51 -- In addition, a list of really written files is managed :
52 -- A first call to BeginSentFiles clears the list and commands,
53 -- either to begin a new list, or to stop recording it. A call
54 -- to SentFiles returns the list (if recording has been required)
55 -- This list allows to globally exploit the set of produced files
56 --
57 -- Remark : For operations which concern specific Entities, see
58 -- also in package IFAdapt : a sub-class of ModelCopier allows
59 -- to work with EntityModifier, in addition to Modifier itself
60 -- which still applies to a whole copied Model.
61
62uses AsciiString from TCollection,
63 HSequenceOfInteger from TColStd, HArray1OfInteger from TColStd,
64 SequenceOfAsciiString, HSequenceOfHAsciiString from TColStd,
65 InterfaceModel, Protocol, Graph, EntityIterator, CopyTool, CheckIterator,
66 ShareOutResult, ShareOut, WorkLibrary, GeneralModifier, Modifier,
67 SequenceOfGeneralModifier, SequenceOfInterfaceModel,
68 AppliedModifiers, SequenceOfAppliedModifiers
69
70is
71
72 Create returns mutable ModelCopier;
73 ---Purpose : Creates an empty ModelCopier
74
75 SetShareOut (me : mutable; sho : ShareOut);
76 ---Purpose : Sets the ShareOut, which is used to define Modifiers to apply
77
78 ClearResult (me : mutable);
79 ---Purpose : Clears the list of produced Models
80
81 AddFile (me : mutable; filename : AsciiString from TCollection;
82 content : InterfaceModel) returns Boolean;
83 ---Purpose : Records a new File to be sent, as a couple
84 -- (Name as AsciiString, Content as InterfaceModel)
85 -- Returns True if Done, False if <filename> is already attached
86 -- to another File
87
88 NameFile (me : mutable; num : Integer; filename : AsciiString)
89 returns Boolean;
90 ---Purpose : Changes the Name attached to a File which was formerly defined
91 -- by a call to AddFile
92 -- Returns True if Done, False else : if <num> out of range or if
93 -- the new <filename> is already attached to another File
94 -- Remark : Giving an empty File Name is equivalent to ClearFile
95
96 ClearFile (me : mutable; num : Integer) returns Boolean;
97 ---Purpose : Clears the Name attached to a File which was formerly defined
98 -- by a call to AddFile. This Clearing can be undone by a call to
99 -- NameFile (with same <num>)
100 -- Returns True if Done, False else : if <num> is out of range
101
102 SetAppliedModifiers (me : mutable; num : Integer;
103 applied : mutable AppliedModifiers) returns Boolean;
104 ---Purpose : Sets a list of File Modifiers to be applied on a file
105
106 ClearAppliedModifiers (me : mutable; num : Integer) returns Boolean;
107 ---Purpose : Clears the list of File Modifiers to be applied on a file
108
109
110 Copy (me : mutable; eval : in out ShareOutResult;
111 WL : WorkLibrary; protocol : Protocol)
112 returns CheckIterator;
113 ---Purpose : Performs the Copy Operations, which include the Modifications
114 -- defined by the list of Modifiers. Memorizes the result, as a
115 -- list of InterfaceModels with the corresponding FileNames
116 -- They can then be sent, by the method Send, or queried
117 -- Copy calls internal method Copying.
118 -- Returns the produced CheckList
119
120 Copying (me : mutable; eval : in out ShareOutResult;
121 WL : WorkLibrary; protocol : Protocol; TC : in out CopyTool)
122 returns CheckIterator is protected;
123 ---Purpose : Internal routine which does the effective Copy. It allows to
124 -- work, either with a standard CopyTool, or a specialised one
125 -- Copying itself is done by <WL> which uses a CopyTool
126
127 SendCopied (me : mutable; WL : WorkLibrary; protocol : Protocol)
128 returns CheckIterator;
129 ---Purpose : Sends the formerly defined results (see method Copy) to files,
130 -- then clears it
131 -- Remark : A Null File Name cause file to be not produced
132
133 Send (me : mutable; eval : in out ShareOutResult;
134 WL : WorkLibrary; protocol : Protocol)
135 returns CheckIterator;
136 ---Purpose : Performs the Copy Operations (which include the Modifications)
137 -- and Sends the result on files, without memorizing it.
138 -- (the memorized result is ignored : neither queried not filled)
139
140 Sending (me : mutable; eval : in out ShareOutResult;
141 WL : WorkLibrary; protocol : Protocol; TC : in out CopyTool)
142 returns CheckIterator is protected;
143 ---Purpose : Internal routine which does the effective Send. It allows to
144 -- work, either with a standard CopyTool, or a specialised one
145
146 SendAll (me : mutable; filename : CString; G : Graph;
147 WL : WorkLibrary; protocol : Protocol)
148 returns CheckIterator;
149 ---Purpose : Sends a model (defined in <G>) into one file, without managing
150 -- remaining data, already sent files, etc. Applies the Model and
151 -- File Modifiers.
152 -- Returns True if well done, False else
153
154 SendSelected (me : mutable; filename : CString; G : Graph;
155 WL : WorkLibrary; protocol : Protocol;
156 iter : EntityIterator)
157 returns CheckIterator;
158 ---Purpose : Sends a part of a model into one file. Model is gotten from
159 -- <G>, the part is defined in <iter>.
160 -- Remaining data are managed and can be later be worked on.
161 -- Returns True if well done, False else
162
163 CopiedModel (me; G : Graph;
164 WL : WorkLibrary;
165 protocol : Protocol;
166 topcopy : EntityIterator;
167 filename : AsciiString from TCollection;
168 dispnum, numod : Integer;
169 TC : in out CopyTool;
170 newmod : out mutable InterfaceModel;
171 applied : out mutable AppliedModifiers;
172 checks : out CheckIterator)
173 is protected;
174 ---Purpose : Performs the Copy of a unitary Packet
175 -- Input parameters are :
176 -- <G> is the graph which defines the starting entities, it
177 -- contains the original InterfaceModel
178 -- <WL> performs the copy by using <TC>
179 -- <protocol> is the used protocol (can be usefull for Modifiers)
180 -- <topcopy> is the list of Entities which are the Roots of the
181 -- packet to be copied
182 -- <filename> is the name of the file which will receive it
183 -- <dispid> is the Identifier of the Dispatch which have produced
184 -- this packet, <numod> is the rank of the packet for this
185 -- Dispatch
186 -- <TC> is a CopyTool, which performs the copy
187 --
188 -- Returned values (as arguments) are :
189 -- <newmod> is the result of the copy, as a new InterfaceModel on
190 -- which Model Modifiers have already been applied (if there are)
191 -- <applied> determines the File Modifiers which remain to be
192 -- applied (when the file itself will be output) : for each File
193 -- Modifier recorded in <me>, <applied>'s Value is :
194 -- - Null if this Modifier has not to be applied
195 -- - an empty list if this Modifier has to be applied without
196 -- distinguishing specific entities
197 -- - a list of numbers of entities in <model> if this Modifier
198 -- concerns particularly these entities (which are the results
199 -- of copying the result of its input selection)
200 -- <checks> is the produced Check List (by Modifiers as required)
201 --
202 -- Warning : File Modifiers are evaluated at the time of Copy itself
203 -- If their list is changed between this Copy and the Sending
204 -- itself of the file, these changes are ignored
205
206 CopiedRemaining (me : mutable; G : Graph;
207 WL : WorkLibrary;
208 TC : in out CopyTool;
209 newmod : out mutable InterfaceModel);
210 ---Purpose : Produces a Model copied from the Remaining List as <newmod>
211 -- <newmod> is a Null Handle if this list is empty
212 -- <WL> performs the copy by using <TC>
213 -- <TC> is assumed to have been defined with the starting model
214 -- same as defined by <G>.
215
216 SetRemaining (me; CG : in out Graph) returns Boolean;
217 ---Purpose : Updates Graph status for remaining data, for each entity :
218 -- - Entities just Sent to file or Copied (by CopiedRemaining)
219 -- have their status set to 1
220 -- - the other keep their former status (1 for Send/Copied,
221 -- 0 for Remaining)
222 -- These status are computed by Copying/Sending/CopiedRemaining
223 -- Then, SetRemaining updates graph status, and mustr be called
224 -- just after one of these method has been called
225 -- Returns True if done, False if remaining info if not in phase
226 -- which the Graph (not same counts of items)
227
228
229 NbFiles (me) returns Integer;
230 ---Purpose : Returns the count of Files produced, i.e. the count of Models
231 -- memorized (produced by the mmethod Copy) with their file names
232
233 FileName (me; num : Integer) returns AsciiString from TCollection;
234 ---Purpose : Returns the File Name for a file given its rank
235 -- It is empty after a call to ClearFile on same <num>
236
237 FileModel (me; num : Integer) returns mutable InterfaceModel;
238 ---Purpose : Returns the content of a file before sending, under the form
239 -- of an InterfaceModel, given its rank
240
241 AppliedModifiers (me; num : Integer) returns mutable AppliedModifiers;
242 ---Purpose : Returns the list of File Modifiers to be applied on a file
243 -- when it will be sent, as computed by CopiedModel :
244 -- If it is a null handle, no File Modifier has to be applied.
245
246
247 BeginSentFiles (me : mutable; sho : mutable ShareOut; record : Boolean);
248 ---Purpose : Begins a sequence of recording the really sent files
249 -- <sho> : the default file numbering is cleared
250 -- If <record> is False, clears the list and stops recording
251 -- If <record> is True, clears the list and commands recording
252 -- Creation time corresponds to "stop recording"
253
254 AddSentFile (me : mutable; filename : CString);
255 ---Purpose : Adds the name of a just sent file, if BeginSentFiles
256 -- has commanded recording; else does nothing
257 -- It is called by methods SendCopied Sending
258
259 SentFiles (me) returns HSequenceOfHAsciiString from TColStd;
260 ---Purpose : Returns the list of recorded names of sent files. Can be empty
261 -- (if no file has been sent). Returns a Null Handle if
262 -- BeginSentFiles has stopped recording.
263
264fields
265
266 thefilemodels : SequenceOfInterfaceModel;
267 thefilenames : SequenceOfAsciiString;
268 theapplieds : SequenceOfAppliedModifiers;
269 theshareout : ShareOut; -- for copy-send operation (names, modifiers)
270 theremain : HArray1OfInteger;
271 thesentfiles : HSequenceOfHAsciiString;
272
273end ModelCopier;