b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <IFSelect_ModelCopier.ixx> |
19 | #include <IFSelect_Selection.hxx> |
20 | #include <IFSelect_GeneralModifier.hxx> |
21 | #include <IFSelect_Modifier.hxx> |
22 | #include <IFSelect_ContextModif.hxx> |
23 | #include <IFSelect_ContextWrite.hxx> |
24 | #include <TColStd_HSequenceOfInteger.hxx> |
25 | #include <TCollection_HAsciiString.hxx> |
26 | #include <Interface_Check.hxx> |
27 | #include <Interface_CheckIterator.hxx> |
28 | #include <Interface_GeneralLib.hxx> |
29 | #include <Message_Messenger.hxx> |
30 | #include <Message.hxx> |
31 | #include <stdio.h> |
32 | |
33 | //#define MISOPOINT |
34 | |
35 | |
b311480e |
36 | IFSelect_ModelCopier::IFSelect_ModelCopier () { } |
7fd59977 |
37 | |
38 | void IFSelect_ModelCopier::SetShareOut |
39 | (const Handle(IFSelect_ShareOut)& sho) |
40 | { theshareout = sho; } |
41 | |
42 | |
43 | // ######################################################################## |
44 | // ######## OPERATIONS DE TRANSFERT GLOBAL (memorise ou non) ######## |
45 | |
46 | |
47 | void IFSelect_ModelCopier::ClearResult () |
48 | { thefilemodels.Clear(); thefilenames.Clear(); theapplieds.Clear(); |
49 | theremain.Nullify(); } |
50 | |
51 | |
52 | Standard_Boolean IFSelect_ModelCopier::AddFile |
53 | (const TCollection_AsciiString& filename, |
54 | const Handle(Interface_InterfaceModel)& content) |
55 | { |
56 | Standard_Integer nb = thefilenames.Length(); |
57 | for (Standard_Integer i = 1; i <= nb; i ++) { |
58 | if (filename.IsEmpty()) continue; |
59 | if (thefilenames(i).IsEqual(filename)) return Standard_False; |
60 | } |
61 | Handle(IFSelect_AppliedModifiers) nulapplied; |
62 | thefilenames.Append (filename); |
63 | thefilemodels.Append (content); |
64 | theapplieds.Append (nulapplied); |
65 | return Standard_True; |
66 | } |
67 | |
68 | Standard_Boolean IFSelect_ModelCopier::NameFile |
69 | (const Standard_Integer num, |
70 | const TCollection_AsciiString& filename) |
71 | { |
72 | Standard_Integer nb = thefilenames.Length(); |
73 | if (num <= 0 || num > nb) return Standard_False; |
74 | for (Standard_Integer i = 1; i <= nb; i ++) { |
75 | if (filename.IsEmpty()) continue; |
76 | if (thefilenames(i).IsEqual(filename)) return Standard_False; |
77 | } |
78 | thefilenames.SetValue(num,filename); |
79 | return Standard_True; |
80 | } |
81 | |
82 | Standard_Boolean IFSelect_ModelCopier::ClearFile |
83 | (const Standard_Integer num) |
84 | { |
85 | Standard_Integer nb = thefilenames.Length(); |
86 | if (num <= 0 || num > nb) return Standard_False; |
87 | thefilenames.ChangeValue(num).Clear(); |
88 | return Standard_True; |
89 | } |
90 | |
91 | Standard_Boolean IFSelect_ModelCopier::SetAppliedModifiers |
92 | (const Standard_Integer num, const Handle(IFSelect_AppliedModifiers)& applied) |
93 | { |
94 | Standard_Integer nb = theapplieds.Length(); |
95 | if (num <= 0 || num > nb) return Standard_False; |
96 | theapplieds.SetValue(num,applied); |
97 | return Standard_True; |
98 | } |
99 | |
100 | Standard_Boolean IFSelect_ModelCopier::ClearAppliedModifiers |
101 | (const Standard_Integer num) |
102 | { |
103 | Standard_Integer nb = theapplieds.Length(); |
104 | if (num <= 0 || num > nb) return Standard_False; |
105 | theapplieds.ChangeValue(num).Nullify(); |
106 | return Standard_True; |
107 | } |
108 | |
109 | // .... Copy : Opere les Transferts, les Memorise (pas d envoi fichier ici) |
110 | |
111 | Interface_CheckIterator IFSelect_ModelCopier::Copy |
112 | (IFSelect_ShareOutResult& eval, |
113 | const Handle(IFSelect_WorkLibrary)& WL, |
114 | const Handle(Interface_Protocol)& protocol) |
115 | { |
116 | Interface_CopyTool TC (eval.Graph().Model(), protocol); |
117 | return Copying (eval,WL,protocol,TC); |
118 | } |
119 | |
120 | // Copy Interne |
121 | |
122 | Interface_CheckIterator IFSelect_ModelCopier::Copying |
123 | (IFSelect_ShareOutResult& eval, |
124 | const Handle(IFSelect_WorkLibrary)& WL, |
125 | const Handle(Interface_Protocol)& protocol, |
126 | Interface_CopyTool& TC) |
127 | { |
128 | Message::DefaultMessenger() << |
129 | "** WorkSession : Copying split data before sending"<<endl; |
130 | const Interface_Graph& G = eval.Graph(); |
131 | Interface_CheckIterator checks; |
132 | theshareout = eval.ShareOut(); |
133 | theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); |
134 | for (eval.Evaluate(); eval.More(); eval.Next()) { |
135 | Handle(Interface_InterfaceModel) model; |
136 | TCollection_AsciiString filename = eval.FileName(); |
137 | Standard_Integer dispnum = eval.DispatchRank(); |
138 | Standard_Integer numod, nbmod; |
139 | eval.PacketsInDispatch (numod,nbmod); |
140 | Handle(IFSelect_AppliedModifiers) curapp; |
141 | CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, |
142 | model, curapp,checks); |
143 | |
144 | AddFile (filename, model); |
145 | theapplieds.SetValue (theapplieds.Length(), curapp); |
146 | } |
147 | theshareout->SetLastRun (theshareout->NbDispatches()); |
148 | checks.SetName ("X-STEP WorkSession : Split Copy (no Write)"); |
149 | return checks; |
150 | } |
151 | |
152 | // Send a deux arguments : Envoi Fichier du Resultat deja memorise |
153 | |
154 | Interface_CheckIterator IFSelect_ModelCopier::SendCopied |
155 | (const Handle(IFSelect_WorkLibrary)& WL, |
156 | const Handle(Interface_Protocol)& protocol) |
157 | { |
158 | Message::DefaultMessenger() << |
159 | "** WorkSession : Sending split data already copied"<<endl; |
160 | Standard_Integer nb = NbFiles(); |
161 | Interface_CheckIterator checks; |
162 | if (nb > 0) { |
163 | for (Standard_Integer i = 1; i <= nb; i ++) { |
164 | if (FileName(i).Length() == 0) continue; |
165 | Handle(IFSelect_AppliedModifiers) curapp = theapplieds.Value(i); |
166 | IFSelect_ContextWrite ctx (FileModel(i),protocol,curapp,FileName(i).ToCString()); |
167 | Standard_Boolean res = WL->WriteFile (ctx); |
168 | Interface_CheckIterator checklst = ctx.CheckList(); |
169 | checks.Merge(checklst); |
170 | // (FileName(i).ToCString(), FileModel(i),protocol,curapp,checks); |
171 | // if (!checks.IsEmpty(Standard_False)) { |
172 | // sout<<" ** On Sending File n0."<<i<<", Check Messages : **"<<endl; |
173 | // checks.Print (sout,Standard_False); |
174 | // } |
175 | if (!res) { |
176 | char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i); |
177 | checks.CCheck(0)->AddFail (mess); |
178 | Message::DefaultMessenger() << |
179 | " ** Sending File n0."<<i<<" has failed, abandon **"<<endl; |
180 | return checks; |
181 | } |
182 | AddSentFile (FileName(i).ToCString()); |
183 | } |
184 | ClearResult(); |
185 | } |
186 | checks.SetName ("X-STEP WorkSession : Split Send (Copy+Write)"); |
187 | return checks; |
188 | } |
189 | |
190 | |
191 | // .... Send a 4 arguments : Calcul du Transfert et Envoi sur Fichier |
192 | |
193 | Interface_CheckIterator IFSelect_ModelCopier::Send |
194 | (IFSelect_ShareOutResult& eval, |
195 | const Handle(IFSelect_WorkLibrary)& WL, |
196 | const Handle(Interface_Protocol)& protocol) |
197 | { |
198 | Interface_CopyTool TC (eval.Graph().Model(), protocol); |
199 | return Sending (eval,WL,protocol,TC); |
200 | } |
201 | |
202 | Interface_CheckIterator IFSelect_ModelCopier::Sending |
203 | (IFSelect_ShareOutResult& eval, |
204 | const Handle(IFSelect_WorkLibrary)& WL, |
205 | const Handle(Interface_Protocol)& protocol, |
206 | Interface_CopyTool& TC) |
207 | { |
208 | const Interface_Graph& G = eval.Graph(); |
209 | Interface_CheckIterator checks; |
210 | Standard_Integer i = 0; |
211 | Message::DefaultMessenger() << |
212 | "** WorkSession : Copying then sending split data"<<endl; |
213 | theshareout = eval.ShareOut(); |
214 | theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); |
215 | for (eval.Evaluate(); eval.More(); eval.Next()) { |
216 | i ++; |
217 | Handle(Interface_InterfaceModel) model; |
218 | TCollection_AsciiString filename = eval.FileName(); |
219 | Standard_Integer dispnum = eval.DispatchRank(); |
220 | Standard_Integer numod, nbmod; |
221 | eval.PacketsInDispatch (numod,nbmod); |
222 | Handle(IFSelect_AppliedModifiers) curapp; |
223 | CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, |
224 | model, curapp, checks); |
225 | IFSelect_ContextWrite ctx (model,protocol,curapp,filename.ToCString()); |
226 | Standard_Boolean res = WL->WriteFile (ctx); |
227 | Interface_CheckIterator checklst = ctx.CheckList(); |
228 | checks.Merge(checklst); |
229 | // (filename.ToCString(), model, protocol, curapp, checks); |
230 | // if (!checks.IsEmpty(Standard_False)) { |
231 | // sout<<" ** On Sending File "<<filename<<", Check Messages : **"<<endl; |
232 | // checks.Print (sout,model,Standard_False); |
233 | // } |
234 | if (!res) { |
235 | char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i); |
236 | checks.CCheck(0)->AddFail (mess); |
237 | Message::DefaultMessenger() << |
238 | " ** Sending File "<<filename<<" has failed, abandon **"<<endl; |
239 | checks.SetName ("X-STEP WorkSession : Split Send (only Write)"); |
240 | return checks; |
241 | } |
242 | AddSentFile (filename.ToCString()); |
243 | } |
244 | theshareout->SetLastRun (theshareout->NbDispatches()); |
245 | checks.SetName ("X-STEP WorkSession : Split Send (only Write)"); |
246 | return checks; |
247 | } |
248 | |
249 | |
250 | // .... SendAll : Donnees a tranferer dans G, aucun split, envoi sur fichier |
251 | |
252 | Interface_CheckIterator IFSelect_ModelCopier::SendAll |
253 | (const Standard_CString filename, const Interface_Graph& G, |
254 | const Handle(IFSelect_WorkLibrary)& WL, |
255 | const Handle(Interface_Protocol)& protocol) |
256 | { |
257 | Interface_CheckIterator checks; |
258 | checks.SetName ("X-STEP WorkSession : Send All"); |
259 | Message::DefaultMessenger() << |
260 | "** WorkSession : Sending all data"<<endl; |
261 | Handle(Interface_InterfaceModel) model = G.Model(); |
262 | if (model.IsNull() || protocol.IsNull() || WL.IsNull()) return checks; |
263 | |
264 | Interface_CopyTool TC (model, protocol); |
265 | Standard_Integer i, nb = model->NbEntities(); |
266 | for (i = 1; i <= nb; i ++) TC.Bind (model->Value(i),model->Value(i)); |
267 | |
268 | Interface_EntityIterator pipo; |
269 | Handle(Interface_InterfaceModel) newmod; |
270 | Handle(IFSelect_AppliedModifiers) applied; |
271 | CopiedModel (G, WL,protocol,pipo,TCollection_AsciiString(filename), |
272 | 0,0,TC,newmod, applied,checks); |
273 | |
274 | IFSelect_ContextWrite ctx (model,protocol,applied,filename); |
275 | Standard_Boolean res = WL->WriteFile (ctx); |
276 | Interface_CheckIterator checklst = ctx.CheckList(); |
277 | checks.Merge(checklst); |
278 | if (!res) checks.CCheck(0)->AddFail ("SendAll (WriteFile) has failed"); |
279 | // if (!checks.IsEmpty(Standard_False)) { |
280 | // Message::DefaultMessenger() << |
281 | // " ** SendAll has produced Check Messages : **"<<endl; |
282 | // checks.Print (sout,model,Standard_False); |
283 | // } |
284 | return checks; |
285 | } |
286 | |
287 | |
288 | // .... SendSelected : Donnees a tranferer dans G, filtrees par iter, |
289 | // aucun split, envoi sur fichier |
290 | |
291 | Interface_CheckIterator IFSelect_ModelCopier::SendSelected |
292 | (const Standard_CString filename, const Interface_Graph& G, |
293 | const Handle(IFSelect_WorkLibrary)& WL, |
294 | const Handle(Interface_Protocol)& protocol, |
295 | const Interface_EntityIterator& list) |
296 | { |
297 | Interface_CheckIterator checks; |
298 | checks.SetName ("X-STEP WorkSession : Send Selected"); |
299 | Message::DefaultMessenger() << |
300 | "** WorkSession : Sending selected data"<<endl; |
301 | Handle(Interface_InterfaceModel) original = G.Model(); |
302 | if (original.IsNull() || protocol.IsNull() || WL.IsNull()) return checks; |
303 | Handle(Interface_InterfaceModel) newmod = original->NewEmptyModel(); |
304 | Interface_CopyTool TC (original, protocol); |
305 | TC.FillModel(newmod); // pour Header ... |
306 | |
307 | // Pas de copie : AddWithRefs plus declaration de Bind |
308 | Interface_GeneralLib lib(protocol); |
309 | for (list.Start(); list.More(); list.Next()) { |
310 | newmod->AddWithRefs (list.Value(),lib); |
311 | } |
312 | Standard_Integer i, nb = newmod->NbEntities(); |
313 | for (i = 1; i <= nb; i ++) TC.Bind (newmod->Value(i),newmod->Value(i)); |
314 | if (theremain.IsNull()) |
315 | { theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); } |
316 | |
317 | Interface_EntityIterator pipo; |
318 | Handle(IFSelect_AppliedModifiers) applied; |
319 | CopiedModel (G, WL,protocol, pipo,TCollection_AsciiString(filename), |
320 | 0,0,TC,newmod, applied,checks); |
321 | // Alimenter Remaining : les entites copiees sont a noter |
322 | Handle(Standard_Transient) ent1,ent2; |
323 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
324 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
325 | if (ic <= theremain->Upper()) |
326 | theremain->SetValue(ic,theremain->Value(ic)+1); |
327 | } |
328 | IFSelect_ContextWrite ctx (newmod,protocol,applied,filename); |
329 | Standard_Boolean res = WL->WriteFile (ctx); |
330 | Interface_CheckIterator checklst = ctx.CheckList(); |
331 | checks.Merge(checklst); |
332 | if (!res) checks.CCheck(0)->AddFail ("SendSelected (WriteFile) has failed"); |
333 | // if (!checks.IsEmpty(Standard_False)) { |
334 | // Message::DefaultMessenger() << |
335 | // " ** SendSelected has produced Check Messages : **"<<endl; |
336 | // checks.Print (sout,original,Standard_False); |
337 | // } |
338 | return checks; |
339 | } |
340 | |
341 | |
342 | // ########################################################################## |
343 | // ######## UN TRANSFERT UNITAIRE (avec Modifications) ######## |
344 | |
345 | void IFSelect_ModelCopier::CopiedModel |
346 | (const Interface_Graph& G, |
347 | const Handle(IFSelect_WorkLibrary)& WL, |
348 | const Handle(Interface_Protocol)& protocol, |
349 | const Interface_EntityIterator& tocopy, |
350 | const TCollection_AsciiString& filename, |
351 | const Standard_Integer dispnum, const Standard_Integer /* numod */, |
352 | Interface_CopyTool& TC, |
353 | Handle(Interface_InterfaceModel)& newmod, |
354 | Handle(IFSelect_AppliedModifiers)& applied, |
355 | Interface_CheckIterator& checks) const |
356 | { |
357 | // ... Premiere partie "standard" : remplissage du modele ... |
358 | // On cree le Modele, on le remplit avec les Entites, et avec le Header depart |
359 | |
360 | // ATTENTION : dispnum = 0 signifie prendre modele original, ne rien copier |
361 | // et aussi : pas de Dispatch (envoi en bloc) |
362 | |
363 | applied.Nullify(); |
364 | Handle(Interface_InterfaceModel) original = G.Model(); |
365 | if (dispnum > 0) { |
366 | newmod = original->NewEmptyModel(); |
367 | TC.Clear(); |
368 | WL->CopyModel (original,newmod,tocopy,TC); |
369 | |
370 | Handle(Standard_Transient) ent1,ent2; |
371 | // Alimenter Remaining : les entites copiees sont a noter |
372 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
373 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
374 | if (ic <= theremain->Upper()) |
375 | theremain->SetValue(ic,theremain->Value(ic)+1); |
376 | } |
377 | } |
378 | else if (newmod.IsNull()) newmod = original; |
379 | |
380 | // ... Ensuite : On prend en compte les Model Modifiers ... |
381 | Standard_Integer nbmod = 0; |
382 | if (!theshareout.IsNull()) nbmod = theshareout->NbModifiers(Standard_True); |
383 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
384 | for (i = 1; i <= nbmod; i ++) { |
385 | Handle(IFSelect_Modifier) unmod = theshareout->ModelModifier(i); |
386 | |
387 | // D abord, critere Dispatch/Packet |
388 | if (dispnum > 0) |
389 | if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; |
390 | IFSelect_ContextModif ctx (G,TC,filename.ToCString()); |
391 | // Ensuite, la Selection |
392 | Handle(IFSelect_Selection) sel = unmod->Selection(); |
393 | if (!sel.IsNull()) { |
394 | Interface_EntityIterator entiter = sel->UniqueResult(G); |
395 | ctx.Select (entiter); |
396 | } |
397 | if (ctx.IsForNone()) continue; |
398 | unmod->Perform (ctx,newmod,protocol,TC); |
399 | Interface_CheckIterator checklst = ctx.CheckList(); |
400 | checks.Merge (checklst); |
401 | |
402 | // Faut-il enregistrer les erreurs dans newmod ? bonne question |
403 | // if (!checks.IsEmpty(Standard_False)) { |
404 | // Message::DefaultMessenger() << |
405 | // " Messages on Copied Model n0 "<<numod<<", Dispatch Rank "<<dispnum<<endl; |
406 | // checks.Print(sout,newmod,Standard_False); |
407 | // } |
408 | } |
409 | |
410 | // ... Puis les File Modifiers : en fait, on les enregistre ... |
411 | nbmod = 0; |
412 | if (!theshareout.IsNull()) nbmod = theshareout->NbModifiers(Standard_False); |
413 | if (nbmod == 0) return; |
414 | applied = new IFSelect_AppliedModifiers (nbmod,newmod->NbEntities()); |
415 | for (i = 1; i <= nbmod; i ++) { |
416 | Handle(IFSelect_GeneralModifier) unmod = theshareout->GeneralModifier(Standard_False,i); |
417 | |
418 | // D abord, critere Dispatch/Packet |
419 | if (dispnum > 0) |
420 | if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; |
421 | // Ensuite, la Selection |
422 | Handle(IFSelect_Selection) sel = unmod->Selection(); |
423 | if (sel.IsNull()) applied->AddModif (unmod); // vide -> on prend tout |
424 | else { |
425 | Interface_EntityIterator list = sel->UniqueResult(G); |
426 | Handle(Standard_Transient) newent; |
427 | |
428 | // Entites designees par la Selection et Copiees ? |
429 | // -> s ilyena au moins une, le Modifier s applique, sinon il est rejete |
430 | // -> et cette liste est exploitable par le Modifier ... |
431 | for (list.Start(); list.More(); list.Next()) { |
432 | if (TC.Search (list.Value(),newent)) |
433 | applied->AddNum (newmod->Number(newent)); |
434 | } |
435 | } |
436 | } |
437 | } |
438 | |
439 | |
440 | void IFSelect_ModelCopier::CopiedRemaining |
441 | (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, |
442 | Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) |
443 | { |
444 | Handle(Interface_InterfaceModel) original = G.Model(); |
445 | // Interface_CopyTool TC(original,protocol); |
446 | newmod = original->NewEmptyModel(); |
447 | TC.Clear(); |
448 | Interface_EntityIterator tocopy; |
449 | Standard_Integer nb = G.Size(); |
450 | theremain = new TColStd_HArray1OfInteger(0,nb+1); theremain->Init(0); |
451 | for (Standard_Integer i = 1; i <= nb; i ++) { |
452 | if (G.Status(i) == 0) tocopy.AddItem (original->Value(i)); |
453 | else theremain->SetValue(i,-1); // ?? -1 |
454 | } |
455 | WL->CopyModel (original,newmod,tocopy,TC); |
456 | |
457 | if (newmod->NbEntities() == 0) newmod.Nullify(); |
458 | else { |
459 | // CE QUI SUIT NE DOIT PAS ETRE SUPPRIME ! cf theremain |
460 | Handle(Standard_Transient) ent1,ent2; |
461 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
462 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
463 | if (ic <= theremain->Upper()) |
464 | theremain->SetValue(ic,1); |
465 | } |
466 | // qq impressions de mise au point |
467 | #ifdef MISOPOINT |
468 | cout << " Remaining Model : " << newmod->NbEntities() << " Entities"<<endl; |
469 | Standard_Integer ne = 0; |
470 | for (i = 1; i <= nb; i ++) { |
471 | if (theremain->Value(i) == 0) { |
472 | if (ne == 0) cout << " Refractaires : "; |
473 | ne ++; cout << " " << i; |
474 | } |
475 | } |
476 | if (ne > 0) cout << " -- " << ne << " Entities" << endl; |
477 | else cout<<" -- Remaining data complete"<<endl; |
478 | #endif |
479 | } |
480 | } |
481 | |
482 | Standard_Boolean IFSelect_ModelCopier::SetRemaining |
483 | (Interface_Graph& CG) const |
484 | { |
485 | Standard_Integer nb = CG.Size(); |
486 | if (theremain.IsNull()) return (nb == 0); |
487 | if (nb != theremain->Upper()) return Standard_False; |
488 | for (Standard_Integer i = 1; i <= nb; i ++) { |
489 | if (CG.Status(i) >= 0) CG.SetStatus(i,CG.Status(i)+theremain->Value(i)); |
490 | } |
491 | theremain->Init(0); |
492 | return Standard_True; |
493 | } |
494 | |
495 | // ########################################################################## |
496 | // ######## RESULTAT de la Memorisation des Transferts ######## |
497 | |
498 | Standard_Integer IFSelect_ModelCopier::NbFiles () const |
499 | { return thefilemodels.Length(); } |
500 | |
501 | TCollection_AsciiString IFSelect_ModelCopier::FileName |
502 | (const Standard_Integer num) const |
503 | { return thefilenames.Value(num); } |
504 | |
505 | Handle(Interface_InterfaceModel) IFSelect_ModelCopier::FileModel |
506 | (const Standard_Integer num) const |
507 | { return thefilemodels.Value(num); } |
508 | |
509 | Handle(IFSelect_AppliedModifiers) IFSelect_ModelCopier::AppliedModifiers |
510 | (const Standard_Integer num) const |
511 | { return theapplieds.Value(num); } |
512 | |
513 | |
514 | void IFSelect_ModelCopier::BeginSentFiles |
515 | (const Handle(IFSelect_ShareOut)& sho, const Standard_Boolean record) |
516 | { |
517 | thesentfiles.Nullify(); |
518 | if (record) thesentfiles = new TColStd_HSequenceOfHAsciiString(); |
519 | // et numerotation des fichiers par defaut : detenue par ShareOut |
520 | if (sho.IsNull()) return; |
521 | Standard_Integer lastrun = sho->LastRun(); |
522 | sho->ClearResult (Standard_True); |
523 | sho->SetLastRun (lastrun); // on ne s interesse quaux numeros |
524 | } |
525 | |
526 | void IFSelect_ModelCopier::AddSentFile (const Standard_CString filename) |
527 | { if (!thesentfiles.IsNull()) |
528 | thesentfiles->Append(new TCollection_HAsciiString(filename)); } |
529 | |
530 | Handle(TColStd_HSequenceOfHAsciiString) IFSelect_ModelCopier::SentFiles () const |
531 | { return thesentfiles; } |