1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 //#1 svv 10.01.00 : porting on DEC
15 //smh#14 17.03.2000 : FRA62479 Clearing of gtool
16 #include <Standard_ErrorHandler.hxx>
17 #include <IFSelect_WorkSession.ixx>
18 #include <IFSelect_DispPerOne.hxx>
19 #include <IFSelect_DispPerCount.hxx>
20 #include <IFSelect_DispGlobal.hxx>
21 #include <IFSelect_ShareOutResult.hxx>
22 #include <Interface_Graph.hxx>
23 #include <IFGraph_SubPartsIterator.hxx>
24 #include <IFSelect_PacketList.hxx>
25 #include <Interface_ReportEntity.hxx>
26 #include <Interface_Static.hxx>
28 #include <IFSelect_SignValidity.hxx>
29 #include <Interface_Category.hxx>
30 #include <Interface_Check.hxx>
31 #include <Interface_CheckTool.hxx>
32 #include <Interface_CheckIterator.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Interface_ShareFlags.hxx>
35 #include <Interface_GeneralLib.hxx>
36 #include <Interface_GeneralModule.hxx>
37 #include <Dico_IteratorOfDictionaryOfTransient.hxx>
38 #include <Dico_IteratorOfDictionaryOfInteger.hxx>
39 #include <Interface_CopyTool.hxx>
40 #include <Interface_CopyControl.hxx>
42 #include <IFSelect_SelectDeduct.hxx>
43 #include <IFSelect_SelectExtract.hxx>
44 #include <IFSelect_SelectModelRoots.hxx>
45 #include <IFSelect_SelectModelEntities.hxx>
46 #include <IFSelect_SelectEntityNumber.hxx>
47 #include <IFSelect_SelectPointed.hxx>
48 #include <IFSelect_SelectControl.hxx>
49 #include <IFSelect_SelectDiff.hxx>
50 #include <IFSelect_SelectCombine.hxx>
51 #include <IFSelect_SelectUnion.hxx>
52 #include <IFSelect_SelectIntersection.hxx>
53 #include <IFSelect_SelectSignature.hxx>
55 #include <IFSelect_EditForm.hxx>
56 #include <IFSelect_Editor.hxx>
57 #include <IFSelect_ParamEditor.hxx>
58 #include <IFSelect_CheckCounter.hxx>
59 #include <IFSelect_TransformStandard.hxx>
61 #include <TColStd_MapOfInteger.hxx>
62 #include <OSD_Path.hxx>
63 #include <Interface_Macros.hxx>
64 #include <Interface_MSG.hxx>
65 #include <Message_Messenger.hxx>
66 #include <Message.hxx>
67 #include <Standard_Failure.hxx>
69 #define Flag_Incorrect 2
73 static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite
74 static TCollection_AsciiString bufstr;
77 // #################################################################
80 //=======================================================================
83 //=======================================================================
85 IFSelect_WorkSession::IFSelect_WorkSession ()
87 theshareout = new IFSelect_ShareOut;
88 theerrhand = errhand = Standard_True;
89 thenames = new Dico_DictionaryOfTransient;
90 thecopier = new IFSelect_ModelCopier;
91 thecopier->SetShareOut (theshareout);
92 thecheckdone = Standard_False;
93 thegtool = new Interface_GTool;
94 themodelstat = Standard_False;
98 //=======================================================================
101 //=======================================================================
103 void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand)
105 theerrhand = errhand = hand;
109 //=======================================================================
112 //=======================================================================
114 Standard_Boolean IFSelect_WorkSession::ErrorHandle () const
120 //=======================================================================
123 //=======================================================================
125 const Handle(IFSelect_ShareOut)& IFSelect_WorkSession::ShareOut () const
131 //=======================================================================
134 //=======================================================================
136 void IFSelect_WorkSession::SetLibrary (const Handle(IFSelect_WorkLibrary)& lib)
142 //=======================================================================
145 //=======================================================================
147 Handle(IFSelect_WorkLibrary) IFSelect_WorkSession::WorkLibrary () const
153 //=======================================================================
156 //=======================================================================
158 void IFSelect_WorkSession::SetProtocol
159 (const Handle(Interface_Protocol)& protocol)
161 theprotocol = protocol;
162 Interface_Protocol::SetActive(protocol);
163 thegtool->SetProtocol (protocol);
167 //=======================================================================
170 //=======================================================================
172 Handle(Interface_Protocol) IFSelect_WorkSession::Protocol () const
178 //=======================================================================
181 //=======================================================================
183 void IFSelect_WorkSession::SetSignType
184 (const Handle(IFSelect_Signature)& signtype)
186 thegtool->SetSignType (signtype);
187 if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type");
188 else thenames->SetItem ("xst-sign-type",signtype);
192 //=======================================================================
195 //=======================================================================
197 Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const
199 return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
203 //=======================================================================
206 //=======================================================================
208 void IFSelect_WorkSession::SetShareOut
209 (const Handle(IFSelect_ShareOut)& shareout)
211 theshareout = shareout;
212 thecopier->SetShareOut (theshareout);
213 // ... faudrait ajouter les Params, Dispatches, etc...
217 //=======================================================================
220 //=======================================================================
222 Standard_Boolean IFSelect_WorkSession::HasModel () const
224 return (!themodel.IsNull());
228 //=======================================================================
231 //=======================================================================
233 void IFSelect_WorkSession::SetModel
234 (const Handle(Interface_InterfaceModel)& model,
235 const Standard_Boolean clearpointed)
237 if (themodel != model) {
239 //skl if (!themodel.IsNull()) themodel->Clear();
242 if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
243 // themodel->SetProtocol(theprotocol);
244 themodel->SetGTool (thegtool);
247 ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien
248 ClearData(3); // RAZ CheckList, a refaire
251 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
252 if (clearpointed) ClearData(4);
257 //=======================================================================
260 //=======================================================================
261 Handle(Interface_InterfaceModel) IFSelect_WorkSession::Model () const
267 //=======================================================================
270 //=======================================================================
272 void IFSelect_WorkSession::SetLoadedFile (const Standard_CString filename)
275 theloaded.AssignCat (filename);
279 //=======================================================================
282 //=======================================================================
284 Standard_CString IFSelect_WorkSession::LoadedFile () const
286 return theloaded.ToCString();
290 //=======================================================================
293 //=======================================================================
295 IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
296 (const Standard_CString filename)
298 if (thelibrary.IsNull()) return IFSelect_RetVoid;
299 if (theprotocol.IsNull()) return IFSelect_RetVoid;
300 Handle(Interface_InterfaceModel) model;
301 IFSelect_ReturnStatus status = IFSelect_RetVoid;
304 Standard_Integer stat = thelibrary->ReadFile (filename,model,theprotocol);
305 if (stat == 0) status = IFSelect_RetDone;
306 else if (stat < 0) status = IFSelect_RetError;
307 else status = IFSelect_RetFail;
309 catch(Standard_Failure) {
310 Handle(Message_Messenger) sout = Message::DefaultMessenger();
311 sout<<" **** Interruption ReadFile par Exception : ****\n";
312 sout << Standard_Failure::Caught()->GetMessageString();
313 sout<<"\n Abandon"<<endl;
314 status = IFSelect_RetFail;
316 if (status != IFSelect_RetDone) return status;
317 if (model.IsNull()) return IFSelect_RetVoid;
319 SetLoadedFile (filename);
324 //=======================================================================
327 //=======================================================================
329 Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
331 if (themodel.IsNull()) return 0;
332 return themodel->NbEntities();
336 //=======================================================================
339 //=======================================================================
341 Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity
342 (const Standard_Integer num) const
344 Handle(Standard_Transient) res; // Null par defaut
345 if (themodel.IsNull()) return res;
346 if (num < 1 || num > themodel->NbEntities()) return res;
347 return themodel->Value(num);
351 //=======================================================================
354 //=======================================================================
356 Standard_Integer IFSelect_WorkSession::StartingNumber
357 (const Handle(Standard_Transient)& ent) const
359 if (themodel.IsNull()) return 0;
360 return themodel->Number(ent);
364 //=======================================================================
367 //=======================================================================
369 Standard_Integer IFSelect_WorkSession::NumberFromLabel
370 (const Standard_CString val, const Standard_Integer afternum) const
372 Standard_Integer i, cnt = 0, num = atoi(val);
373 if (num > 0 || themodel.IsNull()) return num; // un n0 direct : gagne !
374 // Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
375 if (num > themodel->NbEntities()) { num = 0; return num; }
376 Standard_Boolean exact = Standard_False;
377 Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
378 for (i = themodel->NextNumberForLabel (val, after, exact) ; i != 0;
379 i = themodel->NextNumberForLabel (val, i, exact)) {
381 if (num <= 0) num = i;
383 if (cnt == 1) return num;
390 //=======================================================================
393 //=======================================================================
395 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel
396 (const Handle(Standard_Transient)& ent) const
398 Handle(TCollection_HAsciiString) name;
399 if (themodel.IsNull() || ent.IsNull()) return name;
400 if (!themodel->Contains(ent)) return name;
401 name = themodel->StringLabel(ent);
406 //=======================================================================
409 //=======================================================================
411 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName
412 (const Handle(Standard_Transient)& ent) const
414 Handle(TCollection_HAsciiString) name;
415 if (themodel.IsNull() || ent.IsNull()) return name;
416 Interface_ShareTool sht(thegraph->Graph());
419 Handle(Interface_GeneralModule) module;
420 if (!thegtool->Select (ent,module,CN)) return 0;
421 return module->Name (CN,ent,sht);
425 //=======================================================================
428 //=======================================================================
430 Standard_Integer IFSelect_WorkSession::CategoryNumber
431 (const Handle(Standard_Transient)& ent) const
433 if (themodel.IsNull()) return -1;
434 Standard_Integer num = StartingNumber(ent);
435 return themodel->CategoryNumber(num);
439 //=======================================================================
442 //=======================================================================
444 Standard_CString IFSelect_WorkSession::CategoryName
445 (const Handle(Standard_Transient)& ent) const
447 Standard_Integer cn = CategoryNumber (ent);
448 return Interface_Category::Name (cn);
452 //=======================================================================
455 //=======================================================================
457 Standard_CString IFSelect_WorkSession::ValidityName
458 (const Handle(Standard_Transient)& ent) const
460 if (StartingNumber(ent) == 0) return "";
461 return IFSelect_SignValidity::CVal (ent,themodel);
465 //=======================================================================
468 //=======================================================================
470 void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
475 if (!themodel.IsNull()) themodel->Clear();
477 ClearData(2); ClearData(4);
481 case 2 : { thegraph.Nullify(); thecheckdone = Standard_False; thecheckana.Clear(); break; }
482 case 3 : { thecheckdone = Standard_False; break; }
484 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
485 // AINSI que des editeurs (en fait, les EditForm)
486 // Des compteurs C-A-D on efface leur contenu (a reevaluer)
487 Handle(TColStd_HSequenceOfInteger) list =
488 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
489 Standard_Integer nb = list->Length();
490 Standard_Integer i; // svv #1
491 for (i = 1; i <= nb; i ++) {
492 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
493 if (!sp.IsNull()) sp->Clear();
495 list = ItemIdents(STANDARD_TYPE(IFSelect_SignatureList));
497 for (i = 1; i <= nb; i ++) {
498 DeclareAndCast(IFSelect_SignatureList,sl,Item(list->Value(i)));
499 if (!sl.IsNull()) sl->Clear();
500 DeclareAndCast(IFSelect_SignCounter,sc,sl);
501 if (!sc.IsNull()) sc->SetSelMode(-1);
503 list = ItemIdents(STANDARD_TYPE(IFSelect_EditForm));
505 Handle(Standard_Transient) nulent;
506 for (i = 1; i <= nb; i ++) {
507 DeclareAndCast(IFSelect_EditForm,edf,Item(list->Value(i)));
518 //=======================================================================
521 //=======================================================================
523 Standard_Boolean IFSelect_WorkSession::ComputeGraph
524 (const Standard_Boolean enforce)
526 if (theprotocol.IsNull()) return Standard_False;
527 if (themodel.IsNull()) return Standard_False;
528 //if (themodel->NbEntities() == 0) return Standard_False;
529 if (enforce) thegraph.Nullify();
530 if (!thegraph.IsNull()) {
531 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
534 if (themodel->NbEntities() == 0) return Standard_False;
535 // Il faut calculer le graphe pour de bon
536 thegraph = new Interface_HGraph (themodel,themodelstat);
537 Standard_Integer nb = themodel->NbEntities();
540 Standard_Integer i; // svv #1
541 for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0);
542 Interface_BitMap& bm = thegraph->CGraph().CBitMap();
544 bm.SetFlagName (Flag_Incorrect,"Incorrect");
547 thecheckdone = Standard_True;
550 // Calcul des categories, a present memorisees dans le modele
551 Interface_Category categ(thegtool);
552 Interface_ShareTool sht(thegraph);
553 Standard_Integer i =1;
554 for ( ; i <= nb; i ++) themodel->SetCategoryNumber
555 (i,categ.CatNum(themodel->Value(i),sht));
558 return Standard_True;
562 //=======================================================================
565 //=======================================================================
567 Handle(Interface_HGraph) IFSelect_WorkSession::HGraph ()
574 //=======================================================================
577 //=======================================================================
579 const Interface_Graph& IFSelect_WorkSession::Graph ()
582 if (thegraph.IsNull()) Standard_DomainError::Raise
583 ("IFSelect WorkSession : Graph not available");
584 return thegraph->Graph();
588 //=======================================================================
591 //=======================================================================
593 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds
594 (const Handle(Standard_Transient)& ent)
596 Handle(TColStd_HSequenceOfTransient) list;
597 if (!ComputeGraph()) return list;
598 if (StartingNumber(ent) == 0) return list;
599 return thegraph->Graph().Shareds(ent).Content();
603 //=======================================================================
606 //=======================================================================
608 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings
609 (const Handle(Standard_Transient)& ent)
611 Handle(TColStd_HSequenceOfTransient) list;
612 if (!ComputeGraph()) return list;
613 if (StartingNumber(ent) == 0) return list;
614 return thegraph->Graph().Sharings(ent).Content();
618 //=======================================================================
621 //=======================================================================
623 Standard_Boolean IFSelect_WorkSession::IsLoaded () const
625 if (theprotocol.IsNull()) return Standard_False;
626 if (themodel.IsNull()) return Standard_False;
627 if (themodel->NbEntities() == 0) return Standard_False;
628 if (thegraph.IsNull()) return Standard_False;
629 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
630 return Standard_False;
634 //=======================================================================
637 //=======================================================================
639 Standard_Boolean IFSelect_WorkSession::ComputeCheck
640 (const Standard_Boolean enforce)
642 if (enforce) thecheckdone = Standard_False;
643 if (thecheckdone) return Standard_True;
644 if (!IsLoaded()) return Standard_False;
646 Interface_Graph& CG = thegraph->CGraph();
647 Interface_CheckTool cht(thegraph);
648 Interface_CheckIterator checklist = cht.VerifyCheckList();
649 themodel->FillSemanticChecks(checklist,Standard_False);
652 // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM)
653 Interface_BitMap& BM = CG.CBitMap();
654 BM.Init (Standard_False,Flag_Incorrect);
655 Standard_Integer num, nb = CG.Size();
656 for (checklist.Start(); checklist.More(); checklist.Next()) {
657 const Handle(Interface_Check) chk = checklist.Value();
658 if (!chk->HasFailed()) continue;
659 num = checklist.Number();
660 if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
662 for (num = 1; num <= nb; num ++)
663 if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
665 return Standard_True;
669 //=======================================================================
672 //=======================================================================
674 Interface_CheckIterator IFSelect_WorkSession::ModelCheckList
675 (const Standard_Boolean complete)
677 Interface_CheckIterator checks;
679 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
682 Interface_CheckTool cht(Graph());
683 checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList());
685 ((char*)(complete ? "Model Complete Check List" : "Model Syntactic Check List"));
690 //=======================================================================
693 //=======================================================================
695 Interface_CheckIterator IFSelect_WorkSession::CheckOne
696 (const Handle(Standard_Transient)& ent,
697 const Standard_Boolean complete)
699 Interface_CheckIterator checks;
700 checks.SetModel(themodel);
702 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
705 Standard_Integer num = -1;
706 if (ent.IsNull() || ent == themodel) num = 0;
707 else num = themodel->Number(ent);
709 Handle(Interface_Check) ach = themodel->Check (num,Standard_True);
710 if (complete) ach->GetMessages (themodel->Check (num,Standard_False));
711 if (num > 0) ach->SetEntity(ent);
712 checks.Add (ach,num);
713 checks.SetName ("Data Check (One Entity)");
718 //=======================================================================
721 //=======================================================================
723 Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const
729 // #####################################################################
730 // .... LES VARIABLES ....
732 //=======================================================================
735 //=======================================================================
737 Standard_Integer IFSelect_WorkSession::MaxIdent () const
739 return theitems.Extent();
743 //=======================================================================
746 //=======================================================================
748 Handle(Standard_Transient) IFSelect_WorkSession::Item
749 (const Standard_Integer id) const
751 Handle(Standard_Transient) res;
752 if (id <= 0 || id > MaxIdent()) return res;
753 if (theitems.FindFromIndex(id).IsNull()) return res;
754 return theitems.FindKey(id);
758 //=======================================================================
761 //=======================================================================
763 Standard_Integer IFSelect_WorkSession::ItemIdent
764 (const Handle(Standard_Transient)& item) const
766 if (item.IsNull()) return 0;
767 Standard_Integer id = theitems.FindIndex(item);
768 if (id == 0) return 0;
769 if (theitems.FindFromIndex(id).IsNull()) return 0;
774 //=======================================================================
777 //=======================================================================
779 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
780 (const Standard_CString name) const
782 Handle(Standard_Transient) res;
783 if (name[0] == '\0') return res;
784 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
785 Standard_Integer id = atoi( &name[1] );
788 if (!thenames->GetItem(name,res)) res.Nullify();
793 //=======================================================================
796 //=======================================================================
798 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
799 (const Handle(TCollection_HAsciiString)& name) const
801 Handle(Standard_Transient) res;
802 if (!name.IsNull()) res = NamedItem (name->ToCString());
807 //=======================================================================
810 //=======================================================================
812 Standard_Integer IFSelect_WorkSession::NameIdent
813 (const Standard_CString name) const
815 Handle(Standard_Transient) res;
816 if (name[0] == '\0') return 0;
817 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
818 Standard_Integer id = atoi( &name[1] );
821 if (!thenames->GetItem(name,res)) return 0;
822 return ItemIdent(res);
826 //=======================================================================
829 //=======================================================================
831 Standard_Boolean IFSelect_WorkSession::HasName
832 (const Handle(Standard_Transient)& item) const
834 if (item.IsNull()) return Standard_False;
835 Standard_Integer id = theitems.FindIndex(item);
836 if (id == 0) return Standard_False;
837 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
838 if (att.IsNull()) return Standard_False;
839 return att->IsKind(STANDARD_TYPE(TCollection_HAsciiString));
843 //=======================================================================
846 //=======================================================================
848 Handle(TCollection_HAsciiString) IFSelect_WorkSession::Name
849 (const Handle(Standard_Transient)& item) const
851 Handle(TCollection_HAsciiString) res;
852 if (item.IsNull()) return res;
853 Standard_Integer id = theitems.FindIndex(item);
854 if (id == 0) return res; // Null
855 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
856 return GetCasted(TCollection_HAsciiString,att);
860 //=======================================================================
863 //=======================================================================
865 Standard_Integer IFSelect_WorkSession::AddItem
866 (const Handle(Standard_Transient)& item,
867 const Standard_Boolean active)
869 if (item.IsNull()) return 0;
870 Standard_Integer id = theitems.FindIndex(item);
872 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
873 if (att.IsNull()) att = item;
875 else id = theitems.Add(item,item);
877 // Cas particuliers : Dispatch,Modifier
878 if (active) SetActive(item,Standard_True);
883 //=======================================================================
886 //=======================================================================
888 Standard_Integer IFSelect_WorkSession::AddNamedItem
889 (const Standard_CString name, const Handle(Standard_Transient)& item,
890 const Standard_Boolean active)
892 if (item.IsNull()) return 0;
893 if (name[0] == '#' || name[0] == '!') return 0;
894 // #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom)
895 // nom deja pris : on ecrase l ancienne valeur
896 if (name[0] != '\0') {
897 Standard_Boolean deja;
898 Handle(Standard_Transient)& newitem = thenames->NewItem(name,deja);
899 // if (deja & item != newitem) return 0;
902 Standard_Integer id = theitems.FindIndex(item);
904 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
905 if (att.IsNull()) att = item;
906 if (name[0] != '\0') {
907 // if (!att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) ecrasement admis !
908 att = new TCollection_HAsciiString(name);
911 else if (name[0] != '\0')
912 id = theitems.Add(item,new TCollection_HAsciiString(name));
913 else id = theitems.Add(item,item);
915 // Cas particuliers : Dispatch,Modifier
916 if (active) SetActive(item,Standard_True);
921 //=======================================================================
924 //=======================================================================
926 Standard_Boolean IFSelect_WorkSession::SetActive
927 (const Handle(Standard_Transient)& item, const Standard_Boolean mode)
929 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
930 DeclareAndCast(IFSelect_Dispatch,disp,item);
931 Standard_Integer num = theshareout->DispatchRank(disp);
932 if ( num > theshareout->NbDispatches()) return Standard_False;
934 if (num > 0) return Standard_False;
935 theshareout->AddDispatch (disp);
936 return Standard_True;
938 if (num <= theshareout->LastRun()) return Standard_False;
939 theshareout->RemoveDispatch(num);
940 SetFileRoot(disp,""); // si onlynamed : nettoie aussi ShareOut
941 return Standard_True;
945 return Standard_False;
949 //=======================================================================
952 //=======================================================================
954 Standard_Boolean IFSelect_WorkSession::RemoveNamedItem
955 (const Standard_CString name)
957 Handle(Standard_Transient) item = NamedItem(name);
958 if (item.IsNull()) return Standard_False;
959 if (!RemoveItem(item)) return Standard_False; // qui se charge de tout
960 return Standard_True;
964 //=======================================================================
967 //=======================================================================
969 Standard_Boolean IFSelect_WorkSession::RemoveName
970 (const Standard_CString name)
972 Handle(Standard_Transient) item = NamedItem(name);
973 if (item.IsNull()) return Standard_False;
974 theitems.Add(item,item); // reste mais sans nom
975 return thenames->RemoveItem(name);
979 //=======================================================================
982 //=======================================================================
984 Standard_Boolean IFSelect_WorkSession::RemoveItem
985 (const Handle(Standard_Transient)& item)
987 if (item.IsNull()) return Standard_False;
988 Standard_Integer id = theitems.FindIndex(item);
989 if (id == 0) return Standard_False;
990 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
991 if (att.IsNull()) return Standard_False; // deja annulle
993 // Cas particuliers : Dispatch,Modifier
994 theshareout->RemoveItem(item);
996 // Marquer "Removed" dans la Map (on ne peut pas la vider)
997 if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) {
998 if (!thenames->RemoveItem
999 (GetCasted(TCollection_HAsciiString,att)->ToCString()))
1000 return Standard_False;
1002 att.Nullify(); // cf ChangeFromIndex
1003 // id = theitems.Add(item,att);
1004 return Standard_True;
1008 //=======================================================================
1011 //=======================================================================
1013 void IFSelect_WorkSession::ClearItems ()
1017 theshareout->Clear(Standard_False);
1021 //=======================================================================
1024 //=======================================================================
1026 Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel
1027 (const Standard_Integer id) const
1029 Handle(TCollection_HAsciiString) res;
1030 Handle(Standard_Transient) var = Item(id);
1031 if (var.IsNull()) return res;
1032 DeclareAndCast(TCollection_HAsciiString,text,var);
1033 if (!text.IsNull()) {
1034 res = new TCollection_HAsciiString("Text:");
1035 res->AssignCat(text);
1038 DeclareAndCast(IFSelect_IntParam,intpar,var);
1039 if (!intpar.IsNull()) {
1040 res = new TCollection_HAsciiString(intpar->Value());
1041 res->Insert(1,"Integer:");
1044 DeclareAndCast(IFSelect_Selection,sel,var);
1045 if (!sel.IsNull()) {
1046 res = new TCollection_HAsciiString("Selection:");
1047 res->AssignCat(sel->Label().ToCString());
1050 DeclareAndCast(IFSelect_GeneralModifier,mod,var);
1051 if (!mod.IsNull()) {
1052 if (mod->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
1053 res = new TCollection_HAsciiString("ModelModifier:");
1054 else res = new TCollection_HAsciiString("FileModifier:");
1055 res->AssignCat(mod->Label().ToCString());
1058 DeclareAndCast(IFSelect_Dispatch,disp,var);
1059 if (!disp.IsNull()) {
1060 res = new TCollection_HAsciiString("Dispatch:");
1061 res->AssignCat(disp->Label().ToCString());
1064 DeclareAndCast(IFSelect_Transformer,tsf,var);
1065 if (!tsf.IsNull()) {
1066 res = new TCollection_HAsciiString("Transformer:");
1067 res->AssignCat(tsf->Label().ToCString());
1070 DeclareAndCast(IFSelect_SignatureList,slc,var);
1071 if (!slc.IsNull()) {
1072 res = new TCollection_HAsciiString("Counter:");
1073 res->AssignCat(slc->Name());
1076 DeclareAndCast(IFSelect_Signature,sig,var);
1077 if (!sig.IsNull()) {
1078 res = new TCollection_HAsciiString("Signature:");
1079 res->AssignCat(sig->Name());
1082 DeclareAndCast(IFSelect_EditForm,edf,var);
1083 if (!edf.IsNull()) {
1084 res = new TCollection_HAsciiString("EditForm:");
1085 res->AssignCat(edf->Label());
1088 DeclareAndCast(IFSelect_Editor,edt,var);
1089 if (!edt.IsNull()) {
1090 res = new TCollection_HAsciiString("Editor:");
1091 res->AssignCat(edt->Label().ToCString());
1094 res = new TCollection_HAsciiString("VariableType:");
1095 res->AssignCat(var->DynamicType()->Name());
1100 //=======================================================================
1103 //=======================================================================
1105 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents
1106 (const Handle(Standard_Type)& type) const
1108 Handle(TColStd_HSequenceOfInteger) list =
1109 new TColStd_HSequenceOfInteger();
1110 Standard_Integer nb = theitems.Extent();
1111 for (Standard_Integer i = 1; i <= nb; i ++) {
1112 if (theitems.FindKey(i)->IsKind(type)) list->Append(i);
1118 //=======================================================================
1121 //=======================================================================
1123 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNames
1124 (const Handle(Standard_Type)& type) const
1126 Handle(TColStd_HSequenceOfHAsciiString) list =
1127 new TColStd_HSequenceOfHAsciiString();
1128 for (Dico_IteratorOfDictionaryOfTransient IT(thenames); IT.More(); IT.Next()){
1129 if (IT.Value()->IsKind(type)) list->Append
1130 (new TCollection_HAsciiString(IT.Name().ToCString()));
1136 // .. Recherche par label : recherche en liste(noms) ou iterative
1138 //=======================================================================
1141 //=======================================================================
1143 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNamesForLabel
1144 (const Standard_CString label) const
1146 Handle(TColStd_HSequenceOfHAsciiString) list =
1147 new TColStd_HSequenceOfHAsciiString();
1148 Standard_Integer i, nb = MaxIdent();
1149 for (i = 1; i <= nb; i ++) {
1150 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1151 Handle(Standard_Transient) item = Item(i);
1152 if (lab.IsNull()) continue;
1153 if (label[0] != '\0' && lab->Search(label) <= 0) continue;
1155 Handle(TCollection_HAsciiString) nom = Name(Item(i));
1156 if (nom.IsNull()) { nom = new TCollection_HAsciiString(i); nom->Insert(1,'#'); }
1157 else nom = new TCollection_HAsciiString (nom);
1158 list->Append (new TCollection_HAsciiString(lab));
1164 //=======================================================================
1167 //=======================================================================
1169 Standard_Integer IFSelect_WorkSession::NextIdentForLabel
1170 (const Standard_CString label, const Standard_Integer id,
1171 const Standard_Integer mode) const
1173 Standard_Integer nb = MaxIdent();
1174 for (Standard_Integer i = id+1; i <= nb; i ++) {
1175 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1176 if (lab.IsNull()) continue;
1178 case 0 : if (!strcmp(lab->ToCString(),label)) return i; break; // switch
1179 case 1 : if (lab->Search(label) == 1 ) return i; break;
1180 case 2 : if (lab->Search(label) > 0 ) return i; break;
1181 default : break; // break du switch
1184 return 0; // ici : pas trouve
1188 // #################################################################
1189 // .... Parametres (Int et Text) ....
1191 //=======================================================================
1194 //=======================================================================
1196 Handle(Standard_Transient) IFSelect_WorkSession::NewParamFromStatic
1197 (const Standard_CString statname, const Standard_CString name)
1199 Handle(Standard_Transient) param;
1200 Handle(Interface_Static) stat = Interface_Static::Static(statname);
1201 if (stat.IsNull()) return param;
1202 if (stat->Type() == Interface_ParamInteger) {
1203 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1204 intpar->SetStaticName (statname);
1207 param = stat->HStringValue();
1209 if (param.IsNull()) return param;
1210 if ( AddNamedItem (name, param) == 0 ) param.Nullify();
1215 //=======================================================================
1218 //=======================================================================
1220 Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam
1221 (const Standard_Integer id) const
1222 { return Handle(IFSelect_IntParam)::DownCast(Item(id)); }
1225 //=======================================================================
1228 //=======================================================================
1230 Standard_Integer IFSelect_WorkSession::IntValue
1231 (const Handle(IFSelect_IntParam)& par) const
1233 if (!par.IsNull()) return par->Value();
1238 //=======================================================================
1241 //=======================================================================
1243 Handle(IFSelect_IntParam) IFSelect_WorkSession::NewIntParam
1244 (const Standard_CString name)
1246 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1247 if ( AddNamedItem (name, intpar) == 0 ) intpar.Nullify();
1252 //=======================================================================
1255 //=======================================================================
1257 Standard_Boolean IFSelect_WorkSession::SetIntValue
1258 (const Handle(IFSelect_IntParam)& par, const Standard_Integer val)
1260 if (ItemIdent(par) == 0) return Standard_False;
1262 return Standard_True;
1266 //=======================================================================
1269 //=======================================================================
1271 Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam
1272 (const Standard_Integer id) const
1273 { return Handle(TCollection_HAsciiString)::DownCast(Item(id)); }
1276 //=======================================================================
1279 //=======================================================================
1281 TCollection_AsciiString IFSelect_WorkSession::TextValue
1282 (const Handle(TCollection_HAsciiString)& par) const
1284 if (!par.IsNull()) return TCollection_AsciiString(par->ToCString());
1285 else return TCollection_AsciiString();
1289 Handle(TCollection_HAsciiString) IFSelect_WorkSession::NewTextParam
1290 (const Standard_CString name)
1292 Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString("");
1293 if ( AddNamedItem (name, textpar) == 0 ) textpar.Nullify();
1298 //=======================================================================
1301 //=======================================================================
1303 Standard_Boolean IFSelect_WorkSession::SetTextValue
1304 (const Handle(TCollection_HAsciiString)& par, const Standard_CString val)
1306 if (ItemIdent(par) == 0) return Standard_False;
1307 par->Clear(); par->AssignCat(val);
1308 return Standard_True;
1311 // ########################################################################
1312 // .... SIGNATURES ....
1314 //=======================================================================
1317 //=======================================================================
1319 Handle(IFSelect_Signature) IFSelect_WorkSession::Signature
1320 (const Standard_Integer id) const
1321 { return GetCasted(IFSelect_Signature,Item(id)); }
1323 Standard_CString IFSelect_WorkSession::SignValue
1324 (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const
1326 if (sign.IsNull() || themodel.IsNull()) return "";
1327 if (StartingNumber(ent) == 0) return "";
1328 return sign->Value (ent,themodel);
1331 // ########################################################################
1332 // .... SELECTIONS & Cie ....
1334 //=======================================================================
1337 //=======================================================================
1339 Handle(IFSelect_Selection) IFSelect_WorkSession::Selection
1340 (const Standard_Integer id) const
1341 { return GetCasted(IFSelect_Selection,Item(id)); }
1344 //=======================================================================
1347 //=======================================================================
1349 Interface_EntityIterator IFSelect_WorkSession::EvalSelection
1350 (const Handle(IFSelect_Selection)& sel) const
1352 Interface_EntityIterator iter;
1354 errhand = Standard_False;
1357 iter = EvalSelection(sel); // appel normal (donc, code pas duplique)
1359 catch (Standard_Failure) {
1360 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1361 sout<<" **** Interruption EvalSelection par Exception : ****\n";
1362 sout<<Standard_Failure::Caught()->GetMessageString();
1363 sout<<"\n Abandon"<<endl;
1365 errhand = theerrhand;
1369 if (thegraph.IsNull()) return iter;
1370 iter = sel->UniqueResult(thegraph->Graph());
1375 //=======================================================================
1378 //=======================================================================
1380 IFSelect_SelectionIterator IFSelect_WorkSession::Sources
1381 (const Handle(IFSelect_Selection)& sel) const
1383 return IFSelect_SelectionIterator (sel);
1387 //=======================================================================
1390 //=======================================================================
1392 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResult
1393 (const Handle(IFSelect_Selection)& sel) const
1395 Handle(TColStd_HSequenceOfTransient) res;
1397 errhand = Standard_False;
1400 res = SelectionResult(sel); // appel normal (->code unique)
1402 catch (Standard_Failure) {
1403 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1404 sout<<" **** Interruption SelectionResult par Exception : ****\n";
1405 sout<<Standard_Failure::Caught()->GetMessageString();
1406 sout<<"\n Abandon"<<endl;
1408 errhand = theerrhand;
1413 cout<< " *** Data for Evaluation not available ***"<<endl;
1414 return new TColStd_HSequenceOfTransient();
1416 // if (ItemIdent(sel) == 0)
1418 { cout << " Selection : "<<" Unknown"<<endl; return res; } //cout<<Handle
1419 return EvalSelection (sel).Content();
1423 //=======================================================================
1426 //=======================================================================
1428 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromList
1429 (const Handle(IFSelect_Selection)& sel,
1430 const Handle(TColStd_HSequenceOfTransient)& list) const
1432 if (list.IsNull()) return SelectionResult (sel);
1433 DeclareAndCast(IFSelect_SelectDeduct,deduct,sel);
1434 if (deduct.IsNull()) return SelectionResult (sel);
1436 // On va chercher la derniere deduction de la chaine des inputs
1437 Handle(IFSelect_Selection) ssel, newinput;
1439 Standard_Integer i, nb = MaxIdent();
1440 for (i = 1; i <= nb * 2; i ++) {
1441 newinput = deduct->Input();
1442 deduct = GetCasted(IFSelect_SelectDeduct,newinput);
1443 if (deduct.IsNull()) break;
1447 // on y est (enfin, on devrait)
1448 // ssel est la derniere selection auscultee, deduct son downcast
1449 // input son Input (nulle si sel pas une deduction)
1450 deduct = GetCasted(IFSelect_SelectDeduct,ssel);
1452 deduct->Alternate()->SetList (list);
1454 // On execute puis on nettoie
1455 Handle(TColStd_HSequenceOfTransient) res = SelectionResult (sel);
1456 //// deduct->SetInput (newinput);
1461 //=======================================================================
1464 //=======================================================================
1466 Standard_Boolean IFSelect_WorkSession::SetItemSelection
1467 (const Handle(Standard_Transient)& item,
1468 const Handle(IFSelect_Selection)& sel)
1470 DeclareAndCast(IFSelect_Dispatch,disp,item);
1471 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1472 if (!disp.IsNull()) {
1473 if (ItemIdent(disp) == 0) return Standard_False;
1474 // Selection Nulle : Annuler FinalSelection
1475 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1476 disp->SetFinalSelection(sel);
1477 return Standard_True;
1479 if (!modif.IsNull()) {
1480 if (ItemIdent(modif) == 0) return Standard_False;
1481 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1482 // Selection Nulle : Annuler Selection
1483 modif->SetSelection(sel);
1484 return Standard_True;
1486 return Standard_False;
1490 //=======================================================================
1493 //=======================================================================
1495 Standard_Boolean IFSelect_WorkSession::ResetItemSelection
1496 (const Handle(Standard_Transient)& item)
1498 Handle(IFSelect_Selection) nulsel;
1499 return SetItemSelection (item,nulsel);
1503 //=======================================================================
1506 //=======================================================================
1508 Handle(IFSelect_Selection) IFSelect_WorkSession::ItemSelection
1509 (const Handle(Standard_Transient)& item) const
1511 Handle(IFSelect_Selection) sel;
1512 DeclareAndCast(IFSelect_Dispatch,disp,item);
1513 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1514 if (ItemIdent(disp) > 0) return disp->FinalSelection();
1515 if (ItemIdent(modif) > 0) return modif->Selection();
1516 return sel; // Nul ou inconnu -> Null
1519 // ######################################################################
1520 // .... Les COMPTEURS ....
1522 //=======================================================================
1525 //=======================================================================
1527 Handle(IFSelect_SignCounter) IFSelect_WorkSession::SignCounter
1528 (const Standard_Integer id) const
1529 { return GetCasted(IFSelect_SignCounter,Item(id)); }
1532 //=======================================================================
1535 //=======================================================================
1537 Standard_Boolean IFSelect_WorkSession::ComputeCounter
1538 (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced)
1540 if (counter.IsNull()) return Standard_False;
1541 if (!ComputeGraph()) return Standard_False;
1542 return counter->ComputeSelected (Graph(),forced);
1546 //=======================================================================
1549 //=======================================================================
1551 Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList
1552 (const Handle(IFSelect_SignCounter)& counter,
1553 const Handle(TColStd_HSequenceOfTransient)& list,
1554 const Standard_Boolean clear)
1556 if (counter.IsNull()) return Standard_False;
1557 if (clear) counter->Clear();
1558 if (list.IsNull()) return ComputeCounter (counter,Standard_True);
1559 counter->AddList (list,themodel);
1560 return Standard_True;
1563 // ######################################################################
1564 // .... Les DISPATCHES ....
1566 //=======================================================================
1569 //=======================================================================
1571 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::AppliedDispatches
1574 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1575 Standard_Integer nb = theshareout->NbDispatches();
1576 for (Standard_Integer i = 1; i <= nb; i ++) {
1577 list->Append (ItemIdent(theshareout->Dispatch(i)));
1583 //=======================================================================
1586 //=======================================================================
1588 void IFSelect_WorkSession::ClearShareOut (const Standard_Boolean onlydisp)
1590 theshareout->Clear(onlydisp);
1594 //=======================================================================
1597 //=======================================================================
1599 Handle(IFSelect_Dispatch) IFSelect_WorkSession::Dispatch
1600 (const Standard_Integer id) const
1602 return GetCasted(IFSelect_Dispatch,Item(id));
1606 //=======================================================================
1609 //=======================================================================
1611 Standard_Integer IFSelect_WorkSession::DispatchRank
1612 (const Handle(IFSelect_Dispatch)& disp) const
1614 if (ItemIdent(disp) == 0) return 0;
1615 return theshareout->DispatchRank(disp);
1618 // ######################################################################
1619 // .... Les MODIFIERS ....
1621 //=======================================================================
1624 //=======================================================================
1626 Handle(IFSelect_ModelCopier) IFSelect_WorkSession::ModelCopier () const
1632 //=======================================================================
1635 //=======================================================================
1637 void IFSelect_WorkSession::SetModelCopier
1638 (const Handle(IFSelect_ModelCopier)& copier)
1641 thecopier->SetShareOut(theshareout);
1645 //=======================================================================
1648 //=======================================================================
1650 Standard_Integer IFSelect_WorkSession::NbFinalModifiers
1651 (const Standard_Boolean formodel) const
1653 return theshareout->NbModifiers(formodel);
1657 //=======================================================================
1660 //=======================================================================
1662 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents
1663 (const Standard_Boolean formodel) const
1665 // return ItemIdents(STANDARD_TYPE(IFSelect_Modifier));
1666 // On donne la liste dans l ordre du ModelCopier, qui fait foi
1667 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1668 Standard_Integer nbm = theshareout->NbModifiers(formodel);
1669 for (Standard_Integer i = 1; i <= nbm; i ++)
1670 list->Append(ItemIdent(theshareout->GeneralModifier(formodel,i)));
1675 //=======================================================================
1678 //=======================================================================
1680 Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier
1681 (const Standard_Integer id) const
1683 return GetCasted(IFSelect_GeneralModifier,Item(id));
1687 //=======================================================================
1690 //=======================================================================
1692 Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier
1693 (const Standard_Integer id) const
1695 return GetCasted(IFSelect_Modifier,Item(id));
1699 //=======================================================================
1702 //=======================================================================
1704 Standard_Integer IFSelect_WorkSession::ModifierRank
1705 (const Handle(IFSelect_GeneralModifier)& modif) const
1707 if (ItemIdent(modif) == 0) return 0;
1708 return theshareout->ModifierRank(modif);
1712 //=======================================================================
1715 //=======================================================================
1717 Standard_Boolean IFSelect_WorkSession::ChangeModifierRank
1718 (const Standard_Boolean formodel,
1719 const Standard_Integer before, const Standard_Integer after)
1721 return theshareout->ChangeModifierRank(formodel,before,after);
1725 //=======================================================================
1728 //=======================================================================
1730 void IFSelect_WorkSession::ClearFinalModifiers ()
1732 Handle(TColStd_HSequenceOfInteger) list = FinalModifierIdents (Standard_True);
1733 Standard_Integer nb = list->Length();
1734 Standard_Integer i; // svv #1
1735 for (i = 1; i <= nb; i ++)
1736 RemoveItem(GeneralModifier(list->Value(i)));
1737 list = FinalModifierIdents (Standard_False);
1738 nb = list->Length();
1739 for (i = 1; i <= nb; i ++)
1740 RemoveItem(GeneralModifier(list->Value(i)));
1744 //=======================================================================
1747 //=======================================================================
1749 Standard_Boolean IFSelect_WorkSession::SetAppliedModifier
1750 (const Handle(IFSelect_GeneralModifier)& modif,
1751 const Handle(Standard_Transient)& item)
1753 if (ItemIdent(modif) == 0) return Standard_False;
1755 if (item.IsNull()) return Standard_False;
1756 if (item == theshareout) {
1757 theshareout->AddModifier(modif,0);
1758 return Standard_True;
1760 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
1761 DeclareAndCast(IFSelect_Dispatch,disp,item);
1762 theshareout->AddModifier(modif,0);
1763 modif->SetDispatch(disp);
1764 return Standard_True;
1766 if (item->IsKind(STANDARD_TYPE(IFSelect_TransformStandard))) {
1767 DeclareAndCast(IFSelect_TransformStandard,stf,item);
1768 DeclareAndCast(IFSelect_Modifier,tmod,modif);
1769 if (tmod.IsNull()) return Standard_False;
1770 stf->AddModifier (tmod);
1771 theshareout->RemoveItem(modif);
1772 return Standard_True;
1774 return Standard_False;
1778 //=======================================================================
1781 //=======================================================================
1783 Standard_Boolean IFSelect_WorkSession::ResetAppliedModifier
1784 (const Handle(IFSelect_GeneralModifier)& modif)
1786 if (ItemIdent(modif) == 0) return Standard_False;
1788 return theshareout->RemoveItem(modif);
1792 //=======================================================================
1795 //=======================================================================
1797 Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier
1798 (const Handle(IFSelect_GeneralModifier)& modif) const
1800 Handle(Standard_Transient) res;
1801 if (ItemIdent(modif) == 0) return res;
1802 if (theshareout->ModifierRank(modif) == 0) return res;
1803 res = modif->Dispatch();
1804 if (res.IsNull()) res = theshareout;
1808 // #################################################################
1809 // .... Transformer ....
1811 //=======================================================================
1814 //=======================================================================
1816 Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer
1817 (const Standard_Integer id) const
1819 return GetCasted(IFSelect_Transformer,Item(id));
1823 //=======================================================================
1826 //=======================================================================
1828 Standard_Integer IFSelect_WorkSession::RunTransformer
1829 (const Handle(IFSelect_Transformer)& transf)
1831 Standard_Integer effect = 0;
1832 if (transf.IsNull() || !IsLoaded()) return effect;
1833 Handle(Interface_InterfaceModel) newmod; // Null au depart
1834 Interface_CheckIterator checks;
1835 checks.SetName("X-STEP WorkSession : RunTransformer");
1836 Standard_Boolean res = transf->Perform
1837 (thegraph->Graph(),theprotocol,checks,newmod);
1839 if (!checks.IsEmpty(Standard_False)) {
1840 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1841 sout<<" ** RunTransformer has produced Check Messages : **"<<endl;
1842 checks.Print (sout,themodel,Standard_False);
1844 thecheckdone = Standard_False;
1845 thecheckrun = checks;
1847 if (newmod.IsNull()) return (res ? 1 : -1);
1848 // MISE A JOUR des SelectPointed
1849 Handle(TColStd_HSequenceOfInteger) list =
1850 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1851 Standard_Integer nb = list->Length();
1852 for (Standard_Integer i = 1; i <= nb; i ++) {
1853 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
1856 if (newmod == themodel) {
1857 effect = (res ? 2 : -2);
1858 if (!res) return effect;
1859 Handle(Interface_Protocol) newproto = theprotocol;
1860 if (transf->ChangeProtocol(newproto))
1861 { effect = 4; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1862 return (ComputeGraph(Standard_True) ? 4 : -4);
1864 effect = (res ? 3 : -3);
1865 if (!res) return effect;
1866 Handle(Interface_Protocol) newproto = theprotocol;
1867 if (transf->ChangeProtocol(newproto))
1868 { effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1869 theoldel = themodel;
1870 SetModel(newmod,Standard_False);
1876 //=======================================================================
1879 //=======================================================================
1881 Standard_Integer IFSelect_WorkSession::RunModifier
1882 (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy)
1884 Handle(IFSelect_Selection) sel; // null
1885 return RunModifierSelected (modif,sel,copy);
1889 //=======================================================================
1892 //=======================================================================
1894 Standard_Integer IFSelect_WorkSession::RunModifierSelected
1895 (const Handle(IFSelect_Modifier)& modif,
1896 const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy)
1898 if (ItemIdent(modif) == 0) return Standard_False;
1899 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1900 stf->SetCopyOption(copy);
1901 stf->SetSelection (sel);
1902 stf->AddModifier (modif);
1903 return RunTransformer (stf);
1907 //=======================================================================
1910 //=======================================================================
1912 Handle(IFSelect_Transformer) IFSelect_WorkSession::NewTransformStandard
1913 (const Standard_Boolean copy, const Standard_CString name)
1915 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1916 stf->SetCopyOption(copy);
1917 if (AddNamedItem (name, stf) == 0) stf.Nullify();
1922 // Ceci est une action directe : pourrait etre fait par un Transformer ...
1923 //=======================================================================
1926 //=======================================================================
1928 Standard_Boolean IFSelect_WorkSession::SetModelContent
1929 (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep)
1931 if (sel.IsNull() || !IsLoaded()) return Standard_False;
1932 Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph());
1933 if (list.NbEntities() == 0) return Standard_False;
1935 Handle(Interface_InterfaceModel) newmod = themodel->NewEmptyModel();
1936 Interface_CopyTool TC(themodel,theprotocol);
1937 Standard_Integer i, nb = themodel->NbEntities();
1939 for (list.Start(); list.More(); list.Next())
1940 TC.TransferEntity (list.Value());
1942 Standard_Integer* flags = new Standard_Integer[nb+1];
1943 for (i = 0; i <= nb; i ++) flags[i] = 0;
1944 for (list.Start(); list.More(); list.Next()) {
1945 Standard_Integer num = themodel->Number(list.Value());
1946 if (num <= nb) flags[num] = 1;
1948 for (i = 1; i <= nb; i ++) {
1949 if (flags[i] == 0) TC.TransferEntity (themodel->Value(i));
1953 TC.FillModel(newmod);
1954 if (newmod->NbEntities() == 0) return Standard_False;
1955 // Mettre a jour (ne pas oublier SelectPointed)
1956 theoldel = themodel;
1957 SetModel(newmod,Standard_False);
1958 // MISE A JOUR des SelectPointed
1959 Handle(TColStd_HSequenceOfInteger) pts =
1960 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1962 for (i = 1; i <= nb; i ++) {
1963 DeclareAndCast(IFSelect_SelectPointed,sp,Item(pts->Value(i)));
1964 sp->Update(TC.Control());
1966 return Standard_True;
1970 // #################################################################
1971 // .... File Name ....
1973 //=======================================================================
1976 //=======================================================================
1978 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FilePrefix () const
1980 return theshareout->Prefix();
1984 //=======================================================================
1987 //=======================================================================
1989 Handle(TCollection_HAsciiString) IFSelect_WorkSession::DefaultFileRoot () const
1991 return theshareout->DefaultRootName();
1995 //=======================================================================
1998 //=======================================================================
2000 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileExtension () const
2002 return theshareout->Extension();
2006 //=======================================================================
2009 //=======================================================================
2011 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileRoot
2012 (const Handle(IFSelect_Dispatch)& disp) const
2014 return theshareout->RootName(theshareout->DispatchRank(disp));
2018 //=======================================================================
2021 //=======================================================================
2023 void IFSelect_WorkSession::SetFilePrefix (const Standard_CString name)
2025 theshareout->SetPrefix (new TCollection_HAsciiString(name));
2029 //=======================================================================
2032 //=======================================================================
2034 void IFSelect_WorkSession::SetFileExtension (const Standard_CString name)
2036 theshareout->SetExtension (new TCollection_HAsciiString(name));
2040 //=======================================================================
2043 //=======================================================================
2045 Standard_Boolean IFSelect_WorkSession::SetDefaultFileRoot
2046 (const Standard_CString name)
2048 Handle(TCollection_HAsciiString) defrt;
2049 if (name[0] != '\0') defrt = new TCollection_HAsciiString(name);
2050 return theshareout->SetDefaultRootName (defrt);
2054 //=======================================================================
2057 //=======================================================================
2059 Standard_Boolean IFSelect_WorkSession::SetFileRoot
2060 (const Handle(IFSelect_Dispatch)& disp, const Standard_CString namefile)
2062 Standard_Integer id = ItemIdent(disp);
2063 if (id == 0) return Standard_False;
2064 Standard_Integer nd = theshareout->DispatchRank(disp);
2065 /* if (theonlynamed) {
2066 if (nd == 0 && namefile[0] != 0)
2067 theshareout->AddDispatch(disp);
2068 else if (nd != 0 && namefile[0] == 0)
2069 theshareout->RemoveDispatch (nd);
2071 if (nd == 0) return Standard_False;
2072 // The order below prevented to change the root name on a given dispatch !
2073 // if (theshareout->HasRootName(nd)) return Standard_False;
2074 Handle(TCollection_HAsciiString) filename;
2075 if (namefile[0] != '\0') filename = new TCollection_HAsciiString (namefile);
2076 return theshareout->SetRootName(nd,filename);
2080 //=======================================================================
2083 //=======================================================================
2085 Standard_CString IFSelect_WorkSession::GiveFileRoot
2086 (const Standard_CString file) const
2088 OSD_Path path (file);
2089 if (!path.IsValid(TCollection_AsciiString(file))) return file; // tant pis ..
2090 bufstr = path.Name();
2091 return bufstr.ToCString();
2095 //=======================================================================
2098 //=======================================================================
2100 Standard_CString IFSelect_WorkSession::GiveFileComplete
2101 (const Standard_CString file) const
2103 // ajouter si besoin : Prefix; Extension
2104 bufstr.Clear(); bufstr.AssignCat (file);
2105 Standard_Integer i,j = 0,nb = bufstr.Length();
2106 Handle(TCollection_HAsciiString) ext = FileExtension ();
2107 if (!ext.IsNull()) {
2108 char val0 = '\0'; if (ext->Length() > 0) val0 = ext->Value(1);
2109 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val0) { j = 1; break; }
2110 if (j == 0) bufstr.AssignCat (ext->ToCString());
2112 Handle(TCollection_HAsciiString) pre = FilePrefix ();
2113 if (!pre.IsNull()) {
2114 char val1 = '\0'; if (pre->Length() > 0) val1 = pre->Value(pre->Length());
2116 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val1) { j = 1; break; }
2117 if (j == 0) bufstr.Insert (1,pre->ToCString());
2120 return bufstr.ToCString();
2124 //=======================================================================
2127 //=======================================================================
2129 void IFSelect_WorkSession::ClearFile ()
2131 thecopier->ClearResult();
2132 theshareout->ClearResult(Standard_True);
2136 //=======================================================================
2139 //=======================================================================
2141 void IFSelect_WorkSession::EvaluateFile ()
2144 if (!IsLoaded()) return;
2145 Interface_CheckIterator checks;
2147 errhand = Standard_False;
2150 EvaluateFile(); // appel normal (donc, code pas duplique)
2152 catch (Standard_Failure) {
2153 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2154 sout<<" **** Interruption EvaluateFile par Exception : ****\n";
2155 sout<<Standard_Failure::Caught()->GetMessageString();
2156 sout<<"\n Abandon"<<endl;
2157 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2159 errhand = theerrhand;
2160 thecheckrun = checks;
2164 IFSelect_ShareOutResult R(theshareout,thegraph->Graph());
2165 checks = thecopier->Copy (R,thelibrary,theprotocol);
2166 if (!checks.IsEmpty(Standard_False)) {
2167 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2168 sout<<" ** EvaluateFile has produced Check Messages : **"<<endl;
2169 checks.Print (sout,themodel,Standard_False);
2171 thecopier->SetRemaining (thegraph->CGraph());
2172 thecheckrun = checks;
2176 //=======================================================================
2179 //=======================================================================
2181 Standard_Integer IFSelect_WorkSession::NbFiles () const
2183 return thecopier->NbFiles();
2187 //=======================================================================
2190 //=======================================================================
2192 Handle(Interface_InterfaceModel) IFSelect_WorkSession::FileModel
2193 (const Standard_Integer num) const
2195 Handle(Interface_InterfaceModel) mod;
2196 if (num > 0 && num <= NbFiles()) mod = thecopier->FileModel(num);
2201 //=======================================================================
2204 //=======================================================================
2206 TCollection_AsciiString IFSelect_WorkSession::FileName
2207 (const Standard_Integer num) const
2209 TCollection_AsciiString name;
2210 if (num > 0 && num <= NbFiles()) name = thecopier->FileName(num);
2215 //=======================================================================
2218 //=======================================================================
2220 void IFSelect_WorkSession::BeginSentFiles (const Standard_Boolean record)
2222 thecopier->BeginSentFiles(theshareout,record);
2226 //=======================================================================
2229 //=======================================================================
2231 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::SentFiles () const
2233 return thecopier->SentFiles();
2237 // #########################################################################
2238 // .... Action de Transfert proprement dite : la grande affaire ! ....
2240 //=======================================================================
2243 //=======================================================================
2245 Standard_Boolean IFSelect_WorkSession::SendSplit ()
2248 Interface_CheckIterator checks;
2251 errhand = Standard_False;
2254 return SendSplit(); // appel normal (donc, code pas duplique)
2256 catch (Standard_Failure) {
2257 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2258 sout<<" **** Interruption SendSplit par Exception : ****\n";
2259 sout<<Standard_Failure::Caught()->GetMessageString();
2260 sout<<"\n Abandon"<<endl;
2261 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2263 errhand = theerrhand;
2264 thecheckrun = checks;
2265 return Standard_False;
2268 if (thelibrary.IsNull()) {
2269 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2270 thecheckrun = checks;
2271 return Standard_False;
2274 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2275 sout<< " *** Data for SendSplit not available ***"<<endl;
2276 checks.CCheck(0)->AddFail("Data not available");
2277 thecheckrun = checks;
2278 return Standard_False;
2281 if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol);
2284 IFSelect_ShareOutResult eval (ShareOut(), thegraph->Graph());
2285 checks = thecopier->Send (eval, thelibrary, theprotocol);
2286 thecopier->SetRemaining (thegraph->CGraph());
2289 if (theshareout.IsNull()) return Standard_False;
2290 Standard_Integer i, nbd = theshareout->NbDispatches();
2291 Standard_Integer nf = 0;
2292 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2293 sout<<" SendSplit .. ";
2294 for (i = 1; i <= nbd; i ++) {
2295 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
2296 if (disp.IsNull()) continue;
2297 IFGraph_SubPartsIterator packs(thegraph->Graph(),Standard_False);
2298 disp->Packets (thegraph->Graph(),packs);
2299 for (packs.Start(); packs.More(); packs.Next()) {
2300 Interface_EntityIterator iter = packs.Entities();
2301 if (iter.NbEntities() == 0) continue;
2302 // Ecrire une liste d entites
2303 Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
2304 sp->SetList (iter.Content());
2306 TCollection_AsciiString filnam (nf);
2307 filnam.Insert (1,"_");
2308 Handle(TCollection_HAsciiString) filepart;
2309 filepart = FileRoot(disp);
2310 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2311 filepart = FilePrefix();
2312 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2313 filepart = FileExtension();
2314 if (!filepart.IsNull()) filnam.AssignCat (filepart->ToCString());
2315 IFSelect_ReturnStatus stat = SendSelected (filnam.ToCString(),sp);
2316 if (stat != IFSelect_RetDone) cout<<"File "<<filnam<<" failed"<<endl;
2319 sout<<" .. Files Written : "<<nf<<endl;
2321 thecheckrun = checks;
2322 return Standard_True;
2326 //=======================================================================
2329 //=======================================================================
2331 Handle(IFSelect_PacketList) IFSelect_WorkSession::EvalSplit () const
2333 Handle(IFSelect_PacketList) pks;
2334 if (!IsLoaded()) return pks;
2335 IFSelect_ShareOutResult sho (ShareOut(), thegraph->Graph());
2336 return sho.Packets();
2340 //=======================================================================
2343 //=======================================================================
2345 Interface_EntityIterator IFSelect_WorkSession::SentList
2346 (const Standard_Integer newcount) const
2348 Interface_EntityIterator iter;
2349 if (!IsLoaded()) return iter;
2350 const Interface_Graph& G = thegraph->Graph();
2351 Standard_Integer nb = G.Size();
2353 for ( i = 1; i <= nb; i ++) {
2354 Standard_Integer stat = G.Status(i);
2355 if ( (stat > 0 && newcount < 0) || stat == newcount)
2356 iter.GetOneItem(G.Entity(i));
2362 //=======================================================================
2365 //=======================================================================
2367 Standard_Integer IFSelect_WorkSession::MaxSendingCount () const
2369 Standard_Integer newcount = 0;
2370 if (!IsLoaded()) return newcount;
2371 const Interface_Graph& G = thegraph->Graph();
2372 Standard_Integer nb = G.Size();
2374 for (i = 1; i <= nb; i ++) {
2375 Standard_Integer stat = G.Status(i);
2376 if (stat > newcount) newcount = stat;
2382 //=======================================================================
2385 //=======================================================================
2387 Standard_Boolean IFSelect_WorkSession::SetRemaining
2388 (const IFSelect_RemainMode mode)
2390 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2391 if (!IsLoaded()) return Standard_False;
2392 if (mode == IFSelect_RemainForget) {
2393 Standard_Integer nb = thegraph->Graph().Size();
2394 for (Standard_Integer i = 1; i <= nb; i ++)
2395 thegraph->CGraph().SetStatus (i,0);
2397 return Standard_True;
2398 } else if (mode == IFSelect_RemainCompute) {
2399 Handle(Interface_InterfaceModel) newmod;
2400 Interface_CopyTool TC(themodel,theprotocol);
2401 thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod);
2402 if (newmod.IsNull()) {
2403 sout<<" No Remaining Data recorded"<<endl; return Standard_False;
2404 } else if (newmod == themodel) {
2405 sout<<" Remaining causes all original data to be kept"<<endl;
2406 thecopier->SetRemaining (thegraph->CGraph());
2407 return Standard_False;
2409 theoldel = themodel;
2410 SetModel(newmod,Standard_False);
2411 // MISE A JOUR des SelectPointed
2412 Handle(TColStd_HSequenceOfInteger) list =
2413 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
2414 Standard_Integer nb = list->Length();
2415 for (Standard_Integer i = 1; i <= nb; i ++) {
2416 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
2417 sp->Update(TC.Control());
2419 return Standard_True;
2421 } else if (mode == IFSelect_RemainDisplay) {
2422 Standard_Integer ne = 0;
2423 Standard_Integer nb = thegraph->Graph().Size();
2424 for (Standard_Integer i = 1; i <= nb; i ++)
2425 { if (thegraph->Graph().Status(i) >= 0) ne ++; }
2427 sout<<" - All entities are remaining, none yet sent"<<endl; return Standard_True;
2429 Interface_EntityIterator iter = SentList(0);
2430 nb = iter.NbEntities();
2432 sout<<" - No recorded remaining entities"<<endl; return Standard_True;
2434 sout <<" -- Recorded Remaining (not yet sent) Entities --"<<endl;
2435 ListEntities(iter,2);
2436 sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
2437 MaxSendingCount() << endl;
2440 sout<< " - Now, dispatches are deactivated"<<endl;
2441 nb = theshareout->NbDispatches();
2442 for (Standard_Integer i = nb; i > theshareout->LastRun(); i --)
2443 theshareout->RemoveDispatch(i);
2445 return Standard_True;
2446 } else if (mode == IFSelect_RemainUndo) {
2447 if (theoldel.IsNull()) return Standard_False;
2448 SetModel(theoldel); theoldel.Nullify();
2449 return Standard_True;
2451 else return Standard_False;
2455 //=======================================================================
2458 //=======================================================================
2460 IFSelect_ReturnStatus IFSelect_WorkSession::SendAll
2461 (const Standard_CString filename, const Standard_Boolean computegraph)
2464 Interface_CheckIterator checks;
2465 if (!IsLoaded()) return IFSelect_RetVoid;
2466 if (thelibrary.IsNull()) {
2467 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2468 thecheckrun = checks;
2469 return IFSelect_RetError;
2473 errhand = Standard_False;
2476 ComputeGraph(computegraph);
2477 checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2479 catch (Standard_Failure) {
2480 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2481 sout<<" **** Interruption SendAll par Exception : ****\n";
2482 sout<<Standard_Failure::Caught()->GetMessageString();
2483 sout<<"\n Abandon"<<endl;
2484 errhand = theerrhand;
2485 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2486 thecheckrun = checks;
2487 return IFSelect_RetFail;
2490 else checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2491 Handle(Interface_Check) aMainFail = checks.CCheck(0);
2492 if (!aMainFail.IsNull() && aMainFail->HasFailed ())
2494 return IFSelect_RetStop;
2496 if (theloaded.Length() == 0) theloaded.AssignCat(filename);
2497 thecheckrun = checks;
2498 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2499 return IFSelect_RetError;
2503 //=======================================================================
2506 //=======================================================================
2508 IFSelect_ReturnStatus IFSelect_WorkSession::SendSelected
2509 (const Standard_CString filename,
2510 const Handle(IFSelect_Selection)& sel,
2511 const Standard_Boolean computegraph)
2514 if (!IsLoaded()) return IFSelect_RetVoid;
2515 Interface_CheckIterator checks;
2516 if (thelibrary.IsNull()) {
2517 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2518 thecheckrun = checks;
2519 return IFSelect_RetVoid;
2523 errhand = Standard_False;
2526 ComputeGraph(computegraph);
2527 return SendSelected (filename,sel); // appel normal
2529 catch (Standard_Failure) {
2530 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2531 sout<<" **** Interruption SendSelected par Exception : ****\n";
2532 sout<<Standard_Failure::Caught()->GetMessageString();
2533 sout<<"\n Abandon"<<endl;
2534 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2535 errhand = theerrhand;
2536 thecheckrun = checks;
2537 return IFSelect_RetFail;
2540 // if (ItemIdent(sel) == 0) return 3;
2541 Interface_EntityIterator iter = sel->UniqueResult(thegraph->Graph());
2542 if (iter.NbEntities() == 0) return IFSelect_RetVoid;
2544 checks = thecopier->SendSelected
2545 (filename,thegraph->Graph(),thelibrary,theprotocol,iter);
2546 thecopier->SetRemaining (thegraph->CGraph());
2547 thecheckrun = checks;
2548 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2549 return IFSelect_RetError;
2553 //=======================================================================
2556 //=======================================================================
2558 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2559 (const Standard_CString filename)
2561 if (WorkLibrary().IsNull()) return IFSelect_RetVoid;
2562 ComputeGraph(Standard_True);
2563 if (!IsLoaded()) return IFSelect_RetVoid;
2564 return SendAll (filename);
2568 //=======================================================================
2571 //=======================================================================
2573 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2574 (const Standard_CString filename, const Handle(IFSelect_Selection)& sel)
2576 if (WorkLibrary().IsNull() || sel.IsNull()) return IFSelect_RetVoid;
2577 ComputeGraph(Standard_True);
2578 if (!IsLoaded()) return IFSelect_RetVoid;
2579 return SendSelected (filename,sel);
2582 // ################################################################
2583 // .... Actions particulieres sur les Selections ....
2585 //=======================================================================
2588 //=======================================================================
2590 Standard_Integer IFSelect_WorkSession::NbSources
2591 (const Handle(IFSelect_Selection)& sel) const
2593 if (ItemIdent(sel) == 0) return 0;
2594 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ||
2595 sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) return 1;
2596 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) return 2;
2597 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) return
2598 GetCasted(IFSelect_SelectCombine,sel)->NbInputs();
2603 //=======================================================================
2606 //=======================================================================
2608 Handle(IFSelect_Selection) IFSelect_WorkSession::Source
2609 (const Handle(IFSelect_Selection)& sel, const Standard_Integer num) const
2611 Handle(IFSelect_Selection) sr;
2612 if (ItemIdent(sel) == 0) return sr;
2613 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ) sr =
2614 GetCasted(IFSelect_SelectExtract,sel)->Input();
2615 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) sr =
2616 GetCasted(IFSelect_SelectDeduct,sel)->Input();
2617 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) {
2618 if (num == 1) sr = GetCasted(IFSelect_SelectControl,sel)->MainInput();
2619 else if (num == 2) sr = GetCasted(IFSelect_SelectControl,sel)->SecondInput();
2621 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) sr =
2622 GetCasted(IFSelect_SelectCombine,sel)->Input(num);
2627 //=======================================================================
2630 //=======================================================================
2632 Standard_Boolean IFSelect_WorkSession::IsReversedSelectExtract
2633 (const Handle(IFSelect_Selection)& sel) const
2635 if (ItemIdent(sel) == 0) return Standard_False;
2636 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2637 if (sxt.IsNull()) return Standard_False;
2638 return (!sxt->IsDirect());
2642 //=======================================================================
2645 //=======================================================================
2647 Standard_Boolean IFSelect_WorkSession::ToggleSelectExtract
2648 (const Handle(IFSelect_Selection)& sel)
2650 if (ItemIdent(sel) == 0) return Standard_False;
2651 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2652 if (sxt.IsNull()) return Standard_False;
2653 sxt->SetDirect(!sxt->IsDirect());
2654 return Standard_True;
2658 //=======================================================================
2661 //=======================================================================
2663 Standard_Boolean IFSelect_WorkSession::SetInputSelection
2664 (const Handle(IFSelect_Selection)& sel,
2665 const Handle(IFSelect_Selection)& inp)
2667 if (ItemIdent(sel) == 0) return Standard_False;
2668 if (!inp.IsNull() && ItemIdent(inp) == 0) return Standard_False;
2669 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2670 if (!sxt.IsNull()) { sxt->SetInput(inp); return Standard_True; }
2671 DeclareAndCast(IFSelect_SelectDeduct,sdt,sel);
2672 if (!sdt.IsNull()) { sdt->SetInput(inp); return Standard_True; }
2673 return Standard_False;
2677 //=======================================================================
2680 //=======================================================================
2682 Standard_Boolean IFSelect_WorkSession::SetControl
2683 (const Handle(IFSelect_Selection)& sel,
2684 const Handle(IFSelect_Selection)& sc,
2685 const Standard_Boolean formain)
2687 DeclareAndCast(IFSelect_SelectControl,dsel,sel);
2688 if (ItemIdent(dsel) == 0) return Standard_False;
2689 if (ItemIdent(sc) == 0) return Standard_False;
2690 if (formain) dsel->SetMainInput (sc);
2691 else dsel->SetSecondInput (sc);
2692 return Standard_True;
2696 //=======================================================================
2699 //=======================================================================
2701 Standard_Integer IFSelect_WorkSession::CombineAdd
2702 (const Handle(IFSelect_Selection)& sel,
2703 const Handle(IFSelect_Selection)& seladd,
2704 const Standard_Integer atnum)
2706 DeclareAndCast(IFSelect_SelectCombine,csel,sel);
2707 if (ItemIdent(csel) == 0) return 0;
2708 if (ItemIdent(seladd) == 0) return 0;
2709 csel->Add (seladd,atnum);
2710 return csel->NbInputs();
2714 //=======================================================================
2717 //=======================================================================
2719 Standard_Boolean IFSelect_WorkSession::CombineRemove
2720 (const Handle(IFSelect_Selection)& selcomb,
2721 const Handle(IFSelect_Selection)& selrem)
2723 DeclareAndCast(IFSelect_SelectCombine,csel,selcomb);
2724 if (ItemIdent(csel) == 0) return Standard_False;
2725 if (ItemIdent(selrem) == 0) return Standard_False;
2726 Standard_Integer nb = csel->NbInputs();
2727 for (Standard_Integer i = nb; i > 0; i --) {
2728 if (csel->Input(i) == selrem) {
2730 return Standard_True;
2733 return Standard_True;
2737 //=======================================================================
2740 //=======================================================================
2742 Handle(IFSelect_Selection) IFSelect_WorkSession::NewSelectPointed
2743 (const Handle(TColStd_HSequenceOfTransient)& list,
2744 const Standard_CString name)
2746 Handle(IFSelect_SelectPointed) sel = new IFSelect_SelectPointed;
2747 if (!list.IsNull()) sel->AddList (list);
2748 if (AddNamedItem (name,sel) == 0) sel.Nullify();
2753 //=======================================================================
2756 //=======================================================================
2758 Standard_Boolean IFSelect_WorkSession::SetSelectPointed
2759 (const Handle(IFSelect_Selection)& sel,
2760 const Handle(TColStd_HSequenceOfTransient)& list,
2761 const Standard_Integer mode) const
2763 DeclareAndCast(IFSelect_SelectPointed,sp,sel);
2764 if (sp.IsNull() || list.IsNull()) return Standard_False;
2765 if (mode == 0) sp->Clear();
2766 if (mode >= 0) sp->AddList(list);
2767 else sp->RemoveList(list);
2768 return Standard_True;
2772 // ###########################################################################
2773 // .... Analyse d un CheckIterator par rapport a un graphe ....
2775 //=======================================================================
2778 //=======================================================================
2780 static void IFSelect_QueryProp (Interface_IntList& list,
2781 TCollection_AsciiString& ana,
2782 const Standard_Integer num, const int quoi)
2784 list.SetNumber(num);
2785 Standard_Integer i, nb = list.Length();
2786 for (i = 1; i <= nb; i ++) {
2787 if (i > 1) list.SetNumber(num); // because recursive call + depth first
2788 Standard_Integer n = list.Value(i);
2789 // y a t il lieu de propager ?
2790 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2791 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2792 char val = ana.Value(n);
2794 case ' ' : val = (quoi ? '3' : '6'); break;
2795 case '1' : val = (quoi ? '4' : '7'); break;
2796 case '2' : val = (quoi ? '5' : '8'); break;
2797 case '3' : val = (quoi ? ' ' : '6'); break;
2798 case '4' : val = (quoi ? ' ' : '7'); break;
2799 case '5' : val = (quoi ? ' ' : '8'); break;
2800 case '6' : val = ' '; break;
2801 case '7' : val = ' '; break;
2802 case '8' : val = ' '; break;
2803 default : val = ' '; break;
2805 if (val == ' ') continue;
2806 ana.SetValue(n,val);
2807 IFSelect_QueryProp (list,ana,n,quoi);
2812 //=======================================================================
2815 //=======================================================================
2817 void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
2819 if (!IsLoaded()) return;
2820 Standard_Integer i,nb = themodel->NbEntities();
2821 thecheckana = TCollection_AsciiString (nb+1,' ');
2822 for (chl.Start(); chl.More(); chl.Next()) {
2823 Standard_Integer num = chl.Number();
2824 const Handle(Interface_Check) ach = chl.Value();
2825 if (ach->HasFailed()) thecheckana.SetValue(num,'2');
2826 else if (ach->HasWarnings()) thecheckana.SetValue(num,'1');
2828 // analyse selon le graphe ... codes : blc = rien
2829 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2830 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2831 Interface_IntList list;// = thegraph->Graph().SharingNums(0);
2832 // deux passes : d abord Warning, puis Fail
2833 for (i = 1; i <= nb; i ++) {
2834 char val = thecheckana.Value(i);
2836 if (val == '1' || val == '4' || val == '7') quoi = 0;
2837 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2839 for (i = 1; i <= nb; i ++) {
2840 char val = thecheckana.Value(i);
2842 if (val == '2' || val == '5' || val == '8') quoi = 1;
2843 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2848 //=======================================================================
2851 //=======================================================================
2853 Standard_Integer IFSelect_WorkSession::QueryCheckStatus
2854 (const Handle(Standard_Transient)& ent) const
2856 if (!IsLoaded()) return -1;
2857 Standard_Integer num = themodel->Number(ent);
2858 if (num == 0) return -1;
2859 if (thecheckana.Length() < num) return -1;
2860 Standard_Character val = thecheckana.Value (num);
2861 // codes : blc = rien -> 0
2862 // 1 W/place -> 1 2 F/place -> 2
2863 // 3 Wprop -> 10 4 Wprop+W/place -> 11 5 Wprop+F/place -> 12
2864 // 6 Fprop -> 20 7 Fprop+W/place -> 21 8 Fprop+F/place -> 22
2865 if (val == ' ') return 0;
2866 if (val == '1') return 1;
2867 if (val == '2') return 2;
2868 if (val == '3') return 10;
2869 if (val == '4') return 11;
2870 if (val == '5') return 12;
2871 if (val == '6') return 20;
2872 if (val == '7') return 21;
2873 if (val == '8') return 22;
2878 //=======================================================================
2881 //=======================================================================
2883 Standard_Integer IFSelect_WorkSession::QueryParent
2884 (const Handle(Standard_Transient)& entdad,
2885 const Handle(Standard_Transient)& entson) const
2887 Standard_Integer ndad = StartingNumber(entdad);
2888 Standard_Integer nson = StartingNumber(entson);
2889 if (ndad < 1 || nson < 1) return -1;
2890 if (ndad == nson) return 0;
2891 // on va calculer : pour chaque pere immediat, de <son>, status avec <dad> + 1
2892 // nb : pas protege contre les boucles ...
2893 Handle(TColStd_HSequenceOfTransient) list =
2894 thegraph->Graph().Sharings(entson).Content();
2895 if (list.IsNull()) return -1;
2896 Standard_Integer i, nb = list->Length();
2897 for (i = 1; i <= nb; i ++) {
2898 if (list->Value(i) == entdad) return 1;
2899 Standard_Integer stat = QueryParent ( entdad,list->Value(i) );
2900 if (stat >= 0) return stat+1;
2902 return -1; // not yet implemented ...
2905 // ###########################################################################
2906 // .... Dumps et Evaluations, pas faciles a passer en arguments ....
2908 // #### #### #### #### #### #### #### #### ####
2909 // .... DumpShare ....
2911 //=======================================================================
2914 //=======================================================================
2916 void IFSelect_WorkSession::SetParams
2917 (const TColStd_SequenceOfTransient& params,
2918 const TColStd_SequenceOfInteger& uselist)
2920 Standard_Integer i, nbp = params.Length(), nbu = uselist.Length();
2921 Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor
2922 (nbp+nbu+50,"Parameter Editor");
2923 for (i = 1; i <= nbp; i ++) {
2924 DeclareAndCast(Interface_TypedValue,val,params.Value(i));
2925 if (val.IsNull()) continue;
2926 editor->AddValue(val);
2928 AddNamedItem("xst-params-edit",editor);
2930 Handle(IFSelect_EditForm) paramsall = editor->Form(Standard_False);
2931 AddNamedItem("xst-params-all",paramsall);
2933 // On attaque les EditForms partielles
2934 TColStd_SequenceOfInteger listgen,listload,listsend,listsplit,listread,listwrite;
2935 for (i = 1; i <= nbu; i ++) {
2936 Standard_Integer use = uselist.Value(i);
2938 case 1 : listgen.Append(i); break;
2939 case 2 : listread.Append(i); break;
2940 case 3 : listsend.Append(i); break;
2941 case 4 : listsplit.Append(i); break;
2942 case 5 : listread.Append(i); break;
2943 case 6 : listwrite.Append(i); break;
2947 Handle(IFSelect_EditForm) paramsgen = new IFSelect_EditForm
2948 (editor,listgen ,Standard_False,Standard_True,"General Parameters");
2949 if (listgen.Length() > 0) AddNamedItem("xst-params-general",paramsgen);
2950 Handle(IFSelect_EditForm) paramsload = new IFSelect_EditForm
2951 (editor,listload,Standard_False,Standard_True,"Loading Parameters");
2952 if (listload.Length() > 0) AddNamedItem("xst-params-load", paramsload);
2953 Handle(IFSelect_EditForm) paramssend = new IFSelect_EditForm
2954 (editor,listsend,Standard_False,Standard_True,"Sending Parameters");
2955 if (listsend.Length() > 0) AddNamedItem("xst-params-send", paramssend);
2956 Handle(IFSelect_EditForm) paramsplit = new IFSelect_EditForm
2957 (editor,listsplit,Standard_False,Standard_True,"Split Parameters");
2958 if (listsplit.Length() > 0) AddNamedItem("xst-params-split", paramsplit);
2959 Handle(IFSelect_EditForm) paramsread = new IFSelect_EditForm
2960 (editor,listread,Standard_False,Standard_True,"Read(Transfer) Parameters");
2961 if (listread.Length() > 0) AddNamedItem("xst-params-read", paramsread);
2962 Handle(IFSelect_EditForm) paramswrite = new IFSelect_EditForm
2963 (editor,listwrite,Standard_False,Standard_True,"Write(Transfer) Parameters");
2964 if (listwrite.Length() > 0) AddNamedItem("xst-params-write", paramswrite);
2968 //=======================================================================
2971 //=======================================================================
2973 void IFSelect_WorkSession::TraceStatics
2974 (const Standard_Integer use, const Standard_Integer mode) const
2976 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2978 if (mode == 0) sout<<"******************************************"<<endl;
2980 if (mode == 0) sout<<"***** General Parameters *****"<<endl;
2981 } else if (use == 2) {
2982 if (mode == 0) sout<<"***** Load File *****"<<endl;
2983 } else if (use == 3) {
2984 if (mode == 0) sout<<"***** Write File *****"<<endl;
2985 } else if (use == 4) {
2986 if (mode == 0) sout<<"***** Split File *****"<<endl;
2987 } else if (use == 5) {
2988 if (mode == 0) sout<<"***** Transfer (Read) *****"<<endl;
2989 } else if (use == 6) {
2990 if (mode == 0) sout<<"***** Transfer (Write) *****"<<endl;
2992 if (mode == 0) sout<<"******************************************"<<endl<<endl;
2995 // Echainements particuliers (use > 0)
2997 TraceStatics (-2,mode);
2998 if (mode == 0) sout<<endl;
2999 } else if (use == 4 || use == 6) {
3000 TraceStatics (-3,mode);
3001 if (mode == 0) sout<<endl;
3004 // Valeurs particulieres
3005 if (use == 1 || use == -1) { // General : trace
3007 // sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<endl;
3009 } else if (use == 4 || use == -4) { // Split : Prefix & cie
3011 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3012 if (!str.IsNull()) sout << "Prefix : "<<str->ToCString()<<endl;
3013 else sout << "Prefix not Defined" << endl;
3014 str = theshareout->DefaultRootName();
3015 if (!str.IsNull()) sout << "Default Root : "<<str->ToCString()<<endl;
3016 else sout << "Default Root not Defined" << endl;
3017 str = theshareout->Extension();
3018 if (!str.IsNull()) sout << "Extension : "<<str->ToCString()<<endl;
3019 else sout << "Extension not defined" << endl;
3023 // LISTER LES STATICS
3024 // Passer par les ParamEditor ...
3028 if (mode == 0) sout<<"******************************************"<<endl<<endl;
3033 //=======================================================================
3036 //=======================================================================
3038 void IFSelect_WorkSession::DumpShare () const
3040 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3041 sout<<" ********** Definition ShareOut (Complete) **********"<<endl;
3043 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3044 if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << endl;
3045 else sout << "Prefix not Defined" << endl;
3046 str = theshareout->DefaultRootName();
3047 if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << endl;
3048 else sout << "Default Root not Defined" << endl;
3049 str = theshareout->Extension();
3050 if (!str.IsNull()) sout << "Extension : " << str->ToCString() << endl;
3051 else sout << "Extension not defined" << endl;
3053 Standard_Integer lr = theshareout->LastRun();
3054 Standard_Integer nb = theshareout->NbDispatches();
3055 sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<<endl;
3056 for (Standard_Integer i = 1; i <= nb; i ++) {
3057 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
3058 sout << "Dispatch n0 " << i;
3059 if (HasName(disp)) sout << " Name:"<< Name(disp)->ToCString();
3060 sout << " Label:" << disp->Label() << endl;
3061 Handle(IFSelect_Selection) sel = disp->FinalSelection();
3062 if (sel.IsNull()) sout << " No Final Selection Defined" << endl;
3063 else if (HasName(sel)) sout << " Final Selection : Name:"
3064 << Name(sel)->ToCString() << " Label:" << sel->Label() << endl;
3065 else sout << " Final Selection : " << sel->Label() << endl;
3066 if (disp->HasRootName())
3067 sout<<" File Root Name : "<<disp->RootName()->ToCString()<<endl;
3068 else sout<<" No specific file root name (see Default Root)"<<endl;
3070 Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
3072 " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<endl;
3073 Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
3075 " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<endl;
3076 if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<endl;
3079 // #### #### #### #### #### #### #### #### ####
3080 // .... ListItems ....
3082 //=======================================================================
3085 //=======================================================================
3087 void IFSelect_WorkSession::ListItems (const Standard_CString lab) const
3089 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3090 sout<< " ********** Items in Session **********"<<endl;
3091 Standard_Integer nb = MaxIdent();
3092 Handle(TCollection_HAsciiString) str;
3093 if (lab[0] != '\0') str = new TCollection_HAsciiString (lab);
3094 for (Standard_Integer i = 1; i <= nb; i ++) {
3095 const Handle(Standard_Transient)& var = theitems.FindKey(i);
3096 Handle(TCollection_HAsciiString) label = ItemLabel(i);
3097 if (label.IsNull()) continue; // -> item supprime
3098 if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; }
3100 if (HasName(var)) sout<<" - Named : "<<Name(var)->ToCString()<<" - ";
3101 else sout<<" - (no name) - ";
3102 sout<<var->DynamicType()->Name()<<endl<<" "<<label->ToCString()<<endl;
3106 // #### #### #### #### #### #### #### #### ####
3107 // .... ListModifiers
3109 //=======================================================================
3112 //=======================================================================
3114 void IFSelect_WorkSession::ListFinalModifiers
3115 (const Standard_Boolean formodel) const
3117 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3118 Standard_Integer nb = theshareout->NbModifiers(formodel);
3119 sout<< " ********** Modifiers in Session ";
3120 sout<<(formodel ? "(For Model)" : "(For File)");
3121 sout<<": "<<nb<<" **********"<<endl;
3122 for (Standard_Integer i = 1; i <= nb; i ++) {
3123 Handle(IFSelect_GeneralModifier) modif =
3124 theshareout->GeneralModifier(formodel,i);
3125 if (!modif.IsNull()) sout<<"Modifier n0."<<i<<" : "<<modif->Label();
3126 if (HasName(modif)) sout << " Named as : " << Name(modif)->ToCString();
3131 // #### #### #### #### #### #### #### #### ####
3132 // .... DumpSelection ....
3134 //=======================================================================
3137 //=======================================================================
3139 void IFSelect_WorkSession::DumpSelection
3140 (const Handle(IFSelect_Selection)& sel) const
3142 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3143 if (ItemIdent(sel) == 0) {
3144 sout << "Selection : "<<" Unknown"<<endl; //sout<<Handle
3147 sout << " ********** Selection";
3148 if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
3149 sout <<" **********"<<endl;
3150 sout<< "Label : " << sel->Label() << " . Input(s) : "<< endl;
3151 Standard_Integer nb = 0;
3152 IFSelect_SelectionIterator iter; sel->FillIterator(iter);
3153 for (; iter.More(); iter.Next()) {
3155 Handle(IFSelect_Selection) newsel = iter.Value();
3156 sout<<" -- "<<newsel->Label()<<endl;
3158 sout << " Nb Inputs:"<<nb<<endl;
3162 // ##########################################
3163 // ######### Fonctions complementaires
3164 // ##########################################
3166 // #### #### #### #### #### #### #### #### ####
3167 // .... DumpModel ....
3169 //=======================================================================
3172 //=======================================================================
3174 Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
3175 (const Standard_CString selname) const
3178 Standard_Integer np = -1, nf = -1, nivp = 0;
3179 for (Standard_Integer n = 0; selname[n] != '\0'; n ++) {
3180 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3181 if (selname[n] == '(') { np = n; nivp ++; }
3182 if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3183 //// if (selname[n] == ' ') { nb = n; break; }
3186 Handle(IFSelect_Selection) sel;
3187 if (np >= 0) nomsel[np] = 0; if (nf >= 0) nomsel[nf] = '\0';
3188 Handle(Standard_Transient) item = NamedItem(nomsel);
3190 // Parentheses ? essayer Signature (plus tard : Selection parametree)
3191 // NB : on compte les niveaux de parentheses (imbrications repercutees)
3192 if (np > 0 && nf > 0) {
3193 Handle(IFSelect_SelectSignature) selsign;
3194 Standard_Integer debsign = np+1;
3196 DeclareAndCast(IFSelect_Signature,sign,item);
3197 DeclareAndCast(IFSelect_SignCounter,cnt,item);
3198 if (!sign.IsNull()) selsign =
3199 new IFSelect_SelectSignature (sign,&nomsel[debsign],Standard_False);
3200 else if (!cnt.IsNull()) selsign =
3201 new IFSelect_SelectSignature (cnt,&nomsel[debsign],Standard_False);
3203 cout<<selname<<" : neither Signature nor Counter"<<endl;
3207 selsign->SetInput (new IFSelect_SelectModelEntities); // par defaut
3211 else sel = GetCasted(IFSelect_Selection,item);
3217 //=======================================================================
3220 //=======================================================================
3222 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3223 (const Handle(Standard_Transient)& obj) const
3226 DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
3227 if (!list.IsNull()) return list;
3229 // Rien du tout : retourne rien du tout
3230 if (obj.IsNull()) return list;
3232 // Une selection : son resultat (standard)
3233 DeclareAndCast(IFSelect_Selection,sel,obj);
3234 if (!sel.IsNull()) {
3235 Interface_EntityIterator iter = EvalSelection(sel);
3236 return iter.Content();
3239 // Le modele : son contenu
3240 list = new TColStd_HSequenceOfTransient();
3241 if (obj == themodel) {
3242 Standard_Integer i, nb = themodel->NbEntities();
3243 for (i = 1; i <= nb; i ++) list->Append (themodel->Value(i));
3246 // Une entite du modele : cette entite
3247 else if (StartingNumber(obj) > 0) list->Append (obj);
3249 // Un Texte : son interpretation
3251 DeclareAndCast(TCollection_HAsciiString,str,obj);
3252 if (!str.IsNull()) return GiveList (str->ToCString());
3255 // Si c est pas tout ca : une liste vide
3260 //=======================================================================
3263 //=======================================================================
3265 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3266 (const Standard_CString first, const Standard_CString second) const
3268 Handle(TColStd_HSequenceOfTransient) list;
3269 if (!first || first[0] == '\0') return list;
3270 if (first[0] == ' ') return GiveList (&first[1],second);
3271 if (second && second[0] == ' ') return GiveList (first,&second[1]);
3273 // list NULLE sera interpretee comme SelectionResult (selection toute crue)
3274 // sinon comme SelectionResultFromList
3275 if (second && second[0] != '\0') list = GiveList (second,"");
3277 list = GiveListFromList (first,list);
3282 //=======================================================================
3285 //=======================================================================
3287 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
3288 (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
3290 Handle(TColStd_HSequenceOfTransient) list;
3291 Standard_Integer num;
3293 // LISTE DEFINIE D OFFICE (en ce cas, la liste d entree est ignoree)
3294 if (selname[0] == '(') {
3295 // liste d entites donnees a la queue leu leu : (ID,ID,ID...)
3296 char entid[50]; Standard_Integer i,j = 0;
3297 TColStd_MapOfInteger numap;
3298 list = new TColStd_HSequenceOfTransient();
3299 for (i = 1; selname[i] != '\0'; i ++) {
3300 if (selname[i] == ' ') continue;
3301 if (selname[i] == ',' || selname[i] == ')') {
3303 if (j == 0) continue; j = 0;
3304 num = NumberFromLabel (entid);
3305 if (num <= 0 || !numap.Add (num)) continue;
3306 Handle(Standard_Transient) anent = StartingEntity(num);
3307 if (!anent.IsNull()) list->Append (anent);
3308 if (selname[i] == ')') break;
3311 entid[j] = selname[i]; j ++;
3315 num = NumberFromLabel (selname);
3316 if (num > 0) return GiveList(StartingEntity(num));
3318 // Autres cas : y atil une liste d entree.
3319 // Si OUI -> SelectionResultFromList. Si NON -> SelectionResult
3320 // Si une entite isolee -> on en fait une liste
3322 list = GiveList(ent); // ent NULL -> list NULL sinon intreprete
3324 // Decomposition term1 term2 ...
3326 char nomsel[500]; nomsel[0] = '\0';
3327 Standard_Integer n= 0 , nb = -1;
3328 for (n = 0; selname[n] != '\0'; n ++) {
3329 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3330 // if (selname[n] == '(') { np = n; nivp ++; }
3331 // if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3332 if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
3334 if (nomsel[0] == '\0') return list;
3336 Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
3338 cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<endl;
3342 if (nb > 0) list = GiveListFromList (&selname[nb+1],list);
3344 if (list.IsNull()) list = SelectionResult (sel);
3345 else list = SelectionResultFromList (sel,list);
3351 //=======================================================================
3354 //=======================================================================
3356 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
3357 (const Handle(TColStd_HSequenceOfTransient)& l1,
3358 const Handle(TColStd_HSequenceOfTransient)& l2,
3359 const Standard_Integer mode) const
3361 Handle(TColStd_HSequenceOfTransient) list;
3362 if (l1.IsNull() || l2.IsNull()) return list;
3364 // mode < 0 l1-l2 = 0 l1&l2 > 0 l1|l2 (l1+l2)
3365 TColStd_MapOfTransient numap;
3366 Standard_Integer i,n = l2->Length();
3367 for (i = n; i > 0; i --) {
3368 Handle(Standard_Transient) ent = l2->Value(i);
3369 if (ent.IsNull()) continue;
3371 if (mode > 0) list->Append(ent);
3374 // ents de l1 pas deja dans l2
3376 for (i = n; i > 0; i --) {
3377 Handle(Standard_Transient) ent = l1->Value(i);
3378 if (ent.IsNull()) continue;
3380 if (numap.Contains(ent)) {
3381 // dans l1 et dans l2
3382 if (mode == 0) list->Append(ent);
3384 // dans l1 mais pas dans l2
3385 if (mode != 0) list->Append(ent);
3394 //=======================================================================
3397 //=======================================================================
3399 void IFSelect_WorkSession::DumpModel
3400 (const Standard_Integer level, const Handle(Message_Messenger)& S)
3403 { S<< " *** Data for List not available ***"<<endl; return; }
3404 S << "\n *****************************************************************\n";
3405 if (theloaded.Length() > 0)
3406 S << " ******** Loaded File : "<<theloaded.ToCString()<<Interface_MSG::Blanks(32-theloaded.Length())<<" ********"<<endl;
3407 else S << " ******** No name for Loaded File"<<endl;
3409 S<<" ******** Short Dump of Header ********"<<"\n";
3410 S << " *****************************************************************\n\n";
3411 themodel->DumpHeader(S); S<<endl;
3414 Standard_Integer nbent = themodel->NbEntities();
3415 Standard_Integer nbr = 0;
3416 Interface_ShareFlags shar(thegraph->Graph());
3418 for (Standard_Integer i = 1; i <= nbent; i ++) {
3419 if (!shar.IsShared(themodel->Value(i))) nbr ++;
3421 S << " *****************************************************************\n";
3422 S << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<"\n";
3423 S << " *****************************************************************\n"<<endl;
3425 if (level <= 0) return;
3426 else if (level == 1) {
3427 S<<" ******** Root Entities ******** ";
3428 ListEntities (shar.RootEntities(),1);
3429 } else if (level == 2) {
3430 S<<" ******** Complete List ******** ";
3431 ListEntities (themodel->Entities(),1);
3432 } else if (level > 2) {
3433 IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
3434 if (level == 5 || level == 8) mode = IFSelect_CountByItem;
3435 if (level == 6 || level == 9) mode = IFSelect_ListByItem;
3436 if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
3437 PrintCheckList (ModelCheckList(),Standard_False, mode);
3439 if (level == 3) S << " ******** Check Model (Fails) ********"<<endl;
3440 else S << " ******** Check Model (Complete) ********"<<endl;
3441 Interface_CheckTool CT (Graph());
3442 Interface_CheckIterator C;
3446 if (level == 3) C = CT.CheckList();
3447 else C = CT.CompleteCheckList();
3449 catch (Standard_Failure) {
3450 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3451 sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
3452 S<<" ** ** Exception Raised during Check ! ** **\n";
3453 S<<" --> what could be determined is listed"<<endl;
3456 else if (level == 3) C = CT.CheckList();
3457 else C = CT.CompleteCheckList();
3459 // Check List : si vide (pas demandee), naturellement passee
3462 C.Print(S,themodel, (level == 3));
3464 catch (Standard_Failure) {
3465 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3466 sout<<" **** Interruption DumpModel par Exception : ****\n";
3467 sout<<Standard_Failure::Caught()->GetMessageString();
3468 sout<<"\n Abandon"<<endl;
3472 S<<endl<<"There are "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<endl;
3475 // .... TraceDumpModel .... (Model + CheckList)
3477 //=======================================================================
3480 //=======================================================================
3482 void IFSelect_WorkSession::TraceDumpModel
3483 (const Standard_Integer mode)
3485 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3486 DumpModel (mode,sout);
3487 // if (mode <= 4) { DumpModel (mode,sout); return; }
3489 // else if (mode <= 7) PrintCheckList (ModelCheckList(),Standard_False, mode-5);
3490 // else if (mode <=10) PrintCheckList (ModelCheckList(),Standard_True , mode-8);
3493 // .... DumpEntity ....
3495 //=======================================================================
3498 //=======================================================================
3500 void IFSelect_WorkSession::DumpEntity
3501 (const Handle(Standard_Transient)& ent, const Standard_Integer level,
3502 const Handle(Message_Messenger)& S) const
3505 { S<< " *** Data for List not available ***"<<endl; return; }
3506 Standard_Integer num = themodel->Number(ent);
3507 if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<<endl; return; }
3508 if (thelibrary.IsNull()) { S<<" *** WorkLibrary not defined ***"<<endl; return; }
3509 S << " ******** Dumping Entity n0 "<<num
3510 <<" level:"<<level<<" ********"<<endl;
3511 thelibrary->DumpEntity (themodel,theprotocol,ent,S,level);
3514 // .... DumpEntity ....
3516 //=======================================================================
3519 //=======================================================================
3521 void IFSelect_WorkSession::TraceDumpEntity
3522 (const Handle(Standard_Transient)& ent, const Standard_Integer level) const
3524 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3525 DumpEntity (ent,level,sout);
3528 // .... PrintEntityStatus ....
3530 //=======================================================================
3533 //=======================================================================
3535 void IFSelect_WorkSession::PrintEntityStatus
3536 (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S)
3538 Standard_Integer i,nb;
3539 Standard_Integer num = StartingNumber(ent);
3540 if (num == 0) { cout<<" -- PrintEntityStatus : unknown"<<endl; return; }
3542 S <<" Ent. n0/id: ";
3543 Model()->Print(ent,S);
3544 Handle(TCollection_HAsciiString) hname = EntityName(ent);
3545 if (!hname.IsNull() && hname->Length() > 0) S<<" Name:"<<hname->ToCString();
3547 Handle(IFSelect_Signature) signtype = SignType();
3548 if (signtype.IsNull()) S<<" Type(CDL):"<<ent->DynamicType()->Name()<<endl;
3549 else S <<" Type:"<<signtype->Value (ent,Model())<<endl;
3550 S <<" Category : " <<CategoryName (ent)
3551 <<" Validity : " <<ValidityName (ent) << endl;
3552 Interface_CheckIterator chl = CheckOne (ent);
3553 chl.Print (S,Model(),Standard_False,Standard_False);
3555 Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
3556 if (list.IsNull()) S<<" Root"<<endl;
3558 nb = list->Length();
3559 if (nb == 0) S<<" Root";
3560 else S<<" Super-entities:"<<nb<<" : (n0/id):";
3561 for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
3564 list = Shareds (ent);
3565 if (list.IsNull()) S<<" No sub-entity"<<endl;
3567 nb = list->Length();
3568 if (nb == 0) S<<" No sub-entity";
3569 else S<<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
3570 for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
3575 // .... PrintCheckList ....
3577 //=======================================================================
3580 //=======================================================================
3582 void IFSelect_WorkSession::PrintCheckList
3583 (const Interface_CheckIterator& checklist,
3584 const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const
3586 // mode : 0 comptage 1 n0s entites 2 n0s+id ents
3587 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3588 if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,themodel,failsonly);
3590 Interface_CheckIterator chks = checklist;
3591 Handle(IFSelect_CheckCounter) counter =
3592 new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
3593 counter->Analyse (chks,themodel,Standard_True,failsonly);
3594 counter->PrintList (sout,themodel,mode);
3598 // .... PrintSignatureList ....
3600 //=======================================================================
3603 //=======================================================================
3605 void IFSelect_WorkSession::PrintSignatureList
3606 (const Handle(IFSelect_SignatureList)& signlist,
3607 const IFSelect_PrintCount mode) const
3609 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3610 if (signlist.IsNull()) return;
3611 signlist->PrintList (sout,themodel,mode);
3614 // #### #### #### #### #### #### #### #### ####
3615 // .... EvaluateSelection ....
3617 //=======================================================================
3620 //=======================================================================
3622 void IFSelect_WorkSession::EvaluateSelection
3623 (const Handle(IFSelect_Selection)& sel) const
3625 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3627 errhand = Standard_False;
3630 EvaluateSelection(sel); // appel normal (->code unique)
3632 catch (Standard_Failure) {
3633 sout<<" **** Interruption EvaluateSelection par Exception **** Intitule\n";
3634 sout<<Standard_Failure::Caught()->GetMessageString();
3635 sout<<"\n Abandon"<<endl;
3637 errhand = theerrhand;
3642 { sout<< " *** Data for Evaluation not available ***"<<endl; return; }
3643 if (ItemIdent(sel) == 0)
3644 { sout << " Selection : "<<" Unknown"<<endl; return; } //sout<<Handle
3645 Interface_EntityIterator iter = EvalSelection (sel);
3646 ListEntities (iter,1);
3647 sout << "**** (Unique) RootResult, Selection : "
3648 <<sel->Label()<<endl;
3652 // #### #### #### #### #### #### #### #### ####
3653 // .... EvaluateDispatch ....
3655 //=======================================================================
3658 //=======================================================================
3660 void IFSelect_WorkSession::EvaluateDispatch
3661 (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode) const
3663 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3665 errhand = Standard_False;
3668 EvaluateDispatch(disp,mode); // appel normal (->code unique)
3670 catch (Standard_Failure) {
3671 sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n";
3672 sout<<Standard_Failure::Caught()->GetMessageString();
3673 sout<<"\n Abandon"<<endl;
3675 errhand = theerrhand;
3679 Standard_Integer numdisp = DispatchRank(disp);
3681 { sout<< " *** Data for List not available ***"<<endl; return; }
3682 if (theshareout->NbDispatches() < numdisp || numdisp <= 0)
3683 { sout<<"Dispatch : "<<" Unknown"<<endl; return; } //sout<<Handle
3684 if (disp->FinalSelection().IsNull())
3685 { sout<<"Dispatch "<<" : No Final Selection"<<endl; return; }//sout<<Handle
3686 sout<<" --- Dispatch Label : "<<disp->Label()<<endl;
3688 IFSelect_ShareOutResult eval(disp,thegraph->Graph());
3690 Standard_Integer numpack = 0;
3691 Handle(IFSelect_PacketList) evres =
3692 eval.Packets (mode ? Standard_True : Standard_False);
3693 Standard_Integer nbpack = evres->NbPackets();
3695 sout<<"Nb Packets produced : "<<nbpack<<" :"<<endl;
3696 for (numpack = 1; numpack <= nbpack; numpack ++) {
3697 sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
3698 if (!mode) cout<<"Root Entities :"<<endl;
3699 ListEntities (evres->Entities(numpack), (mode ? 2 : -1));
3702 //// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph());
3703 if (mode == 0) return;
3704 if (mode == 1 || mode == 3) {
3706 if (evres->NbDuplicated(0,Standard_False) == 0)
3707 sout<<" **** All the Model is taken into account ****"<<endl;
3709 sout<<" **** Starting Entities not taken by this Dispatch ****"<<endl;
3710 ListEntities (evres->Duplicated(0,Standard_False),2);
3714 sout<<" **** Entites in more than one packet ****";
3715 Standard_Integer max = evres->HighestDuplicationCount();
3716 if (max < 2) sout<<" : There are none"<<endl;
3718 Standard_Integer newcount;
3720 for (newcount = 2; newcount <= max; newcount ++) {
3721 if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
3722 sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
3723 ListEntities (evres->Duplicated(newcount,Standard_False),2);
3730 // #### #### #### #### #### #### #### #### ####
3731 // .... EvaluateComplete ....
3733 //=======================================================================
3736 //=======================================================================
3738 void IFSelect_WorkSession::EvaluateComplete
3739 (const Standard_Integer mode) const
3741 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3743 errhand = Standard_False;
3746 EvaluateComplete(mode); // appel normal (donc, code pas duplique)
3748 catch (Standard_Failure) {
3749 sout<<" **** Interruption EvaluateComplete par Exception : ****\n";
3750 sout<<Standard_Failure::Caught()->GetMessageString();
3751 sout<<"\n Abandon"<<endl;
3753 errhand = theerrhand;
3758 { sout<< " *** Data for List not available ***"<<endl; return; }
3759 IFSelect_ShareOutResult eval(theshareout,thegraph->Graph());
3761 sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n";
3762 sout<<" **** List of Packets **** Count : "<<eval.NbPackets()<<endl;
3763 if (mode == 0) sout << " ** (for each one : Root Entities) **"<<endl;
3764 else sout << " ** (for each one : Evaluated Content) **"<<endl;
3766 Standard_Integer numpack = 0;
3767 Handle(IFSelect_PacketList) evres =
3768 eval.Packets (mode ? Standard_True : Standard_False);
3769 Standard_Integer nbpack = evres->NbPackets();
3771 sout<<"Nb Packets produced : "<<nbpack<<" :"<<endl;
3772 for (numpack = 1; numpack <= nbpack; numpack ++) {
3773 sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
3774 if (!mode) cout<<"Root Entities :"<<endl;
3775 ListEntities (evres->Entities(numpack), (mode ? 2: -1));
3777 if (mode == 0) return;
3778 if (mode == 1 || mode == 3) {
3780 if (evres->NbDuplicated(0,Standard_False) == 0)
3781 sout<<" **** All the Model is taken into account ****"<<endl;
3783 sout<<" **** Starting Entities Forgotten ****"<<endl;
3784 ListEntities (evres->Duplicated(0,Standard_False),2);
3788 sout<<" **** Entites in more than one packet ****"<<endl;
3789 Standard_Integer max = evres->HighestDuplicationCount();
3790 if (max < 2) sout<<" : There are none"<<endl;
3792 Standard_Integer newcount;
3794 for (newcount = 2; newcount <= max; newcount ++) {
3795 if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
3796 sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
3797 ListEntities (evres->Duplicated(newcount,Standard_False),2);
3804 // #### #### #### #### #### #### #### #### ####
3805 // .... Routine Interne : ListEntities
3807 //=======================================================================
3810 //=======================================================================
3812 void IFSelect_WorkSession::ListEntities
3813 (const Interface_EntityIterator& iter, const Standard_Integer mmode) const
3815 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3817 Standard_Integer mode = (mmode < 0 ? -mmode : mmode);
3818 if (mmode >= 0) sout << " List of " << iter.NbEntities() << " Entities :"<<endl;
3820 { sout<< " *** Data for List not available ***"<<endl; return; }
3821 Interface_ShareFlags tool(thegraph->Graph());
3825 int newcount = -1; int mods = 0; int cnt = 0;
3826 for (iter.Start(); iter.More(); iter.Next()) {
3827 if (!titre && mode == 1) sout
3828 << "Number/Id. Category Validity Type\n----------- ----...."<<endl;
3829 // 123456789 123456789 123456 123456789 123456789 123456
3830 if (!titre && mode == 0) sout<<" Keys : R Root ? Unknown * Unloaded"<<endl;
3831 if (!titre && mode == 2) sout<<"(";
3833 Handle(Standard_Transient) ent = iter.Value();
3834 Standard_Integer num = themodel->Number(ent);
3836 // n0 id (root?) category validity tracetype
3837 sout<<Interface_MSG::Blanks (num,6);
3838 themodel->Print(ent,sout,0);
3839 if (!tool.IsShared(ent)) sout << " #ROOT#";
3841 Standard_Integer catnum = themodel->CategoryNumber(num);
3842 if (catnum > 0) sout<<" "<<Interface_Category::Name (catnum);
3843 sout << " (" << ValidityName (ent) << ") ";
3845 sout<<" Type:"<<themodel->TypeName (ent, Standard_False);
3846 // Handle(Interface_GeneralModule) tracemod;
3847 // Standard_Integer CN;
3848 // if (thegtool->Select(ent,tracemod,CN))tracemod->TraceType(ent,CN,sout);
3849 // else sout << "(Not in Protocol) " << ent->DynamicType();
3851 } else if (mode == 2) {
3853 if (newcount > 0) sout<<",";
3856 newcount ++; mods = 0; cnt ++;
3857 if (newcount >= 10) { sout << endl<<"["<<cnt<<"]:"; newcount = 1; }
3858 if (newcount > 0) sout << " ";
3859 themodel->Print(ent,sout,0);
3860 if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; }
3861 if (themodel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
3862 if (themodel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
3863 if (mods) { sout<<")"; newcount ++; }
3866 if (mode == 0) sout<<endl;
3867 if (mode == 2) sout<<")"<<endl;
3869 catch (Standard_Failure) {
3870 sout<<" **** Interruption ListEntities par Exception : ****\n";
3871 sout<<Standard_Failure::Caught()->GetMessageString();
3872 sout<<"\n Abandon"<<endl;
3876 void IFSelect_WorkSession::SetModeStat( Standard_Boolean theStatMode)
3878 themodelstat = theStatMode;
3881 Standard_Boolean IFSelect_WorkSession::GetModeStat() const
3883 return themodelstat;