1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 //#1 svv 10.01.00 : porting on DEC
19 //smh#14 17.03.2000 : FRA62479 Clearing of gtool
20 #include <Standard_ErrorHandler.hxx>
21 #include <IFSelect_WorkSession.ixx>
22 #include <IFSelect_DispPerOne.hxx>
23 #include <IFSelect_DispPerCount.hxx>
24 #include <IFSelect_DispGlobal.hxx>
25 #include <IFSelect_ShareOutResult.hxx>
26 #include <Interface_Graph.hxx>
27 #include <IFGraph_SubPartsIterator.hxx>
28 #include <IFSelect_PacketList.hxx>
29 #include <Interface_ReportEntity.hxx>
30 #include <Interface_Static.hxx>
32 #include <IFSelect_SignValidity.hxx>
33 #include <Interface_Category.hxx>
34 #include <Interface_Check.hxx>
35 #include <Interface_CheckTool.hxx>
36 #include <Interface_CheckIterator.hxx>
37 #include <Interface_ShareTool.hxx>
38 #include <Interface_ShareFlags.hxx>
39 #include <Interface_GeneralLib.hxx>
40 #include <Interface_GeneralModule.hxx>
41 #include <Dico_IteratorOfDictionaryOfTransient.hxx>
42 #include <Dico_IteratorOfDictionaryOfInteger.hxx>
43 #include <Interface_CopyTool.hxx>
44 #include <Interface_CopyControl.hxx>
46 #include <IFSelect_SelectDeduct.hxx>
47 #include <IFSelect_SelectExtract.hxx>
48 #include <IFSelect_SelectModelRoots.hxx>
49 #include <IFSelect_SelectModelEntities.hxx>
50 #include <IFSelect_SelectEntityNumber.hxx>
51 #include <IFSelect_SelectPointed.hxx>
52 #include <IFSelect_SelectControl.hxx>
53 #include <IFSelect_SelectDiff.hxx>
54 #include <IFSelect_SelectCombine.hxx>
55 #include <IFSelect_SelectUnion.hxx>
56 #include <IFSelect_SelectIntersection.hxx>
57 #include <IFSelect_SelectSignature.hxx>
59 #include <IFSelect_EditForm.hxx>
60 #include <IFSelect_Editor.hxx>
61 #include <IFSelect_ParamEditor.hxx>
62 #include <IFSelect_CheckCounter.hxx>
63 #include <IFSelect_TransformStandard.hxx>
65 #include <TColStd_MapOfInteger.hxx>
66 #include <OSD_Path.hxx>
67 #include <Interface_Macros.hxx>
68 #include <Interface_MSG.hxx>
69 #include <Message_Messenger.hxx>
70 #include <Message.hxx>
71 #include <Standard_Failure.hxx>
73 #define Flag_Incorrect 2
77 static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite
78 static TCollection_AsciiString bufstr;
81 // #################################################################
84 //=======================================================================
87 //=======================================================================
89 IFSelect_WorkSession::IFSelect_WorkSession ()
91 theshareout = new IFSelect_ShareOut;
92 theerrhand = errhand = Standard_True;
93 thenames = new Dico_DictionaryOfTransient;
94 thecopier = new IFSelect_ModelCopier;
95 thecopier->SetShareOut (theshareout);
96 thecheckdone = Standard_False;
97 thegtool = new Interface_GTool;
98 themodelstat = Standard_False;
102 //=======================================================================
105 //=======================================================================
107 void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand)
109 theerrhand = errhand = hand;
113 //=======================================================================
116 //=======================================================================
118 Standard_Boolean IFSelect_WorkSession::ErrorHandle () const
124 //=======================================================================
127 //=======================================================================
129 const Handle(IFSelect_ShareOut)& IFSelect_WorkSession::ShareOut () const
135 //=======================================================================
138 //=======================================================================
140 void IFSelect_WorkSession::SetLibrary (const Handle(IFSelect_WorkLibrary)& lib)
146 //=======================================================================
149 //=======================================================================
151 Handle(IFSelect_WorkLibrary) IFSelect_WorkSession::WorkLibrary () const
157 //=======================================================================
160 //=======================================================================
162 void IFSelect_WorkSession::SetProtocol
163 (const Handle(Interface_Protocol)& protocol)
165 theprotocol = protocol;
166 Interface_Protocol::SetActive(protocol);
167 thegtool->SetProtocol (protocol);
171 //=======================================================================
174 //=======================================================================
176 Handle(Interface_Protocol) IFSelect_WorkSession::Protocol () const
182 //=======================================================================
185 //=======================================================================
187 void IFSelect_WorkSession::SetSignType
188 (const Handle(IFSelect_Signature)& signtype)
190 thegtool->SetSignType (signtype);
191 if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type");
192 else thenames->SetItem ("xst-sign-type",signtype);
196 //=======================================================================
199 //=======================================================================
201 Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const
203 return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
207 //=======================================================================
210 //=======================================================================
212 void IFSelect_WorkSession::SetShareOut
213 (const Handle(IFSelect_ShareOut)& shareout)
215 theshareout = shareout;
216 thecopier->SetShareOut (theshareout);
217 // ... faudrait ajouter les Params, Dispatches, etc...
221 //=======================================================================
224 //=======================================================================
226 Standard_Boolean IFSelect_WorkSession::HasModel () const
228 return (!themodel.IsNull());
232 //=======================================================================
235 //=======================================================================
237 void IFSelect_WorkSession::SetModel
238 (const Handle(Interface_InterfaceModel)& model,
239 const Standard_Boolean clearpointed)
241 if (themodel != model) {
243 //skl if (!themodel.IsNull()) themodel->Clear();
246 if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
247 // themodel->SetProtocol(theprotocol);
248 themodel->SetGTool (thegtool);
251 ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien
252 ClearData(3); // RAZ CheckList, a refaire
255 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
256 if (clearpointed) ClearData(4);
261 //=======================================================================
264 //=======================================================================
265 Handle(Interface_InterfaceModel) IFSelect_WorkSession::Model () const
271 //=======================================================================
274 //=======================================================================
276 void IFSelect_WorkSession::SetLoadedFile (const Standard_CString filename)
279 theloaded.AssignCat (filename);
283 //=======================================================================
286 //=======================================================================
288 Standard_CString IFSelect_WorkSession::LoadedFile () const
290 return theloaded.ToCString();
294 //=======================================================================
297 //=======================================================================
299 IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
300 (const Standard_CString filename)
302 if (thelibrary.IsNull()) return IFSelect_RetVoid;
303 if (theprotocol.IsNull()) return IFSelect_RetVoid;
304 Handle(Interface_InterfaceModel) model;
305 IFSelect_ReturnStatus status = IFSelect_RetVoid;
308 Standard_Integer stat = thelibrary->ReadFile (filename,model,theprotocol);
309 if (stat == 0) status = IFSelect_RetDone;
310 else if (stat < 0) status = IFSelect_RetError;
311 else status = IFSelect_RetFail;
313 catch(Standard_Failure) {
314 Handle(Message_Messenger) sout = Message::DefaultMessenger();
315 sout<<" **** Interruption ReadFile par Exception : ****\n";
316 sout << Standard_Failure::Caught()->GetMessageString();
317 sout<<"\n Abandon"<<endl;
318 status = IFSelect_RetFail;
320 if (status != IFSelect_RetDone) return status;
321 if (model.IsNull()) return IFSelect_RetVoid;
323 SetLoadedFile (filename);
328 //=======================================================================
331 //=======================================================================
333 Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
335 if (themodel.IsNull()) return 0;
336 return themodel->NbEntities();
340 //=======================================================================
343 //=======================================================================
345 Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity
346 (const Standard_Integer num) const
348 Handle(Standard_Transient) res; // Null par defaut
349 if (themodel.IsNull()) return res;
350 if (num < 1 || num > themodel->NbEntities()) return res;
351 return themodel->Value(num);
355 //=======================================================================
358 //=======================================================================
360 Standard_Integer IFSelect_WorkSession::StartingNumber
361 (const Handle(Standard_Transient)& ent) const
363 if (themodel.IsNull()) return 0;
364 return themodel->Number(ent);
368 //=======================================================================
371 //=======================================================================
373 Standard_Integer IFSelect_WorkSession::NumberFromLabel
374 (const Standard_CString val, const Standard_Integer afternum) const
376 Standard_Integer i, cnt = 0, num = atoi(val);
377 if (num > 0 || themodel.IsNull()) return num; // un n0 direct : gagne !
378 // Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
379 if (num > themodel->NbEntities()) { num = 0; return num; }
380 Standard_Boolean exact = Standard_False;
381 Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
382 for (i = themodel->NextNumberForLabel (val, after, exact) ; i != 0;
383 i = themodel->NextNumberForLabel (val, i, exact)) {
385 if (num <= 0) num = i;
387 if (cnt == 1) return num;
394 //=======================================================================
397 //=======================================================================
399 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel
400 (const Handle(Standard_Transient)& ent) const
402 Handle(TCollection_HAsciiString) name;
403 if (themodel.IsNull() || ent.IsNull()) return name;
404 if (!themodel->Contains(ent)) return name;
405 name = themodel->StringLabel(ent);
410 //=======================================================================
413 //=======================================================================
415 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName
416 (const Handle(Standard_Transient)& ent) const
418 Handle(TCollection_HAsciiString) name;
419 if (themodel.IsNull() || ent.IsNull()) return name;
420 Interface_ShareTool sht(thegraph->Graph());
423 Handle(Interface_GeneralModule) module;
424 if (!thegtool->Select (ent,module,CN)) return 0;
425 return module->Name (CN,ent,sht);
429 //=======================================================================
432 //=======================================================================
434 Standard_Integer IFSelect_WorkSession::CategoryNumber
435 (const Handle(Standard_Transient)& ent) const
437 if (themodel.IsNull()) return -1;
438 Standard_Integer num = StartingNumber(ent);
439 return themodel->CategoryNumber(num);
443 //=======================================================================
446 //=======================================================================
448 Standard_CString IFSelect_WorkSession::CategoryName
449 (const Handle(Standard_Transient)& ent) const
451 Standard_Integer cn = CategoryNumber (ent);
452 return Interface_Category::Name (cn);
456 //=======================================================================
459 //=======================================================================
461 Standard_CString IFSelect_WorkSession::ValidityName
462 (const Handle(Standard_Transient)& ent) const
464 if (StartingNumber(ent) == 0) return "";
465 return IFSelect_SignValidity::CVal (ent,themodel);
469 //=======================================================================
472 //=======================================================================
474 void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
479 if (!themodel.IsNull()) themodel->Clear();
481 ClearData(2); ClearData(4);
485 case 2 : { thegraph.Nullify(); thecheckdone = Standard_False; thecheckana.Clear(); break; }
486 case 3 : { thecheckdone = Standard_False; break; }
488 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
489 // AINSI que des editeurs (en fait, les EditForm)
490 // Des compteurs C-A-D on efface leur contenu (a reevaluer)
491 Handle(TColStd_HSequenceOfInteger) list =
492 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
493 Standard_Integer nb = list->Length();
494 Standard_Integer i; // svv #1
495 for (i = 1; i <= nb; i ++) {
496 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
497 if (!sp.IsNull()) sp->Clear();
499 list = ItemIdents(STANDARD_TYPE(IFSelect_SignatureList));
501 for (i = 1; i <= nb; i ++) {
502 DeclareAndCast(IFSelect_SignatureList,sl,Item(list->Value(i)));
503 if (!sl.IsNull()) sl->Clear();
504 DeclareAndCast(IFSelect_SignCounter,sc,sl);
505 if (!sc.IsNull()) sc->SetSelMode(-1);
507 list = ItemIdents(STANDARD_TYPE(IFSelect_EditForm));
509 Handle(Standard_Transient) nulent;
510 for (i = 1; i <= nb; i ++) {
511 DeclareAndCast(IFSelect_EditForm,edf,Item(list->Value(i)));
522 //=======================================================================
525 //=======================================================================
527 Standard_Boolean IFSelect_WorkSession::ComputeGraph
528 (const Standard_Boolean enforce)
530 if (theprotocol.IsNull()) return Standard_False;
531 if (themodel.IsNull()) return Standard_False;
532 //if (themodel->NbEntities() == 0) return Standard_False;
533 if (enforce) thegraph.Nullify();
534 if (!thegraph.IsNull()) {
535 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
538 if (themodel->NbEntities() == 0) return Standard_False;
539 // Il faut calculer le graphe pour de bon
540 thegraph = new Interface_HGraph (themodel,themodelstat);
541 Standard_Integer nb = themodel->NbEntities();
544 Standard_Integer i; // svv #1
545 for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0);
546 Interface_BitMap& bm = thegraph->CGraph().CBitMap();
548 bm.SetFlagName (Flag_Incorrect,"Incorrect");
551 thecheckdone = Standard_True;
554 // Calcul des categories, a present memorisees dans le modele
555 Interface_Category categ(thegtool);
556 Interface_ShareTool sht(thegraph);
557 Standard_Integer i =1;
558 for ( ; i <= nb; i ++) themodel->SetCategoryNumber
559 (i,categ.CatNum(themodel->Value(i),sht));
562 return Standard_True;
566 //=======================================================================
569 //=======================================================================
571 Handle(Interface_HGraph) IFSelect_WorkSession::HGraph ()
578 //=======================================================================
581 //=======================================================================
583 const Interface_Graph& IFSelect_WorkSession::Graph ()
586 if (thegraph.IsNull()) Standard_DomainError::Raise
587 ("IFSelect WorkSession : Graph not available");
588 return thegraph->Graph();
592 //=======================================================================
595 //=======================================================================
597 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds
598 (const Handle(Standard_Transient)& ent)
600 Handle(TColStd_HSequenceOfTransient) list;
601 if (!ComputeGraph()) return list;
602 if (StartingNumber(ent) == 0) return list;
603 return thegraph->Graph().Shareds(ent).Content();
607 //=======================================================================
610 //=======================================================================
612 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings
613 (const Handle(Standard_Transient)& ent)
615 Handle(TColStd_HSequenceOfTransient) list;
616 if (!ComputeGraph()) return list;
617 if (StartingNumber(ent) == 0) return list;
618 return thegraph->Graph().Sharings(ent).Content();
622 //=======================================================================
625 //=======================================================================
627 Standard_Boolean IFSelect_WorkSession::IsLoaded () const
629 if (theprotocol.IsNull()) return Standard_False;
630 if (themodel.IsNull()) return Standard_False;
631 if (themodel->NbEntities() == 0) return Standard_False;
632 if (thegraph.IsNull()) return Standard_False;
633 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
634 return Standard_False;
638 //=======================================================================
641 //=======================================================================
643 Standard_Boolean IFSelect_WorkSession::ComputeCheck
644 (const Standard_Boolean enforce)
646 if (enforce) thecheckdone = Standard_False;
647 if (thecheckdone) return Standard_True;
648 if (!IsLoaded()) return Standard_False;
650 Interface_Graph& CG = thegraph->CGraph();
651 Interface_CheckTool cht(thegraph);
652 Interface_CheckIterator checklist = cht.VerifyCheckList();
653 themodel->FillSemanticChecks(checklist,Standard_False);
656 // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM)
657 Interface_BitMap& BM = CG.CBitMap();
658 BM.Init (Standard_False,Flag_Incorrect);
659 Standard_Integer num, nb = CG.Size();
660 for (checklist.Start(); checklist.More(); checklist.Next()) {
661 const Handle(Interface_Check) chk = checklist.Value();
662 if (!chk->HasFailed()) continue;
663 num = checklist.Number();
664 if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
666 for (num = 1; num <= nb; num ++)
667 if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
669 return Standard_True;
673 //=======================================================================
676 //=======================================================================
678 Interface_CheckIterator IFSelect_WorkSession::ModelCheckList
679 (const Standard_Boolean complete)
681 Interface_CheckIterator checks;
683 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
686 Interface_CheckTool cht(Graph());
687 checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList());
689 ((char*)(complete ? "Model Complete Check List" : "Model Syntactic Check List"));
694 //=======================================================================
697 //=======================================================================
699 Interface_CheckIterator IFSelect_WorkSession::CheckOne
700 (const Handle(Standard_Transient)& ent,
701 const Standard_Boolean complete)
703 Interface_CheckIterator checks;
704 checks.SetModel(themodel);
706 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
709 Standard_Integer num = -1;
710 if (ent.IsNull() || ent == themodel) num = 0;
711 else num = themodel->Number(ent);
713 Handle(Interface_Check) ach = themodel->Check (num,Standard_True);
714 if (complete) ach->GetMessages (themodel->Check (num,Standard_False));
715 if (num > 0) ach->SetEntity(ent);
716 checks.Add (ach,num);
717 checks.SetName ("Data Check (One Entity)");
722 //=======================================================================
725 //=======================================================================
727 Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const
733 // #####################################################################
734 // .... LES VARIABLES ....
736 //=======================================================================
739 //=======================================================================
741 Standard_Integer IFSelect_WorkSession::MaxIdent () const
743 return theitems.Extent();
747 //=======================================================================
750 //=======================================================================
752 Handle(Standard_Transient) IFSelect_WorkSession::Item
753 (const Standard_Integer id) const
755 Handle(Standard_Transient) res;
756 if (id <= 0 || id > MaxIdent()) return res;
757 if (theitems.FindFromIndex(id).IsNull()) return res;
758 return theitems.FindKey(id);
762 //=======================================================================
765 //=======================================================================
767 Standard_Integer IFSelect_WorkSession::ItemIdent
768 (const Handle(Standard_Transient)& item) const
770 if (item.IsNull()) return 0;
771 Standard_Integer id = theitems.FindIndex(item);
772 if (id == 0) return 0;
773 if (theitems.FindFromIndex(id).IsNull()) return 0;
778 //=======================================================================
781 //=======================================================================
783 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
784 (const Standard_CString name) const
786 Handle(Standard_Transient) res;
787 if (name[0] == '\0') return res;
788 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
789 Standard_Integer id = atoi( &name[1] );
792 if (!thenames->GetItem(name,res)) res.Nullify();
797 //=======================================================================
800 //=======================================================================
802 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
803 (const Handle(TCollection_HAsciiString)& name) const
805 Handle(Standard_Transient) res;
806 if (!name.IsNull()) res = NamedItem (name->ToCString());
811 //=======================================================================
814 //=======================================================================
816 Standard_Integer IFSelect_WorkSession::NameIdent
817 (const Standard_CString name) const
819 Handle(Standard_Transient) res;
820 if (name[0] == '\0') return 0;
821 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
822 Standard_Integer id = atoi( &name[1] );
825 if (!thenames->GetItem(name,res)) return 0;
826 return ItemIdent(res);
830 //=======================================================================
833 //=======================================================================
835 Standard_Boolean IFSelect_WorkSession::HasName
836 (const Handle(Standard_Transient)& item) const
838 if (item.IsNull()) return Standard_False;
839 Standard_Integer id = theitems.FindIndex(item);
840 if (id == 0) return Standard_False;
841 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
842 if (att.IsNull()) return Standard_False;
843 return att->IsKind(STANDARD_TYPE(TCollection_HAsciiString));
847 //=======================================================================
850 //=======================================================================
852 Handle(TCollection_HAsciiString) IFSelect_WorkSession::Name
853 (const Handle(Standard_Transient)& item) const
855 Handle(TCollection_HAsciiString) res;
856 if (item.IsNull()) return res;
857 Standard_Integer id = theitems.FindIndex(item);
858 if (id == 0) return res; // Null
859 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
860 return GetCasted(TCollection_HAsciiString,att);
864 //=======================================================================
867 //=======================================================================
869 Standard_Integer IFSelect_WorkSession::AddItem
870 (const Handle(Standard_Transient)& item,
871 const Standard_Boolean active)
873 if (item.IsNull()) return 0;
874 Standard_Integer id = theitems.FindIndex(item);
876 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
877 if (att.IsNull()) att = item;
879 else id = theitems.Add(item,item);
881 // Cas particuliers : Dispatch,Modifier
882 if (active) SetActive(item,Standard_True);
887 //=======================================================================
890 //=======================================================================
892 Standard_Integer IFSelect_WorkSession::AddNamedItem
893 (const Standard_CString name, const Handle(Standard_Transient)& item,
894 const Standard_Boolean active)
896 if (item.IsNull()) return 0;
897 if (name[0] == '#' || name[0] == '!') return 0;
898 // #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom)
899 // nom deja pris : on ecrase l ancienne valeur
900 if (name[0] != '\0') {
901 Standard_Boolean deja;
902 Handle(Standard_Transient)& newitem = thenames->NewItem(name,deja);
903 // if (deja & item != newitem) return 0;
906 Standard_Integer id = theitems.FindIndex(item);
908 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
909 if (att.IsNull()) att = item;
910 if (name[0] != '\0') {
911 // if (!att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) ecrasement admis !
912 att = new TCollection_HAsciiString(name);
915 else if (name[0] != '\0')
916 id = theitems.Add(item,new TCollection_HAsciiString(name));
917 else id = theitems.Add(item,item);
919 // Cas particuliers : Dispatch,Modifier
920 if (active) SetActive(item,Standard_True);
925 //=======================================================================
928 //=======================================================================
930 Standard_Boolean IFSelect_WorkSession::SetActive
931 (const Handle(Standard_Transient)& item, const Standard_Boolean mode)
933 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
934 DeclareAndCast(IFSelect_Dispatch,disp,item);
935 Standard_Integer num = theshareout->DispatchRank(disp);
936 if ( num > theshareout->NbDispatches()) return Standard_False;
938 if (num > 0) return Standard_False;
939 theshareout->AddDispatch (disp);
940 return Standard_True;
942 if (num <= theshareout->LastRun()) return Standard_False;
943 theshareout->RemoveDispatch(num);
944 SetFileRoot(disp,""); // si onlynamed : nettoie aussi ShareOut
945 return Standard_True;
949 return Standard_False;
953 //=======================================================================
956 //=======================================================================
958 Standard_Boolean IFSelect_WorkSession::RemoveNamedItem
959 (const Standard_CString name)
961 Handle(Standard_Transient) item = NamedItem(name);
962 if (item.IsNull()) return Standard_False;
963 if (!RemoveItem(item)) return Standard_False; // qui se charge de tout
964 return Standard_True;
968 //=======================================================================
971 //=======================================================================
973 Standard_Boolean IFSelect_WorkSession::RemoveName
974 (const Standard_CString name)
976 Handle(Standard_Transient) item = NamedItem(name);
977 if (item.IsNull()) return Standard_False;
978 theitems.Add(item,item); // reste mais sans nom
979 return thenames->RemoveItem(name);
983 //=======================================================================
986 //=======================================================================
988 Standard_Boolean IFSelect_WorkSession::RemoveItem
989 (const Handle(Standard_Transient)& item)
991 if (item.IsNull()) return Standard_False;
992 Standard_Integer id = theitems.FindIndex(item);
993 if (id == 0) return Standard_False;
994 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
995 if (att.IsNull()) return Standard_False; // deja annulle
997 // Cas particuliers : Dispatch,Modifier
998 theshareout->RemoveItem(item);
1000 // Marquer "Removed" dans la Map (on ne peut pas la vider)
1001 if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) {
1002 if (!thenames->RemoveItem
1003 (GetCasted(TCollection_HAsciiString,att)->ToCString()))
1004 return Standard_False;
1006 att.Nullify(); // cf ChangeFromIndex
1007 // id = theitems.Add(item,att);
1008 return Standard_True;
1012 //=======================================================================
1015 //=======================================================================
1017 void IFSelect_WorkSession::ClearItems ()
1021 theshareout->Clear(Standard_False);
1025 //=======================================================================
1028 //=======================================================================
1030 Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel
1031 (const Standard_Integer id) const
1033 Handle(TCollection_HAsciiString) res;
1034 Handle(Standard_Transient) var = Item(id);
1035 if (var.IsNull()) return res;
1036 DeclareAndCast(TCollection_HAsciiString,text,var);
1037 if (!text.IsNull()) {
1038 res = new TCollection_HAsciiString("Text:");
1039 res->AssignCat(text);
1042 DeclareAndCast(IFSelect_IntParam,intpar,var);
1043 if (!intpar.IsNull()) {
1044 res = new TCollection_HAsciiString(intpar->Value());
1045 res->Insert(1,"Integer:");
1048 DeclareAndCast(IFSelect_Selection,sel,var);
1049 if (!sel.IsNull()) {
1050 res = new TCollection_HAsciiString("Selection:");
1051 res->AssignCat(sel->Label().ToCString());
1054 DeclareAndCast(IFSelect_GeneralModifier,mod,var);
1055 if (!mod.IsNull()) {
1056 if (mod->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
1057 res = new TCollection_HAsciiString("ModelModifier:");
1058 else res = new TCollection_HAsciiString("FileModifier:");
1059 res->AssignCat(mod->Label().ToCString());
1062 DeclareAndCast(IFSelect_Dispatch,disp,var);
1063 if (!disp.IsNull()) {
1064 res = new TCollection_HAsciiString("Dispatch:");
1065 res->AssignCat(disp->Label().ToCString());
1068 DeclareAndCast(IFSelect_Transformer,tsf,var);
1069 if (!tsf.IsNull()) {
1070 res = new TCollection_HAsciiString("Transformer:");
1071 res->AssignCat(tsf->Label().ToCString());
1074 DeclareAndCast(IFSelect_SignatureList,slc,var);
1075 if (!slc.IsNull()) {
1076 res = new TCollection_HAsciiString("Counter:");
1077 res->AssignCat(slc->Name());
1080 DeclareAndCast(IFSelect_Signature,sig,var);
1081 if (!sig.IsNull()) {
1082 res = new TCollection_HAsciiString("Signature:");
1083 res->AssignCat(sig->Name());
1086 DeclareAndCast(IFSelect_EditForm,edf,var);
1087 if (!edf.IsNull()) {
1088 res = new TCollection_HAsciiString("EditForm:");
1089 res->AssignCat(edf->Label());
1092 DeclareAndCast(IFSelect_Editor,edt,var);
1093 if (!edt.IsNull()) {
1094 res = new TCollection_HAsciiString("Editor:");
1095 res->AssignCat(edt->Label().ToCString());
1098 res = new TCollection_HAsciiString("VariableType:");
1099 res->AssignCat(var->DynamicType()->Name());
1104 //=======================================================================
1107 //=======================================================================
1109 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents
1110 (const Handle(Standard_Type)& type) const
1112 Handle(TColStd_HSequenceOfInteger) list =
1113 new TColStd_HSequenceOfInteger();
1114 Standard_Integer nb = theitems.Extent();
1115 for (Standard_Integer i = 1; i <= nb; i ++) {
1116 if (theitems.FindKey(i)->IsKind(type)) list->Append(i);
1122 //=======================================================================
1125 //=======================================================================
1127 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNames
1128 (const Handle(Standard_Type)& type) const
1130 Handle(TColStd_HSequenceOfHAsciiString) list =
1131 new TColStd_HSequenceOfHAsciiString();
1132 for (Dico_IteratorOfDictionaryOfTransient IT(thenames); IT.More(); IT.Next()){
1133 if (IT.Value()->IsKind(type)) list->Append
1134 (new TCollection_HAsciiString(IT.Name().ToCString()));
1140 // .. Recherche par label : recherche en liste(noms) ou iterative
1142 //=======================================================================
1145 //=======================================================================
1147 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNamesForLabel
1148 (const Standard_CString label) const
1150 Handle(TColStd_HSequenceOfHAsciiString) list =
1151 new TColStd_HSequenceOfHAsciiString();
1152 Standard_Integer i, nb = MaxIdent();
1153 for (i = 1; i <= nb; i ++) {
1154 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1155 Handle(Standard_Transient) item = Item(i);
1156 if (lab.IsNull()) continue;
1157 if (label[0] != '\0' && lab->Search(label) <= 0) continue;
1159 Handle(TCollection_HAsciiString) nom = Name(Item(i));
1160 if (nom.IsNull()) { nom = new TCollection_HAsciiString(i); nom->Insert(1,'#'); }
1161 else nom = new TCollection_HAsciiString (nom);
1162 list->Append (new TCollection_HAsciiString(lab));
1168 //=======================================================================
1171 //=======================================================================
1173 Standard_Integer IFSelect_WorkSession::NextIdentForLabel
1174 (const Standard_CString label, const Standard_Integer id,
1175 const Standard_Integer mode) const
1177 Standard_Integer nb = MaxIdent();
1178 for (Standard_Integer i = id+1; i <= nb; i ++) {
1179 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1180 if (lab.IsNull()) continue;
1182 case 0 : if (!strcmp(lab->ToCString(),label)) return i; break; // switch
1183 case 1 : if (lab->Search(label) == 1 ) return i; break;
1184 case 2 : if (lab->Search(label) > 0 ) return i; break;
1185 default : break; // break du switch
1188 return 0; // ici : pas trouve
1192 // #################################################################
1193 // .... Parametres (Int et Text) ....
1195 //=======================================================================
1198 //=======================================================================
1200 Handle(Standard_Transient) IFSelect_WorkSession::NewParamFromStatic
1201 (const Standard_CString statname, const Standard_CString name)
1203 Handle(Standard_Transient) param;
1204 Handle(Interface_Static) stat = Interface_Static::Static(statname);
1205 if (stat.IsNull()) return param;
1206 if (stat->Type() == Interface_ParamInteger) {
1207 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1208 intpar->SetStaticName (statname);
1211 param = stat->HStringValue();
1213 if (param.IsNull()) return param;
1214 if ( AddNamedItem (name, param) == 0 ) param.Nullify();
1219 //=======================================================================
1222 //=======================================================================
1224 Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam
1225 (const Standard_Integer id) const
1226 { return Handle(IFSelect_IntParam)::DownCast(Item(id)); }
1229 //=======================================================================
1232 //=======================================================================
1234 Standard_Integer IFSelect_WorkSession::IntValue
1235 (const Handle(IFSelect_IntParam)& par) const
1237 if (!par.IsNull()) return par->Value();
1242 //=======================================================================
1245 //=======================================================================
1247 Handle(IFSelect_IntParam) IFSelect_WorkSession::NewIntParam
1248 (const Standard_CString name)
1250 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1251 if ( AddNamedItem (name, intpar) == 0 ) intpar.Nullify();
1256 //=======================================================================
1259 //=======================================================================
1261 Standard_Boolean IFSelect_WorkSession::SetIntValue
1262 (const Handle(IFSelect_IntParam)& par, const Standard_Integer val)
1264 if (ItemIdent(par) == 0) return Standard_False;
1266 return Standard_True;
1270 //=======================================================================
1273 //=======================================================================
1275 Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam
1276 (const Standard_Integer id) const
1277 { return Handle(TCollection_HAsciiString)::DownCast(Item(id)); }
1280 //=======================================================================
1283 //=======================================================================
1285 TCollection_AsciiString IFSelect_WorkSession::TextValue
1286 (const Handle(TCollection_HAsciiString)& par) const
1288 if (!par.IsNull()) return TCollection_AsciiString(par->ToCString());
1289 else return TCollection_AsciiString();
1293 Handle(TCollection_HAsciiString) IFSelect_WorkSession::NewTextParam
1294 (const Standard_CString name)
1296 Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString("");
1297 if ( AddNamedItem (name, textpar) == 0 ) textpar.Nullify();
1302 //=======================================================================
1305 //=======================================================================
1307 Standard_Boolean IFSelect_WorkSession::SetTextValue
1308 (const Handle(TCollection_HAsciiString)& par, const Standard_CString val)
1310 if (ItemIdent(par) == 0) return Standard_False;
1311 par->Clear(); par->AssignCat(val);
1312 return Standard_True;
1315 // ########################################################################
1316 // .... SIGNATURES ....
1318 //=======================================================================
1321 //=======================================================================
1323 Handle(IFSelect_Signature) IFSelect_WorkSession::Signature
1324 (const Standard_Integer id) const
1325 { return GetCasted(IFSelect_Signature,Item(id)); }
1327 Standard_CString IFSelect_WorkSession::SignValue
1328 (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const
1330 if (sign.IsNull() || themodel.IsNull()) return "";
1331 if (StartingNumber(ent) == 0) return "";
1332 return sign->Value (ent,themodel);
1335 // ########################################################################
1336 // .... SELECTIONS & Cie ....
1338 //=======================================================================
1341 //=======================================================================
1343 Handle(IFSelect_Selection) IFSelect_WorkSession::Selection
1344 (const Standard_Integer id) const
1345 { return GetCasted(IFSelect_Selection,Item(id)); }
1348 //=======================================================================
1351 //=======================================================================
1353 Interface_EntityIterator IFSelect_WorkSession::EvalSelection
1354 (const Handle(IFSelect_Selection)& sel) const
1356 Interface_EntityIterator iter;
1358 errhand = Standard_False;
1361 iter = EvalSelection(sel); // appel normal (donc, code pas duplique)
1363 catch (Standard_Failure) {
1364 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1365 sout<<" **** Interruption EvalSelection par Exception : ****\n";
1366 sout<<Standard_Failure::Caught()->GetMessageString();
1367 sout<<"\n Abandon"<<endl;
1369 errhand = theerrhand;
1373 if (thegraph.IsNull()) return iter;
1374 iter = sel->UniqueResult(thegraph->Graph());
1379 //=======================================================================
1382 //=======================================================================
1384 IFSelect_SelectionIterator IFSelect_WorkSession::Sources
1385 (const Handle(IFSelect_Selection)& sel) const
1387 return IFSelect_SelectionIterator (sel);
1391 //=======================================================================
1394 //=======================================================================
1396 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResult
1397 (const Handle(IFSelect_Selection)& sel) const
1399 Handle(TColStd_HSequenceOfTransient) res;
1401 errhand = Standard_False;
1404 res = SelectionResult(sel); // appel normal (->code unique)
1406 catch (Standard_Failure) {
1407 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1408 sout<<" **** Interruption SelectionResult par Exception : ****\n";
1409 sout<<Standard_Failure::Caught()->GetMessageString();
1410 sout<<"\n Abandon"<<endl;
1412 errhand = theerrhand;
1417 cout<< " *** Data for Evaluation not available ***"<<endl;
1418 return new TColStd_HSequenceOfTransient();
1420 // if (ItemIdent(sel) == 0)
1422 { cout << " Selection : "<<" Unknown"<<endl; return res; } //cout<<Handle
1423 return EvalSelection (sel).Content();
1427 //=======================================================================
1430 //=======================================================================
1432 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromList
1433 (const Handle(IFSelect_Selection)& sel,
1434 const Handle(TColStd_HSequenceOfTransient)& list) const
1436 if (list.IsNull()) return SelectionResult (sel);
1437 DeclareAndCast(IFSelect_SelectDeduct,deduct,sel);
1438 if (deduct.IsNull()) return SelectionResult (sel);
1440 // On va chercher la derniere deduction de la chaine des inputs
1441 Handle(IFSelect_Selection) ssel, newinput;
1443 Standard_Integer i, nb = MaxIdent();
1444 for (i = 1; i <= nb * 2; i ++) {
1445 newinput = deduct->Input();
1446 deduct = GetCasted(IFSelect_SelectDeduct,newinput);
1447 if (deduct.IsNull()) break;
1451 // on y est (enfin, on devrait)
1452 // ssel est la derniere selection auscultee, deduct son downcast
1453 // input son Input (nulle si sel pas une deduction)
1454 deduct = GetCasted(IFSelect_SelectDeduct,ssel);
1456 deduct->Alternate()->SetList (list);
1458 // On execute puis on nettoie
1459 Handle(TColStd_HSequenceOfTransient) res = SelectionResult (sel);
1460 //// deduct->SetInput (newinput);
1465 //=======================================================================
1468 //=======================================================================
1470 Standard_Boolean IFSelect_WorkSession::SetItemSelection
1471 (const Handle(Standard_Transient)& item,
1472 const Handle(IFSelect_Selection)& sel)
1474 DeclareAndCast(IFSelect_Dispatch,disp,item);
1475 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1476 if (!disp.IsNull()) {
1477 if (ItemIdent(disp) == 0) return Standard_False;
1478 // Selection Nulle : Annuler FinalSelection
1479 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1480 disp->SetFinalSelection(sel);
1481 return Standard_True;
1483 if (!modif.IsNull()) {
1484 if (ItemIdent(modif) == 0) return Standard_False;
1485 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1486 // Selection Nulle : Annuler Selection
1487 modif->SetSelection(sel);
1488 return Standard_True;
1490 return Standard_False;
1494 //=======================================================================
1497 //=======================================================================
1499 Standard_Boolean IFSelect_WorkSession::ResetItemSelection
1500 (const Handle(Standard_Transient)& item)
1502 Handle(IFSelect_Selection) nulsel;
1503 return SetItemSelection (item,nulsel);
1507 //=======================================================================
1510 //=======================================================================
1512 Handle(IFSelect_Selection) IFSelect_WorkSession::ItemSelection
1513 (const Handle(Standard_Transient)& item) const
1515 Handle(IFSelect_Selection) sel;
1516 DeclareAndCast(IFSelect_Dispatch,disp,item);
1517 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1518 if (ItemIdent(disp) > 0) return disp->FinalSelection();
1519 if (ItemIdent(modif) > 0) return modif->Selection();
1520 return sel; // Nul ou inconnu -> Null
1523 // ######################################################################
1524 // .... Les COMPTEURS ....
1526 //=======================================================================
1529 //=======================================================================
1531 Handle(IFSelect_SignCounter) IFSelect_WorkSession::SignCounter
1532 (const Standard_Integer id) const
1533 { return GetCasted(IFSelect_SignCounter,Item(id)); }
1536 //=======================================================================
1539 //=======================================================================
1541 Standard_Boolean IFSelect_WorkSession::ComputeCounter
1542 (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced)
1544 if (counter.IsNull()) return Standard_False;
1545 if (!ComputeGraph()) return Standard_False;
1546 return counter->ComputeSelected (Graph(),forced);
1550 //=======================================================================
1553 //=======================================================================
1555 Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList
1556 (const Handle(IFSelect_SignCounter)& counter,
1557 const Handle(TColStd_HSequenceOfTransient)& list,
1558 const Standard_Boolean clear)
1560 if (counter.IsNull()) return Standard_False;
1561 if (clear) counter->Clear();
1562 if (list.IsNull()) return ComputeCounter (counter,Standard_True);
1563 counter->AddList (list,themodel);
1564 return Standard_True;
1567 // ######################################################################
1568 // .... Les DISPATCHES ....
1570 //=======================================================================
1573 //=======================================================================
1575 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::AppliedDispatches
1578 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1579 Standard_Integer nb = theshareout->NbDispatches();
1580 for (Standard_Integer i = 1; i <= nb; i ++) {
1581 list->Append (ItemIdent(theshareout->Dispatch(i)));
1587 //=======================================================================
1590 //=======================================================================
1592 void IFSelect_WorkSession::ClearShareOut (const Standard_Boolean onlydisp)
1594 theshareout->Clear(onlydisp);
1598 //=======================================================================
1601 //=======================================================================
1603 Handle(IFSelect_Dispatch) IFSelect_WorkSession::Dispatch
1604 (const Standard_Integer id) const
1606 return GetCasted(IFSelect_Dispatch,Item(id));
1610 //=======================================================================
1613 //=======================================================================
1615 Standard_Integer IFSelect_WorkSession::DispatchRank
1616 (const Handle(IFSelect_Dispatch)& disp) const
1618 if (ItemIdent(disp) == 0) return 0;
1619 return theshareout->DispatchRank(disp);
1622 // ######################################################################
1623 // .... Les MODIFIERS ....
1625 //=======================================================================
1628 //=======================================================================
1630 Handle(IFSelect_ModelCopier) IFSelect_WorkSession::ModelCopier () const
1636 //=======================================================================
1639 //=======================================================================
1641 void IFSelect_WorkSession::SetModelCopier
1642 (const Handle(IFSelect_ModelCopier)& copier)
1645 thecopier->SetShareOut(theshareout);
1649 //=======================================================================
1652 //=======================================================================
1654 Standard_Integer IFSelect_WorkSession::NbFinalModifiers
1655 (const Standard_Boolean formodel) const
1657 return theshareout->NbModifiers(formodel);
1661 //=======================================================================
1664 //=======================================================================
1666 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents
1667 (const Standard_Boolean formodel) const
1669 // return ItemIdents(STANDARD_TYPE(IFSelect_Modifier));
1670 // On donne la liste dans l ordre du ModelCopier, qui fait foi
1671 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1672 Standard_Integer nbm = theshareout->NbModifiers(formodel);
1673 for (Standard_Integer i = 1; i <= nbm; i ++)
1674 list->Append(ItemIdent(theshareout->GeneralModifier(formodel,i)));
1679 //=======================================================================
1682 //=======================================================================
1684 Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier
1685 (const Standard_Integer id) const
1687 return GetCasted(IFSelect_GeneralModifier,Item(id));
1691 //=======================================================================
1694 //=======================================================================
1696 Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier
1697 (const Standard_Integer id) const
1699 return GetCasted(IFSelect_Modifier,Item(id));
1703 //=======================================================================
1706 //=======================================================================
1708 Standard_Integer IFSelect_WorkSession::ModifierRank
1709 (const Handle(IFSelect_GeneralModifier)& modif) const
1711 if (ItemIdent(modif) == 0) return 0;
1712 return theshareout->ModifierRank(modif);
1716 //=======================================================================
1719 //=======================================================================
1721 Standard_Boolean IFSelect_WorkSession::ChangeModifierRank
1722 (const Standard_Boolean formodel,
1723 const Standard_Integer before, const Standard_Integer after)
1725 return theshareout->ChangeModifierRank(formodel,before,after);
1729 //=======================================================================
1732 //=======================================================================
1734 void IFSelect_WorkSession::ClearFinalModifiers ()
1736 Handle(TColStd_HSequenceOfInteger) list = FinalModifierIdents (Standard_True);
1737 Standard_Integer nb = list->Length();
1738 Standard_Integer i; // svv #1
1739 for (i = 1; i <= nb; i ++)
1740 RemoveItem(GeneralModifier(list->Value(i)));
1741 list = FinalModifierIdents (Standard_False);
1742 nb = list->Length();
1743 for (i = 1; i <= nb; i ++)
1744 RemoveItem(GeneralModifier(list->Value(i)));
1748 //=======================================================================
1751 //=======================================================================
1753 Standard_Boolean IFSelect_WorkSession::SetAppliedModifier
1754 (const Handle(IFSelect_GeneralModifier)& modif,
1755 const Handle(Standard_Transient)& item)
1757 if (ItemIdent(modif) == 0) return Standard_False;
1759 if (item.IsNull()) return Standard_False;
1760 if (item == theshareout) {
1761 theshareout->AddModifier(modif,0);
1762 return Standard_True;
1764 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
1765 DeclareAndCast(IFSelect_Dispatch,disp,item);
1766 theshareout->AddModifier(modif,0);
1767 modif->SetDispatch(disp);
1768 return Standard_True;
1770 if (item->IsKind(STANDARD_TYPE(IFSelect_TransformStandard))) {
1771 DeclareAndCast(IFSelect_TransformStandard,stf,item);
1772 DeclareAndCast(IFSelect_Modifier,tmod,modif);
1773 if (tmod.IsNull()) return Standard_False;
1774 stf->AddModifier (tmod);
1775 theshareout->RemoveItem(modif);
1776 return Standard_True;
1778 return Standard_False;
1782 //=======================================================================
1785 //=======================================================================
1787 Standard_Boolean IFSelect_WorkSession::ResetAppliedModifier
1788 (const Handle(IFSelect_GeneralModifier)& modif)
1790 if (ItemIdent(modif) == 0) return Standard_False;
1792 return theshareout->RemoveItem(modif);
1796 //=======================================================================
1799 //=======================================================================
1801 Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier
1802 (const Handle(IFSelect_GeneralModifier)& modif) const
1804 Handle(Standard_Transient) res;
1805 if (ItemIdent(modif) == 0) return res;
1806 if (theshareout->ModifierRank(modif) == 0) return res;
1807 res = modif->Dispatch();
1808 if (res.IsNull()) res = theshareout;
1812 // #################################################################
1813 // .... Transformer ....
1815 //=======================================================================
1818 //=======================================================================
1820 Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer
1821 (const Standard_Integer id) const
1823 return GetCasted(IFSelect_Transformer,Item(id));
1827 //=======================================================================
1830 //=======================================================================
1832 Standard_Integer IFSelect_WorkSession::RunTransformer
1833 (const Handle(IFSelect_Transformer)& transf)
1835 Standard_Integer effect = 0;
1836 if (transf.IsNull() || !IsLoaded()) return effect;
1837 Handle(Interface_InterfaceModel) newmod; // Null au depart
1838 Interface_CheckIterator checks;
1839 checks.SetName("X-STEP WorkSession : RunTransformer");
1840 Standard_Boolean res = transf->Perform
1841 (thegraph->Graph(),theprotocol,checks,newmod);
1843 if (!checks.IsEmpty(Standard_False)) {
1844 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1845 sout<<" ** RunTransformer has produced Check Messages : **"<<endl;
1846 checks.Print (sout,themodel,Standard_False);
1848 thecheckdone = Standard_False;
1849 thecheckrun = checks;
1851 if (newmod.IsNull()) return (res ? 1 : -1);
1852 // MISE A JOUR des SelectPointed
1853 Handle(TColStd_HSequenceOfInteger) list =
1854 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1855 Standard_Integer nb = list->Length();
1856 for (Standard_Integer i = 1; i <= nb; i ++) {
1857 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
1860 if (newmod == themodel) {
1861 effect = (res ? 2 : -2);
1862 if (!res) return effect;
1863 Handle(Interface_Protocol) newproto = theprotocol;
1864 if (transf->ChangeProtocol(newproto))
1865 { effect = 4; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1866 return (ComputeGraph(Standard_True) ? 4 : -4);
1868 effect = (res ? 3 : -3);
1869 if (!res) return effect;
1870 Handle(Interface_Protocol) newproto = theprotocol;
1871 if (transf->ChangeProtocol(newproto))
1872 { effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1873 theoldel = themodel;
1874 SetModel(newmod,Standard_False);
1880 //=======================================================================
1883 //=======================================================================
1885 Standard_Integer IFSelect_WorkSession::RunModifier
1886 (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy)
1888 Handle(IFSelect_Selection) sel; // null
1889 return RunModifierSelected (modif,sel,copy);
1893 //=======================================================================
1896 //=======================================================================
1898 Standard_Integer IFSelect_WorkSession::RunModifierSelected
1899 (const Handle(IFSelect_Modifier)& modif,
1900 const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy)
1902 if (ItemIdent(modif) == 0) return Standard_False;
1903 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1904 stf->SetCopyOption(copy);
1905 stf->SetSelection (sel);
1906 stf->AddModifier (modif);
1907 return RunTransformer (stf);
1911 //=======================================================================
1914 //=======================================================================
1916 Handle(IFSelect_Transformer) IFSelect_WorkSession::NewTransformStandard
1917 (const Standard_Boolean copy, const Standard_CString name)
1919 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1920 stf->SetCopyOption(copy);
1921 if (AddNamedItem (name, stf) == 0) stf.Nullify();
1926 // Ceci est une action directe : pourrait etre fait par un Transformer ...
1927 //=======================================================================
1930 //=======================================================================
1932 Standard_Boolean IFSelect_WorkSession::SetModelContent
1933 (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep)
1935 if (sel.IsNull() || !IsLoaded()) return Standard_False;
1936 Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph());
1937 if (list.NbEntities() == 0) return Standard_False;
1939 Handle(Interface_InterfaceModel) newmod = themodel->NewEmptyModel();
1940 Interface_CopyTool TC(themodel,theprotocol);
1941 Standard_Integer i, nb = themodel->NbEntities();
1943 for (list.Start(); list.More(); list.Next())
1944 TC.TransferEntity (list.Value());
1946 Standard_Integer* flags = new Standard_Integer[nb+1];
1947 for (i = 0; i <= nb; i ++) flags[i] = 0;
1948 for (list.Start(); list.More(); list.Next()) {
1949 Standard_Integer num = themodel->Number(list.Value());
1950 if (num <= nb) flags[num] = 1;
1952 for (i = 1; i <= nb; i ++) {
1953 if (flags[i] == 0) TC.TransferEntity (themodel->Value(i));
1957 TC.FillModel(newmod);
1958 if (newmod->NbEntities() == 0) return Standard_False;
1959 // Mettre a jour (ne pas oublier SelectPointed)
1960 theoldel = themodel;
1961 SetModel(newmod,Standard_False);
1962 // MISE A JOUR des SelectPointed
1963 Handle(TColStd_HSequenceOfInteger) pts =
1964 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1966 for (i = 1; i <= nb; i ++) {
1967 DeclareAndCast(IFSelect_SelectPointed,sp,Item(pts->Value(i)));
1968 sp->Update(TC.Control());
1970 return Standard_True;
1974 // #################################################################
1975 // .... File Name ....
1977 //=======================================================================
1980 //=======================================================================
1982 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FilePrefix () const
1984 return theshareout->Prefix();
1988 //=======================================================================
1991 //=======================================================================
1993 Handle(TCollection_HAsciiString) IFSelect_WorkSession::DefaultFileRoot () const
1995 return theshareout->DefaultRootName();
1999 //=======================================================================
2002 //=======================================================================
2004 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileExtension () const
2006 return theshareout->Extension();
2010 //=======================================================================
2013 //=======================================================================
2015 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileRoot
2016 (const Handle(IFSelect_Dispatch)& disp) const
2018 return theshareout->RootName(theshareout->DispatchRank(disp));
2022 //=======================================================================
2025 //=======================================================================
2027 void IFSelect_WorkSession::SetFilePrefix (const Standard_CString name)
2029 theshareout->SetPrefix (new TCollection_HAsciiString(name));
2033 //=======================================================================
2036 //=======================================================================
2038 void IFSelect_WorkSession::SetFileExtension (const Standard_CString name)
2040 theshareout->SetExtension (new TCollection_HAsciiString(name));
2044 //=======================================================================
2047 //=======================================================================
2049 Standard_Boolean IFSelect_WorkSession::SetDefaultFileRoot
2050 (const Standard_CString name)
2052 Handle(TCollection_HAsciiString) defrt;
2053 if (name[0] != '\0') defrt = new TCollection_HAsciiString(name);
2054 return theshareout->SetDefaultRootName (defrt);
2058 //=======================================================================
2061 //=======================================================================
2063 Standard_Boolean IFSelect_WorkSession::SetFileRoot
2064 (const Handle(IFSelect_Dispatch)& disp, const Standard_CString namefile)
2066 Standard_Integer id = ItemIdent(disp);
2067 if (id == 0) return Standard_False;
2068 Standard_Integer nd = theshareout->DispatchRank(disp);
2069 /* if (theonlynamed) {
2070 if (nd == 0 && namefile[0] != 0)
2071 theshareout->AddDispatch(disp);
2072 else if (nd != 0 && namefile[0] == 0)
2073 theshareout->RemoveDispatch (nd);
2075 if (nd == 0) return Standard_False;
2076 // The order below prevented to change the root name on a given dispatch !
2077 // if (theshareout->HasRootName(nd)) return Standard_False;
2078 Handle(TCollection_HAsciiString) filename;
2079 if (namefile[0] != '\0') filename = new TCollection_HAsciiString (namefile);
2080 return theshareout->SetRootName(nd,filename);
2084 //=======================================================================
2087 //=======================================================================
2089 Standard_CString IFSelect_WorkSession::GiveFileRoot
2090 (const Standard_CString file) const
2092 OSD_Path path (file);
2093 if (!path.IsValid(TCollection_AsciiString(file))) return file; // tant pis ..
2094 bufstr = path.Name();
2095 return bufstr.ToCString();
2099 //=======================================================================
2102 //=======================================================================
2104 Standard_CString IFSelect_WorkSession::GiveFileComplete
2105 (const Standard_CString file) const
2107 // ajouter si besoin : Prefix; Extension
2108 bufstr.Clear(); bufstr.AssignCat (file);
2109 Standard_Integer i,j = 0,nb = bufstr.Length();
2110 Handle(TCollection_HAsciiString) ext = FileExtension ();
2111 if (!ext.IsNull()) {
2112 char val0 = '\0'; if (ext->Length() > 0) val0 = ext->Value(1);
2113 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val0) { j = 1; break; }
2114 if (j == 0) bufstr.AssignCat (ext->ToCString());
2116 Handle(TCollection_HAsciiString) pre = FilePrefix ();
2117 if (!pre.IsNull()) {
2118 char val1 = '\0'; if (pre->Length() > 0) val1 = pre->Value(pre->Length());
2120 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val1) { j = 1; break; }
2121 if (j == 0) bufstr.Insert (1,pre->ToCString());
2124 return bufstr.ToCString();
2128 //=======================================================================
2131 //=======================================================================
2133 void IFSelect_WorkSession::ClearFile ()
2135 thecopier->ClearResult();
2136 theshareout->ClearResult(Standard_True);
2140 //=======================================================================
2143 //=======================================================================
2145 void IFSelect_WorkSession::EvaluateFile ()
2148 if (!IsLoaded()) return;
2149 Interface_CheckIterator checks;
2151 errhand = Standard_False;
2154 EvaluateFile(); // appel normal (donc, code pas duplique)
2156 catch (Standard_Failure) {
2157 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2158 sout<<" **** Interruption EvaluateFile par Exception : ****\n";
2159 sout<<Standard_Failure::Caught()->GetMessageString();
2160 sout<<"\n Abandon"<<endl;
2161 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2163 errhand = theerrhand;
2164 thecheckrun = checks;
2168 IFSelect_ShareOutResult R(theshareout,thegraph->Graph());
2169 checks = thecopier->Copy (R,thelibrary,theprotocol);
2170 if (!checks.IsEmpty(Standard_False)) {
2171 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2172 sout<<" ** EvaluateFile has produced Check Messages : **"<<endl;
2173 checks.Print (sout,themodel,Standard_False);
2175 thecopier->SetRemaining (thegraph->CGraph());
2176 thecheckrun = checks;
2180 //=======================================================================
2183 //=======================================================================
2185 Standard_Integer IFSelect_WorkSession::NbFiles () const
2187 return thecopier->NbFiles();
2191 //=======================================================================
2194 //=======================================================================
2196 Handle(Interface_InterfaceModel) IFSelect_WorkSession::FileModel
2197 (const Standard_Integer num) const
2199 Handle(Interface_InterfaceModel) mod;
2200 if (num > 0 && num <= NbFiles()) mod = thecopier->FileModel(num);
2205 //=======================================================================
2208 //=======================================================================
2210 TCollection_AsciiString IFSelect_WorkSession::FileName
2211 (const Standard_Integer num) const
2213 TCollection_AsciiString name;
2214 if (num > 0 && num <= NbFiles()) name = thecopier->FileName(num);
2219 //=======================================================================
2222 //=======================================================================
2224 void IFSelect_WorkSession::BeginSentFiles (const Standard_Boolean record)
2226 thecopier->BeginSentFiles(theshareout,record);
2230 //=======================================================================
2233 //=======================================================================
2235 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::SentFiles () const
2237 return thecopier->SentFiles();
2241 // #########################################################################
2242 // .... Action de Transfert proprement dite : la grande affaire ! ....
2244 //=======================================================================
2247 //=======================================================================
2249 Standard_Boolean IFSelect_WorkSession::SendSplit ()
2252 Interface_CheckIterator checks;
2255 errhand = Standard_False;
2258 return SendSplit(); // appel normal (donc, code pas duplique)
2260 catch (Standard_Failure) {
2261 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2262 sout<<" **** Interruption SendSplit par Exception : ****\n";
2263 sout<<Standard_Failure::Caught()->GetMessageString();
2264 sout<<"\n Abandon"<<endl;
2265 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2267 errhand = theerrhand;
2268 thecheckrun = checks;
2269 return Standard_False;
2272 if (thelibrary.IsNull()) {
2273 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2274 thecheckrun = checks;
2275 return Standard_False;
2278 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2279 sout<< " *** Data for SendSplit not available ***"<<endl;
2280 checks.CCheck(0)->AddFail("Data not available");
2281 thecheckrun = checks;
2282 return Standard_False;
2285 if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol);
2288 IFSelect_ShareOutResult eval (ShareOut(), thegraph->Graph());
2289 checks = thecopier->Send (eval, thelibrary, theprotocol);
2290 thecopier->SetRemaining (thegraph->CGraph());
2293 if (theshareout.IsNull()) return Standard_False;
2294 Standard_Integer i, nbd = theshareout->NbDispatches();
2295 Standard_Integer nf = 0;
2296 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2297 sout<<" SendSplit .. ";
2298 for (i = 1; i <= nbd; i ++) {
2299 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
2300 if (disp.IsNull()) continue;
2301 IFGraph_SubPartsIterator packs(thegraph->Graph(),Standard_False);
2302 disp->Packets (thegraph->Graph(),packs);
2303 for (packs.Start(); packs.More(); packs.Next()) {
2304 Interface_EntityIterator iter = packs.Entities();
2305 if (iter.NbEntities() == 0) continue;
2306 // Ecrire une liste d entites
2307 Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
2308 sp->SetList (iter.Content());
2310 TCollection_AsciiString filnam (nf);
2311 filnam.Insert (1,"_");
2312 Handle(TCollection_HAsciiString) filepart;
2313 filepart = FileRoot(disp);
2314 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2315 filepart = FilePrefix();
2316 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2317 filepart = FileExtension();
2318 if (!filepart.IsNull()) filnam.AssignCat (filepart->ToCString());
2319 IFSelect_ReturnStatus stat = SendSelected (filnam.ToCString(),sp);
2320 if (stat != IFSelect_RetDone) cout<<"File "<<filnam<<" failed"<<endl;
2323 sout<<" .. Files Written : "<<nf<<endl;
2325 thecheckrun = checks;
2326 return Standard_True;
2330 //=======================================================================
2333 //=======================================================================
2335 Handle(IFSelect_PacketList) IFSelect_WorkSession::EvalSplit () const
2337 Handle(IFSelect_PacketList) pks;
2338 if (!IsLoaded()) return pks;
2339 IFSelect_ShareOutResult sho (ShareOut(), thegraph->Graph());
2340 return sho.Packets();
2344 //=======================================================================
2347 //=======================================================================
2349 Interface_EntityIterator IFSelect_WorkSession::SentList
2350 (const Standard_Integer newcount) const
2352 Interface_EntityIterator iter;
2353 if (!IsLoaded()) return iter;
2354 const Interface_Graph& G = thegraph->Graph();
2355 Standard_Integer nb = G.Size();
2357 for ( i = 1; i <= nb; i ++) {
2358 Standard_Integer stat = G.Status(i);
2359 if ( (stat > 0 && newcount < 0) || stat == newcount)
2360 iter.GetOneItem(G.Entity(i));
2366 //=======================================================================
2369 //=======================================================================
2371 Standard_Integer IFSelect_WorkSession::MaxSendingCount () const
2373 Standard_Integer newcount = 0;
2374 if (!IsLoaded()) return newcount;
2375 const Interface_Graph& G = thegraph->Graph();
2376 Standard_Integer nb = G.Size();
2378 for (i = 1; i <= nb; i ++) {
2379 Standard_Integer stat = G.Status(i);
2380 if (stat > newcount) newcount = stat;
2386 //=======================================================================
2389 //=======================================================================
2391 Standard_Boolean IFSelect_WorkSession::SetRemaining
2392 (const IFSelect_RemainMode mode)
2394 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2395 if (!IsLoaded()) return Standard_False;
2396 if (mode == IFSelect_RemainForget) {
2397 Standard_Integer nb = thegraph->Graph().Size();
2398 for (Standard_Integer i = 1; i <= nb; i ++)
2399 thegraph->CGraph().SetStatus (i,0);
2401 return Standard_True;
2402 } else if (mode == IFSelect_RemainCompute) {
2403 Handle(Interface_InterfaceModel) newmod;
2404 Interface_CopyTool TC(themodel,theprotocol);
2405 thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod);
2406 if (newmod.IsNull()) {
2407 sout<<" No Remaining Data recorded"<<endl; return Standard_False;
2408 } else if (newmod == themodel) {
2409 sout<<" Remaining causes all original data to be kept"<<endl;
2410 thecopier->SetRemaining (thegraph->CGraph());
2411 return Standard_False;
2413 theoldel = themodel;
2414 SetModel(newmod,Standard_False);
2415 // MISE A JOUR des SelectPointed
2416 Handle(TColStd_HSequenceOfInteger) list =
2417 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
2418 Standard_Integer nb = list->Length();
2419 for (Standard_Integer i = 1; i <= nb; i ++) {
2420 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
2421 sp->Update(TC.Control());
2423 return Standard_True;
2425 } else if (mode == IFSelect_RemainDisplay) {
2426 Standard_Integer ne = 0;
2427 Standard_Integer nb = thegraph->Graph().Size();
2428 for (Standard_Integer i = 1; i <= nb; i ++)
2429 { if (thegraph->Graph().Status(i) >= 0) ne ++; }
2431 sout<<" - All entities are remaining, none yet sent"<<endl; return Standard_True;
2433 Interface_EntityIterator iter = SentList(0);
2434 nb = iter.NbEntities();
2436 sout<<" - No recorded remaining entities"<<endl; return Standard_True;
2438 sout <<" -- Recorded Remaining (not yet sent) Entities --"<<endl;
2439 ListEntities(iter,2);
2440 sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
2441 MaxSendingCount() << endl;
2444 sout<< " - Now, dispatches are deactivated"<<endl;
2445 nb = theshareout->NbDispatches();
2446 for (Standard_Integer i = nb; i > theshareout->LastRun(); i --)
2447 theshareout->RemoveDispatch(i);
2449 return Standard_True;
2450 } else if (mode == IFSelect_RemainUndo) {
2451 if (theoldel.IsNull()) return Standard_False;
2452 SetModel(theoldel); theoldel.Nullify();
2453 return Standard_True;
2455 else return Standard_False;
2459 //=======================================================================
2462 //=======================================================================
2464 IFSelect_ReturnStatus IFSelect_WorkSession::SendAll
2465 (const Standard_CString filename, const Standard_Boolean computegraph)
2468 Interface_CheckIterator checks;
2469 if (!IsLoaded()) return IFSelect_RetVoid;
2470 if (thelibrary.IsNull()) {
2471 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2472 thecheckrun = checks;
2473 return IFSelect_RetError;
2477 errhand = Standard_False;
2480 ComputeGraph(computegraph);
2481 checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2483 catch (Standard_Failure) {
2484 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2485 sout<<" **** Interruption SendAll par Exception : ****\n";
2486 sout<<Standard_Failure::Caught()->GetMessageString();
2487 sout<<"\n Abandon"<<endl;
2488 errhand = theerrhand;
2489 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2490 thecheckrun = checks;
2491 return IFSelect_RetFail;
2494 else checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2495 Handle_Interface_Check aMainFail = checks.CCheck(0);
2496 if (!aMainFail.IsNull() && aMainFail->HasFailed ())
2498 return IFSelect_RetStop;
2500 if (theloaded.Length() == 0) theloaded.AssignCat(filename);
2501 thecheckrun = checks;
2502 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2503 return IFSelect_RetError;
2507 //=======================================================================
2510 //=======================================================================
2512 IFSelect_ReturnStatus IFSelect_WorkSession::SendSelected
2513 (const Standard_CString filename,
2514 const Handle(IFSelect_Selection)& sel,
2515 const Standard_Boolean computegraph)
2518 if (!IsLoaded()) return IFSelect_RetVoid;
2519 Interface_CheckIterator checks;
2520 if (thelibrary.IsNull()) {
2521 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2522 thecheckrun = checks;
2523 return IFSelect_RetVoid;
2527 errhand = Standard_False;
2530 ComputeGraph(computegraph);
2531 return SendSelected (filename,sel); // appel normal
2533 catch (Standard_Failure) {
2534 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2535 sout<<" **** Interruption SendSelected par Exception : ****\n";
2536 sout<<Standard_Failure::Caught()->GetMessageString();
2537 sout<<"\n Abandon"<<endl;
2538 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2539 errhand = theerrhand;
2540 thecheckrun = checks;
2541 return IFSelect_RetFail;
2544 // if (ItemIdent(sel) == 0) return 3;
2545 Interface_EntityIterator iter = sel->UniqueResult(thegraph->Graph());
2546 if (iter.NbEntities() == 0) return IFSelect_RetVoid;
2548 checks = thecopier->SendSelected
2549 (filename,thegraph->Graph(),thelibrary,theprotocol,iter);
2550 thecopier->SetRemaining (thegraph->CGraph());
2551 thecheckrun = checks;
2552 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2553 return IFSelect_RetError;
2557 //=======================================================================
2560 //=======================================================================
2562 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2563 (const Standard_CString filename)
2565 if (WorkLibrary().IsNull()) return IFSelect_RetVoid;
2566 ComputeGraph(Standard_True);
2567 if (!IsLoaded()) return IFSelect_RetVoid;
2568 return SendAll (filename);
2572 //=======================================================================
2575 //=======================================================================
2577 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2578 (const Standard_CString filename, const Handle(IFSelect_Selection)& sel)
2580 if (WorkLibrary().IsNull() || sel.IsNull()) return IFSelect_RetVoid;
2581 ComputeGraph(Standard_True);
2582 if (!IsLoaded()) return IFSelect_RetVoid;
2583 return SendSelected (filename,sel);
2586 // ################################################################
2587 // .... Actions particulieres sur les Selections ....
2589 //=======================================================================
2592 //=======================================================================
2594 Standard_Integer IFSelect_WorkSession::NbSources
2595 (const Handle(IFSelect_Selection)& sel) const
2597 if (ItemIdent(sel) == 0) return 0;
2598 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ||
2599 sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) return 1;
2600 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) return 2;
2601 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) return
2602 GetCasted(IFSelect_SelectCombine,sel)->NbInputs();
2607 //=======================================================================
2610 //=======================================================================
2612 Handle(IFSelect_Selection) IFSelect_WorkSession::Source
2613 (const Handle(IFSelect_Selection)& sel, const Standard_Integer num) const
2615 Handle(IFSelect_Selection) sr;
2616 if (ItemIdent(sel) == 0) return sr;
2617 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ) sr =
2618 GetCasted(IFSelect_SelectExtract,sel)->Input();
2619 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) sr =
2620 GetCasted(IFSelect_SelectDeduct,sel)->Input();
2621 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) {
2622 if (num == 1) sr = GetCasted(IFSelect_SelectControl,sel)->MainInput();
2623 else if (num == 2) sr = GetCasted(IFSelect_SelectControl,sel)->SecondInput();
2625 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) sr =
2626 GetCasted(IFSelect_SelectCombine,sel)->Input(num);
2631 //=======================================================================
2634 //=======================================================================
2636 Standard_Boolean IFSelect_WorkSession::IsReversedSelectExtract
2637 (const Handle(IFSelect_Selection)& sel) const
2639 if (ItemIdent(sel) == 0) return Standard_False;
2640 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2641 if (sxt.IsNull()) return Standard_False;
2642 return (!sxt->IsDirect());
2646 //=======================================================================
2649 //=======================================================================
2651 Standard_Boolean IFSelect_WorkSession::ToggleSelectExtract
2652 (const Handle(IFSelect_Selection)& sel)
2654 if (ItemIdent(sel) == 0) return Standard_False;
2655 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2656 if (sxt.IsNull()) return Standard_False;
2657 sxt->SetDirect(!sxt->IsDirect());
2658 return Standard_True;
2662 //=======================================================================
2665 //=======================================================================
2667 Standard_Boolean IFSelect_WorkSession::SetInputSelection
2668 (const Handle(IFSelect_Selection)& sel,
2669 const Handle(IFSelect_Selection)& inp)
2671 if (ItemIdent(sel) == 0) return Standard_False;
2672 if (!inp.IsNull() && ItemIdent(inp) == 0) return Standard_False;
2673 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2674 if (!sxt.IsNull()) { sxt->SetInput(inp); return Standard_True; }
2675 DeclareAndCast(IFSelect_SelectDeduct,sdt,sel);
2676 if (!sdt.IsNull()) { sdt->SetInput(inp); return Standard_True; }
2677 return Standard_False;
2681 //=======================================================================
2684 //=======================================================================
2686 Standard_Boolean IFSelect_WorkSession::SetControl
2687 (const Handle(IFSelect_Selection)& sel,
2688 const Handle(IFSelect_Selection)& sc,
2689 const Standard_Boolean formain)
2691 DeclareAndCast(IFSelect_SelectControl,dsel,sel);
2692 if (ItemIdent(dsel) == 0) return Standard_False;
2693 if (ItemIdent(sc) == 0) return Standard_False;
2694 if (formain) dsel->SetMainInput (sc);
2695 else dsel->SetSecondInput (sc);
2696 return Standard_True;
2700 //=======================================================================
2703 //=======================================================================
2705 Standard_Integer IFSelect_WorkSession::CombineAdd
2706 (const Handle(IFSelect_Selection)& sel,
2707 const Handle(IFSelect_Selection)& seladd,
2708 const Standard_Integer atnum)
2710 DeclareAndCast(IFSelect_SelectCombine,csel,sel);
2711 if (ItemIdent(csel) == 0) return 0;
2712 if (ItemIdent(seladd) == 0) return 0;
2713 csel->Add (seladd,atnum);
2714 return csel->NbInputs();
2718 //=======================================================================
2721 //=======================================================================
2723 Standard_Boolean IFSelect_WorkSession::CombineRemove
2724 (const Handle(IFSelect_Selection)& selcomb,
2725 const Handle(IFSelect_Selection)& selrem)
2727 DeclareAndCast(IFSelect_SelectCombine,csel,selcomb);
2728 if (ItemIdent(csel) == 0) return Standard_False;
2729 if (ItemIdent(selrem) == 0) return Standard_False;
2730 Standard_Integer nb = csel->NbInputs();
2731 for (Standard_Integer i = nb; i > 0; i --) {
2732 if (csel->Input(i) == selrem) {
2734 return Standard_True;
2737 return Standard_True;
2741 //=======================================================================
2744 //=======================================================================
2746 Handle(IFSelect_Selection) IFSelect_WorkSession::NewSelectPointed
2747 (const Handle(TColStd_HSequenceOfTransient)& list,
2748 const Standard_CString name)
2750 Handle(IFSelect_SelectPointed) sel = new IFSelect_SelectPointed;
2751 if (!list.IsNull()) sel->AddList (list);
2752 if (AddNamedItem (name,sel) == 0) sel.Nullify();
2757 //=======================================================================
2760 //=======================================================================
2762 Standard_Boolean IFSelect_WorkSession::SetSelectPointed
2763 (const Handle(IFSelect_Selection)& sel,
2764 const Handle(TColStd_HSequenceOfTransient)& list,
2765 const Standard_Integer mode) const
2767 DeclareAndCast(IFSelect_SelectPointed,sp,sel);
2768 if (sp.IsNull() || list.IsNull()) return Standard_False;
2769 if (mode == 0) sp->Clear();
2770 if (mode >= 0) sp->AddList(list);
2771 else sp->RemoveList(list);
2772 return Standard_True;
2776 // ###########################################################################
2777 // .... Analyse d un CheckIterator par rapport a un graphe ....
2779 //=======================================================================
2782 //=======================================================================
2784 static void IFSelect_QueryProp (Interface_IntList& list,
2785 TCollection_AsciiString& ana,
2786 const Standard_Integer num, const int quoi)
2788 list.SetNumber(num);
2789 Standard_Integer i, nb = list.Length();
2790 for (i = 1; i <= nb; i ++) {
2791 if (i > 1) list.SetNumber(num); // because recursive call + depth first
2792 Standard_Integer n = list.Value(i);
2793 // y a t il lieu de propager ?
2794 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2795 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2796 char val = ana.Value(n);
2798 case ' ' : val = (quoi ? '3' : '6'); break;
2799 case '1' : val = (quoi ? '4' : '7'); break;
2800 case '2' : val = (quoi ? '5' : '8'); break;
2801 case '3' : val = (quoi ? ' ' : '6'); break;
2802 case '4' : val = (quoi ? ' ' : '7'); break;
2803 case '5' : val = (quoi ? ' ' : '8'); break;
2804 case '6' : val = ' '; break;
2805 case '7' : val = ' '; break;
2806 case '8' : val = ' '; break;
2807 default : val = ' '; break;
2809 if (val == ' ') continue;
2810 ana.SetValue(n,val);
2811 IFSelect_QueryProp (list,ana,n,quoi);
2816 //=======================================================================
2819 //=======================================================================
2821 void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
2823 if (!IsLoaded()) return;
2824 Standard_Integer i,nb = themodel->NbEntities();
2825 thecheckana = TCollection_AsciiString (nb+1,' ');
2826 for (chl.Start(); chl.More(); chl.Next()) {
2827 Standard_Integer num = chl.Number();
2828 const Handle(Interface_Check) ach = chl.Value();
2829 if (ach->HasFailed()) thecheckana.SetValue(num,'2');
2830 else if (ach->HasWarnings()) thecheckana.SetValue(num,'1');
2832 // analyse selon le graphe ... codes : blc = rien
2833 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2834 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2835 Interface_IntList list;// = thegraph->Graph().SharingNums(0);
2836 // deux passes : d abord Warning, puis Fail
2837 for (i = 1; i <= nb; i ++) {
2838 char val = thecheckana.Value(i);
2840 if (val == '1' || val == '4' || val == '7') quoi = 0;
2841 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2843 for (i = 1; i <= nb; i ++) {
2844 char val = thecheckana.Value(i);
2846 if (val == '2' || val == '5' || val == '8') quoi = 1;
2847 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2852 //=======================================================================
2855 //=======================================================================
2857 Standard_Integer IFSelect_WorkSession::QueryCheckStatus
2858 (const Handle(Standard_Transient)& ent) const
2860 if (!IsLoaded()) return -1;
2861 Standard_Integer num = themodel->Number(ent);
2862 if (num == 0) return -1;
2863 if (thecheckana.Length() < num) return -1;
2864 Standard_Character val = thecheckana.Value (num);
2865 // codes : blc = rien -> 0
2866 // 1 W/place -> 1 2 F/place -> 2
2867 // 3 Wprop -> 10 4 Wprop+W/place -> 11 5 Wprop+F/place -> 12
2868 // 6 Fprop -> 20 7 Fprop+W/place -> 21 8 Fprop+F/place -> 22
2869 if (val == ' ') return 0;
2870 if (val == '1') return 1;
2871 if (val == '2') return 2;
2872 if (val == '3') return 10;
2873 if (val == '4') return 11;
2874 if (val == '5') return 12;
2875 if (val == '6') return 20;
2876 if (val == '7') return 21;
2877 if (val == '8') return 22;
2882 //=======================================================================
2885 //=======================================================================
2887 Standard_Integer IFSelect_WorkSession::QueryParent
2888 (const Handle(Standard_Transient)& entdad,
2889 const Handle(Standard_Transient)& entson) const
2891 Standard_Integer ndad = StartingNumber(entdad);
2892 Standard_Integer nson = StartingNumber(entson);
2893 if (ndad < 1 || nson < 1) return -1;
2894 if (ndad == nson) return 0;
2895 // on va calculer : pour chaque pere immediat, de <son>, status avec <dad> + 1
2896 // nb : pas protege contre les boucles ...
2897 Handle(TColStd_HSequenceOfTransient) list =
2898 thegraph->Graph().Sharings(entson).Content();
2899 if (list.IsNull()) return -1;
2900 Standard_Integer i, nb = list->Length();
2901 for (i = 1; i <= nb; i ++) {
2902 if (list->Value(i) == entdad) return 1;
2903 Standard_Integer stat = QueryParent ( entdad,list->Value(i) );
2904 if (stat >= 0) return stat+1;
2906 return -1; // not yet implemented ...
2909 // ###########################################################################
2910 // .... Dumps et Evaluations, pas faciles a passer en arguments ....
2912 // #### #### #### #### #### #### #### #### ####
2913 // .... DumpShare ....
2915 //=======================================================================
2918 //=======================================================================
2920 void IFSelect_WorkSession::SetParams
2921 (const TColStd_SequenceOfTransient& params,
2922 const TColStd_SequenceOfInteger& uselist)
2924 Standard_Integer i, nbp = params.Length(), nbu = uselist.Length();
2925 Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor
2926 (nbp+nbu+50,"Parameter Editor");
2927 for (i = 1; i <= nbp; i ++) {
2928 DeclareAndCast(Interface_TypedValue,val,params.Value(i));
2929 if (val.IsNull()) continue;
2930 editor->AddValue(val);
2932 AddNamedItem("xst-params-edit",editor);
2934 Handle(IFSelect_EditForm) paramsall = editor->Form(Standard_False);
2935 AddNamedItem("xst-params-all",paramsall);
2937 // On attaque les EditForms partielles
2938 TColStd_SequenceOfInteger listgen,listload,listsend,listsplit,listread,listwrite;
2939 for (i = 1; i <= nbu; i ++) {
2940 Standard_Integer use = uselist.Value(i);
2942 case 1 : listgen.Append(i); break;
2943 case 2 : listread.Append(i); break;
2944 case 3 : listsend.Append(i); break;
2945 case 4 : listsplit.Append(i); break;
2946 case 5 : listread.Append(i); break;
2947 case 6 : listwrite.Append(i); break;
2951 Handle(IFSelect_EditForm) paramsgen = new IFSelect_EditForm
2952 (editor,listgen ,Standard_False,Standard_True,"General Parameters");
2953 if (listgen.Length() > 0) AddNamedItem("xst-params-general",paramsgen);
2954 Handle(IFSelect_EditForm) paramsload = new IFSelect_EditForm
2955 (editor,listload,Standard_False,Standard_True,"Loading Parameters");
2956 if (listload.Length() > 0) AddNamedItem("xst-params-load", paramsload);
2957 Handle(IFSelect_EditForm) paramssend = new IFSelect_EditForm
2958 (editor,listsend,Standard_False,Standard_True,"Sending Parameters");
2959 if (listsend.Length() > 0) AddNamedItem("xst-params-send", paramssend);
2960 Handle(IFSelect_EditForm) paramsplit = new IFSelect_EditForm
2961 (editor,listsplit,Standard_False,Standard_True,"Split Parameters");
2962 if (listsplit.Length() > 0) AddNamedItem("xst-params-split", paramsplit);
2963 Handle(IFSelect_EditForm) paramsread = new IFSelect_EditForm
2964 (editor,listread,Standard_False,Standard_True,"Read(Transfer) Parameters");
2965 if (listread.Length() > 0) AddNamedItem("xst-params-read", paramsread);
2966 Handle(IFSelect_EditForm) paramswrite = new IFSelect_EditForm
2967 (editor,listwrite,Standard_False,Standard_True,"Write(Transfer) Parameters");
2968 if (listwrite.Length() > 0) AddNamedItem("xst-params-write", paramswrite);
2972 //=======================================================================
2975 //=======================================================================
2977 void IFSelect_WorkSession::TraceStatics
2978 (const Standard_Integer use, const Standard_Integer mode) const
2980 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2982 if (mode == 0) sout<<"******************************************"<<endl;
2984 if (mode == 0) sout<<"***** General Parameters *****"<<endl;
2985 } else if (use == 2) {
2986 if (mode == 0) sout<<"***** Load File *****"<<endl;
2987 } else if (use == 3) {
2988 if (mode == 0) sout<<"***** Write File *****"<<endl;
2989 } else if (use == 4) {
2990 if (mode == 0) sout<<"***** Split File *****"<<endl;
2991 } else if (use == 5) {
2992 if (mode == 0) sout<<"***** Transfer (Read) *****"<<endl;
2993 } else if (use == 6) {
2994 if (mode == 0) sout<<"***** Transfer (Write) *****"<<endl;
2996 if (mode == 0) sout<<"******************************************"<<endl<<endl;
2999 // Echainements particuliers (use > 0)
3001 TraceStatics (-2,mode);
3002 if (mode == 0) sout<<endl;
3003 } else if (use == 4 || use == 6) {
3004 TraceStatics (-3,mode);
3005 if (mode == 0) sout<<endl;
3008 // Valeurs particulieres
3009 if (use == 1 || use == -1) { // General : trace
3011 // sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<endl;
3013 } else if (use == 4 || use == -4) { // Split : Prefix & cie
3015 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3016 if (!str.IsNull()) sout << "Prefix : "<<str->ToCString()<<endl;
3017 else sout << "Prefix not Defined" << endl;
3018 str = theshareout->DefaultRootName();
3019 if (!str.IsNull()) sout << "Default Root : "<<str->ToCString()<<endl;
3020 else sout << "Default Root not Defined" << endl;
3021 str = theshareout->Extension();
3022 if (!str.IsNull()) sout << "Extension : "<<str->ToCString()<<endl;
3023 else sout << "Extension not defined" << endl;
3027 // LISTER LES STATICS
3028 // Passer par les ParamEditor ...
3032 if (mode == 0) sout<<"******************************************"<<endl<<endl;
3037 //=======================================================================
3040 //=======================================================================
3042 void IFSelect_WorkSession::DumpShare () const
3044 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3045 sout<<" ********** Definition ShareOut (Complete) **********"<<endl;
3047 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3048 if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << endl;
3049 else sout << "Prefix not Defined" << endl;
3050 str = theshareout->DefaultRootName();
3051 if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << endl;
3052 else sout << "Default Root not Defined" << endl;
3053 str = theshareout->Extension();
3054 if (!str.IsNull()) sout << "Extension : " << str->ToCString() << endl;
3055 else sout << "Extension not defined" << endl;
3057 Standard_Integer lr = theshareout->LastRun();
3058 Standard_Integer nb = theshareout->NbDispatches();
3059 sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<<endl;
3060 for (Standard_Integer i = 1; i <= nb; i ++) {
3061 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
3062 sout << "Dispatch n0 " << i;
3063 if (HasName(disp)) sout << " Name:"<< Name(disp)->ToCString();
3064 sout << " Label:" << disp->Label() << endl;
3065 Handle(IFSelect_Selection) sel = disp->FinalSelection();
3066 if (sel.IsNull()) sout << " No Final Selection Defined" << endl;
3067 else if (HasName(sel)) sout << " Final Selection : Name:"
3068 << Name(sel)->ToCString() << " Label:" << sel->Label() << endl;
3069 else sout << " Final Selection : " << sel->Label() << endl;
3070 if (disp->HasRootName())
3071 sout<<" File Root Name : "<<disp->RootName()->ToCString()<<endl;
3072 else sout<<" No specific file root name (see Default Root)"<<endl;
3074 Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
3076 " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<endl;
3077 Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
3079 " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<endl;
3080 if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<endl;
3083 // #### #### #### #### #### #### #### #### ####
3084 // .... ListItems ....
3086 //=======================================================================
3089 //=======================================================================
3091 void IFSelect_WorkSession::ListItems (const Standard_CString lab) const
3093 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3094 sout<< " ********** Items in Session **********"<<endl;
3095 Standard_Integer nb = MaxIdent();
3096 Handle(TCollection_HAsciiString) str;
3097 if (lab[0] != '\0') str = new TCollection_HAsciiString (lab);
3098 for (Standard_Integer i = 1; i <= nb; i ++) {
3099 const Handle(Standard_Transient)& var = theitems.FindKey(i);
3100 Handle(TCollection_HAsciiString) label = ItemLabel(i);
3101 if (label.IsNull()) continue; // -> item supprime
3102 if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; }
3104 if (HasName(var)) sout<<" - Named : "<<Name(var)->ToCString()<<" - ";
3105 else sout<<" - (no name) - ";
3106 sout<<var->DynamicType()->Name()<<endl<<" "<<label->ToCString()<<endl;
3110 // #### #### #### #### #### #### #### #### ####
3111 // .... ListModifiers
3113 //=======================================================================
3116 //=======================================================================
3118 void IFSelect_WorkSession::ListFinalModifiers
3119 (const Standard_Boolean formodel) const
3121 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3122 Standard_Integer nb = theshareout->NbModifiers(formodel);
3123 sout<< " ********** Modifiers in Session ";
3124 sout<<(formodel ? "(For Model)" : "(For File)");
3125 sout<<": "<<nb<<" **********"<<endl;
3126 for (Standard_Integer i = 1; i <= nb; i ++) {
3127 Handle(IFSelect_GeneralModifier) modif =
3128 theshareout->GeneralModifier(formodel,i);
3129 if (!modif.IsNull()) sout<<"Modifier n0."<<i<<" : "<<modif->Label();
3130 if (HasName(modif)) sout << " Named as : " << Name(modif)->ToCString();
3135 // #### #### #### #### #### #### #### #### ####
3136 // .... DumpSelection ....
3138 //=======================================================================
3141 //=======================================================================
3143 void IFSelect_WorkSession::DumpSelection
3144 (const Handle(IFSelect_Selection)& sel) const
3146 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3147 if (ItemIdent(sel) == 0) {
3148 sout << "Selection : "<<" Unknown"<<endl; //sout<<Handle
3151 sout << " ********** Selection";
3152 if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
3153 sout <<" **********"<<endl;
3154 sout<< "Label : " << sel->Label() << " . Input(s) : "<< endl;
3155 Standard_Integer nb = 0;
3156 IFSelect_SelectionIterator iter; sel->FillIterator(iter);
3157 for (; iter.More(); iter.Next()) {
3159 Handle(IFSelect_Selection) newsel = iter.Value();
3160 sout<<" -- "<<newsel->Label()<<endl;
3162 sout << " Nb Inputs:"<<nb<<endl;
3166 // ##########################################
3167 // ######### Fonctions complementaires
3168 // ##########################################
3170 // #### #### #### #### #### #### #### #### ####
3171 // .... DumpModel ....
3173 //=======================================================================
3176 //=======================================================================
3178 Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
3179 (const Standard_CString selname) const
3182 Standard_Integer np = -1, nf = -1, nivp = 0;
3183 for (Standard_Integer n = 0; selname[n] != '\0'; n ++) {
3184 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3185 if (selname[n] == '(') { np = n; nivp ++; }
3186 if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3187 //// if (selname[n] == ' ') { nb = n; break; }
3190 Handle(IFSelect_Selection) sel;
3191 if (np >= 0) nomsel[np] = 0; if (nf >= 0) nomsel[nf] = '\0';
3192 Handle(Standard_Transient) item = NamedItem(nomsel);
3194 // Parentheses ? essayer Signature (plus tard : Selection parametree)
3195 // NB : on compte les niveaux de parentheses (imbrications repercutees)
3196 if (np > 0 && nf > 0) {
3197 Handle(IFSelect_SelectSignature) selsign;
3198 Standard_Integer debsign = np+1;
3200 DeclareAndCast(IFSelect_Signature,sign,item);
3201 DeclareAndCast(IFSelect_SignCounter,cnt,item);
3202 if (!sign.IsNull()) selsign =
3203 new IFSelect_SelectSignature (sign,&nomsel[debsign],Standard_False);
3204 else if (!cnt.IsNull()) selsign =
3205 new IFSelect_SelectSignature (cnt,&nomsel[debsign],Standard_False);
3207 cout<<selname<<" : neither Signature nor Counter"<<endl;
3211 selsign->SetInput (new IFSelect_SelectModelEntities); // par defaut
3215 else sel = GetCasted(IFSelect_Selection,item);
3221 //=======================================================================
3224 //=======================================================================
3226 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3227 (const Handle(Standard_Transient)& obj) const
3230 DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
3231 if (!list.IsNull()) return list;
3233 // Rien du tout : retourne rien du tout
3234 if (obj.IsNull()) return list;
3236 // Une selection : son resultat (standard)
3237 DeclareAndCast(IFSelect_Selection,sel,obj);
3238 if (!sel.IsNull()) {
3239 Interface_EntityIterator iter = EvalSelection(sel);
3240 return iter.Content();
3243 // Le modele : son contenu
3244 list = new TColStd_HSequenceOfTransient();
3245 if (obj == themodel) {
3246 Standard_Integer i, nb = themodel->NbEntities();
3247 for (i = 1; i <= nb; i ++) list->Append (themodel->Value(i));
3250 // Une entite du modele : cette entite
3251 else if (StartingNumber(obj) > 0) list->Append (obj);
3253 // Un Texte : son interpretation
3255 DeclareAndCast(TCollection_HAsciiString,str,obj);
3256 if (!str.IsNull()) return GiveList (str->ToCString());
3259 // Si c est pas tout ca : une liste vide
3264 //=======================================================================
3267 //=======================================================================
3269 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3270 (const Standard_CString first, const Standard_CString second) const
3272 Handle(TColStd_HSequenceOfTransient) list;
3273 if (!first || first[0] == '\0') return list;
3274 if (first[0] == ' ') return GiveList (&first[1],second);
3275 if (second && second[0] == ' ') return GiveList (first,&second[1]);
3277 // list NULLE sera interpretee comme SelectionResult (selection toute crue)
3278 // sinon comme SelectionResultFromList
3279 if (second && second[0] != '\0') list = GiveList (second,"");
3281 list = GiveListFromList (first,list);
3286 //=======================================================================
3289 //=======================================================================
3291 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
3292 (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
3294 Handle(TColStd_HSequenceOfTransient) list;
3295 Standard_Integer num;
3297 // LISTE DEFINIE D OFFICE (en ce cas, la liste d entree est ignoree)
3298 if (selname[0] == '(') {
3299 // liste d entites donnees a la queue leu leu : (ID,ID,ID...)
3300 char entid[50]; Standard_Integer i,j = 0;
3301 TColStd_MapOfInteger numap;
3302 list = new TColStd_HSequenceOfTransient();
3303 for (i = 1; selname[i] != '\0'; i ++) {
3304 if (selname[i] == ' ') continue;
3305 if (selname[i] == ',' || selname[i] == ')') {
3307 if (j == 0) continue; j = 0;
3308 num = NumberFromLabel (entid);
3309 if (num <= 0 || !numap.Add (num)) continue;
3310 Handle(Standard_Transient) anent = StartingEntity(num);
3311 if (!anent.IsNull()) list->Append (anent);
3312 if (selname[i] == ')') break;
3315 entid[j] = selname[i]; j ++;
3319 num = NumberFromLabel (selname);
3320 if (num > 0) return GiveList(StartingEntity(num));
3322 // Autres cas : y atil une liste d entree.
3323 // Si OUI -> SelectionResultFromList. Si NON -> SelectionResult
3324 // Si une entite isolee -> on en fait une liste
3326 list = GiveList(ent); // ent NULL -> list NULL sinon intreprete
3328 // Decomposition term1 term2 ...
3330 char nomsel[500]; nomsel[0] = '\0';
3331 Standard_Integer n= 0 , nb = -1;
3332 for (n = 0; selname[n] != '\0'; n ++) {
3333 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3334 // if (selname[n] == '(') { np = n; nivp ++; }
3335 // if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3336 if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
3338 if (nomsel[0] == '\0') return list;
3340 Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
3342 cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<endl;
3346 if (nb > 0) list = GiveListFromList (&selname[nb+1],list);
3348 if (list.IsNull()) list = SelectionResult (sel);
3349 else list = SelectionResultFromList (sel,list);
3355 //=======================================================================
3358 //=======================================================================
3360 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
3361 (const Handle(TColStd_HSequenceOfTransient)& l1,
3362 const Handle(TColStd_HSequenceOfTransient)& l2,
3363 const Standard_Integer mode) const
3365 Handle(TColStd_HSequenceOfTransient) list;
3366 if (l1.IsNull() || l2.IsNull()) return list;
3368 // mode < 0 l1-l2 = 0 l1&l2 > 0 l1|l2 (l1+l2)
3369 TColStd_MapOfTransient numap;
3370 Standard_Integer i,n = l2->Length();
3371 for (i = n; i > 0; i --) {
3372 Handle(Standard_Transient) ent = l2->Value(i);
3373 if (ent.IsNull()) continue;
3375 if (mode > 0) list->Append(ent);
3378 // ents de l1 pas deja dans l2
3380 for (i = n; i > 0; i --) {
3381 Handle(Standard_Transient) ent = l1->Value(i);
3382 if (ent.IsNull()) continue;
3384 if (numap.Contains(ent)) {
3385 // dans l1 et dans l2
3386 if (mode == 0) list->Append(ent);
3388 // dans l1 mais pas dans l2
3389 if (mode != 0) list->Append(ent);
3398 //=======================================================================
3401 //=======================================================================
3403 void IFSelect_WorkSession::DumpModel
3404 (const Standard_Integer level, const Handle(Message_Messenger)& S)
3407 { S<< " *** Data for List not available ***"<<endl; return; }
3408 S << "\n *****************************************************************\n";
3409 if (theloaded.Length() > 0)
3410 S << " ******** Loaded File : "<<theloaded.ToCString()<<Interface_MSG::Blanks(32-theloaded.Length())<<" ********"<<endl;
3411 else S << " ******** No name for Loaded File"<<endl;
3413 S<<" ******** Short Dump of Header ********"<<"\n";
3414 S << " *****************************************************************\n\n";
3415 themodel->DumpHeader(S); S<<endl;
3418 Standard_Integer nbent = themodel->NbEntities();
3419 Standard_Integer nbr = 0;
3420 Interface_ShareFlags shar(thegraph->Graph());
3422 for (Standard_Integer i = 1; i <= nbent; i ++) {
3423 if (!shar.IsShared(themodel->Value(i))) nbr ++;
3425 S << " *****************************************************************\n";
3426 S << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<"\n";
3427 S << " *****************************************************************\n"<<endl;
3429 if (level <= 0) return;
3430 else if (level == 1) {
3431 S<<" ******** Root Entities ******** ";
3432 ListEntities (shar.RootEntities(),1);
3433 } else if (level == 2) {
3434 S<<" ******** Complete List ******** ";
3435 ListEntities (themodel->Entities(),1);
3436 } else if (level > 2) {
3437 IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
3438 if (level == 5 || level == 8) mode = IFSelect_CountByItem;
3439 if (level == 6 || level == 9) mode = IFSelect_ListByItem;
3440 if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
3441 Standard_Boolean failsonly = Standard_False;
3442 if (level < 8 && level != 4) failsonly = Standard_True;
3443 PrintCheckList (ModelCheckList(),Standard_False, mode);
3445 if (level == 3) S << " ******** Check Model (Fails) ********"<<endl;
3446 else S << " ******** Check Model (Complete) ********"<<endl;
3447 Interface_CheckTool CT (Graph());
3448 Interface_CheckIterator C;
3452 if (level == 3) C = CT.CheckList();
3453 else C = CT.CompleteCheckList();
3455 catch (Standard_Failure) {
3456 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3457 sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
3458 S<<" ** ** Exception Raised during Check ! ** **\n";
3459 S<<" --> what could be determined is listed"<<endl;
3462 else if (level == 3) C = CT.CheckList();
3463 else C = CT.CompleteCheckList();
3465 // Check List : si vide (pas demandee), naturellement passee
3468 C.Print(S,themodel, (level == 3));
3470 catch (Standard_Failure) {
3471 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3472 sout<<" **** Interruption DumpModel par Exception : ****\n";
3473 sout<<Standard_Failure::Caught()->GetMessageString();
3474 sout<<"\n Abandon"<<endl;
3478 S<<endl<<"There are "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<endl;
3481 // .... TraceDumpModel .... (Model + CheckList)
3483 //=======================================================================
3486 //=======================================================================
3488 void IFSelect_WorkSession::TraceDumpModel
3489 (const Standard_Integer mode)
3491 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3492 DumpModel (mode,sout);
3493 // if (mode <= 4) { DumpModel (mode,sout); return; }
3495 // else if (mode <= 7) PrintCheckList (ModelCheckList(),Standard_False, mode-5);
3496 // else if (mode <=10) PrintCheckList (ModelCheckList(),Standard_True , mode-8);
3499 // .... DumpEntity ....
3501 //=======================================================================
3504 //=======================================================================
3506 void IFSelect_WorkSession::DumpEntity
3507 (const Handle(Standard_Transient)& ent, const Standard_Integer level,
3508 const Handle(Message_Messenger)& S) const
3511 { S<< " *** Data for List not available ***"<<endl; return; }
3512 Standard_Integer num = themodel->Number(ent);
3513 if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<<endl; return; }
3514 if (thelibrary.IsNull()) { S<<" *** WorkLibrary not defined ***"<<endl; return; }
3515 S << " ******** Dumping Entity n0 "<<num
3516 <<" level:"<<level<<" ********"<<endl;
3517 thelibrary->DumpEntity (themodel,theprotocol,ent,S,level);
3520 // .... DumpEntity ....
3522 //=======================================================================
3525 //=======================================================================
3527 void IFSelect_WorkSession::TraceDumpEntity
3528 (const Handle(Standard_Transient)& ent, const Standard_Integer level) const
3530 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3531 DumpEntity (ent,level,sout);
3534 // .... PrintEntityStatus ....
3536 //=======================================================================
3539 //=======================================================================
3541 void IFSelect_WorkSession::PrintEntityStatus
3542 (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S)
3544 Standard_Integer i,nb;
3545 Standard_Integer num = StartingNumber(ent);
3546 if (num == 0) { cout<<" -- PrintEntityStatus : unknown"<<endl; return; }
3548 S <<" Ent. n0/id: ";
3549 Model()->Print(ent,S);
3550 Handle(TCollection_HAsciiString) hname = EntityName(ent);
3551 if (!hname.IsNull() && hname->Length() > 0) S<<" Name:"<<hname->ToCString();
3553 Handle(IFSelect_Signature) signtype = SignType();
3554 if (signtype.IsNull()) S<<" Type(CDL):"<<ent->DynamicType()->Name()<<endl;
3555 else S <<" Type:"<<signtype->Value (ent,Model())<<endl;
3556 S <<" Category : " <<CategoryName (ent)
3557 <<" Validity : " <<ValidityName (ent) << endl;
3558 Interface_CheckIterator chl = CheckOne (ent);
3559 chl.Print (S,Model(),Standard_False,Standard_False);
3561 Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
3562 if (list.IsNull()) S<<" Root"<<endl;
3564 nb = list->Length();
3565 if (nb == 0) S<<" Root";
3566 else S<<" Super-entities:"<<nb<<" : (n0/id):";
3567 for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
3570 list = Shareds (ent);
3571 if (list.IsNull()) S<<" No sub-entity"<<endl;
3573 nb = list->Length();
3574 if (nb == 0) S<<" No sub-entity";
3575 else S<<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
3576 for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
3581 // .... PrintCheckList ....
3583 //=======================================================================
3586 //=======================================================================
3588 void IFSelect_WorkSession::PrintCheckList
3589 (const Interface_CheckIterator& checklist,
3590 const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const
3592 // mode : 0 comptage 1 n0s entites 2 n0s+id ents
3593 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3594 if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,themodel,failsonly);
3596 Interface_CheckIterator chks = checklist;
3597 Handle(IFSelect_CheckCounter) counter =
3598 new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
3599 counter->Analyse (chks,themodel,Standard_True,failsonly);
3600 counter->PrintList (sout,themodel,mode);
3604 // .... PrintSignatureList ....
3606 //=======================================================================
3609 //=======================================================================
3611 void IFSelect_WorkSession::PrintSignatureList
3612 (const Handle(IFSelect_SignatureList)& signlist,
3613 const IFSelect_PrintCount mode) const
3615 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3616 if (signlist.IsNull()) return;
3617 signlist->PrintList (sout,themodel,mode);
3620 // #### #### #### #### #### #### #### #### ####
3621 // .... EvaluateSelection ....
3623 //=======================================================================
3626 //=======================================================================
3628 void IFSelect_WorkSession::EvaluateSelection
3629 (const Handle(IFSelect_Selection)& sel) const
3631 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3633 errhand = Standard_False;
3636 EvaluateSelection(sel); // appel normal (->code unique)
3638 catch (Standard_Failure) {
3639 sout<<" **** Interruption EvaluateSelection par Exception **** Intitule\n";
3640 sout<<Standard_Failure::Caught()->GetMessageString();
3641 sout<<"\n Abandon"<<endl;
3643 errhand = theerrhand;
3648 { sout<< " *** Data for Evaluation not available ***"<<endl; return; }
3649 if (ItemIdent(sel) == 0)
3650 { sout << " Selection : "<<" Unknown"<<endl; return; } //sout<<Handle
3651 Interface_EntityIterator iter = EvalSelection (sel);
3652 ListEntities (iter,1);
3653 sout << "**** (Unique) RootResult, Selection : "
3654 <<sel->Label()<<endl;
3658 // #### #### #### #### #### #### #### #### ####
3659 // .... EvaluateDispatch ....
3661 //=======================================================================
3664 //=======================================================================
3666 void IFSelect_WorkSession::EvaluateDispatch
3667 (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode) const
3669 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3671 errhand = Standard_False;
3674 EvaluateDispatch(disp,mode); // appel normal (->code unique)
3676 catch (Standard_Failure) {
3677 sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n";
3678 sout<<Standard_Failure::Caught()->GetMessageString();
3679 sout<<"\n Abandon"<<endl;
3681 errhand = theerrhand;
3685 Standard_Integer numdisp = DispatchRank(disp);
3687 { sout<< " *** Data for List not available ***"<<endl; return; }
3688 if (theshareout->NbDispatches() < numdisp || numdisp <= 0)
3689 { sout<<"Dispatch : "<<" Unknown"<<endl; return; } //sout<<Handle
3690 if (disp->FinalSelection().IsNull())
3691 { sout<<"Dispatch "<<" : No Final Selection"<<endl; return; }//sout<<Handle
3692 sout<<" --- Dispatch Label : "<<disp->Label()<<endl;
3694 IFSelect_ShareOutResult eval(disp,thegraph->Graph());
3696 Standard_Integer numpack = 0;
3697 Handle(IFSelect_PacketList) evres =
3698 eval.Packets (mode ? Standard_True : Standard_False);
3699 Standard_Integer nbpack = evres->NbPackets();
3701 sout<<"Nb Packets produced : "<<nbpack<<" :"<<endl;
3702 for (numpack = 1; numpack <= nbpack; numpack ++) {
3703 sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
3704 if (!mode) cout<<"Root Entities :"<<endl;
3705 ListEntities (evres->Entities(numpack), (mode ? 2 : -1));
3708 //// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph());
3709 if (mode == 0) return;
3710 if (mode == 1 || mode == 3) {
3712 if (evres->NbDuplicated(0,Standard_False) == 0)
3713 sout<<" **** All the Model is taken into account ****"<<endl;
3715 sout<<" **** Starting Entities not taken by this Dispatch ****"<<endl;
3716 ListEntities (evres->Duplicated(0,Standard_False),2);
3720 sout<<" **** Entites in more than one packet ****";
3721 Standard_Integer max = evres->HighestDuplicationCount();
3722 if (max < 2) sout<<" : There are none"<<endl;
3724 Standard_Integer newcount;
3726 for (newcount = 2; newcount <= max; newcount ++) {
3727 if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
3728 sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
3729 ListEntities (evres->Duplicated(newcount,Standard_False),2);
3736 // #### #### #### #### #### #### #### #### ####
3737 // .... EvaluateComplete ....
3739 //=======================================================================
3742 //=======================================================================
3744 void IFSelect_WorkSession::EvaluateComplete
3745 (const Standard_Integer mode) const
3747 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3749 errhand = Standard_False;
3752 EvaluateComplete(mode); // appel normal (donc, code pas duplique)
3754 catch (Standard_Failure) {
3755 sout<<" **** Interruption EvaluateComplete par Exception : ****\n";
3756 sout<<Standard_Failure::Caught()->GetMessageString();
3757 sout<<"\n Abandon"<<endl;
3759 errhand = theerrhand;
3764 { sout<< " *** Data for List not available ***"<<endl; return; }
3765 IFSelect_ShareOutResult eval(theshareout,thegraph->Graph());
3767 sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n";
3768 sout<<" **** List of Packets **** Count : "<<eval.NbPackets()<<endl;
3769 if (mode == 0) sout << " ** (for each one : Root Entities) **"<<endl;
3770 else sout << " ** (for each one : Evaluated Content) **"<<endl;
3772 Standard_Integer numpack = 0;
3773 Handle(IFSelect_PacketList) evres =
3774 eval.Packets (mode ? Standard_True : Standard_False);
3775 Standard_Integer nbpack = evres->NbPackets();
3777 sout<<"Nb Packets produced : "<<nbpack<<" :"<<endl;
3778 for (numpack = 1; numpack <= nbpack; numpack ++) {
3779 sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
3780 if (!mode) cout<<"Root Entities :"<<endl;
3781 ListEntities (evres->Entities(numpack), (mode ? 2: -1));
3783 if (mode == 0) return;
3784 if (mode == 1 || mode == 3) {
3786 if (evres->NbDuplicated(0,Standard_False) == 0)
3787 sout<<" **** All the Model is taken into account ****"<<endl;
3789 sout<<" **** Starting Entities Forgotten ****"<<endl;
3790 ListEntities (evres->Duplicated(0,Standard_False),2);
3794 sout<<" **** Entites in more than one packet ****"<<endl;
3795 Standard_Integer max = evres->HighestDuplicationCount();
3796 if (max < 2) sout<<" : There are none"<<endl;
3798 Standard_Integer newcount;
3800 for (newcount = 2; newcount <= max; newcount ++) {
3801 if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
3802 sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
3803 ListEntities (evres->Duplicated(newcount,Standard_False),2);
3810 // #### #### #### #### #### #### #### #### ####
3811 // .... Routine Interne : ListEntities
3813 //=======================================================================
3816 //=======================================================================
3818 void IFSelect_WorkSession::ListEntities
3819 (const Interface_EntityIterator& iter, const Standard_Integer mmode) const
3821 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3823 Standard_Integer mode = (mmode < 0 ? -mmode : mmode);
3824 if (mmode >= 0) sout << " List of " << iter.NbEntities() << " Entities :"<<endl;
3826 { sout<< " *** Data for List not available ***"<<endl; return; }
3827 Interface_ShareFlags tool(thegraph->Graph());
3831 int newcount = -1; int mods = 0; int cnt = 0;
3832 for (iter.Start(); iter.More(); iter.Next()) {
3833 if (!titre && mode == 1) sout
3834 << "Number/Id. Category Validity Type\n----------- ----...."<<endl;
3835 // 123456789 123456789 123456 123456789 123456789 123456
3836 if (!titre && mode == 0) sout<<" Keys : R Root ? Unknown * Unloaded"<<endl;
3837 if (!titre && mode == 2) sout<<"(";
3839 Handle(Standard_Transient) ent = iter.Value();
3840 Standard_Integer num = themodel->Number(ent);
3842 // n0 id (root?) category validity tracetype
3843 sout<<Interface_MSG::Blanks (num,6);
3844 themodel->Print(ent,sout,0);
3845 if (!tool.IsShared(ent)) sout << " #ROOT#";
3847 Standard_Integer catnum = themodel->CategoryNumber(num);
3848 if (catnum > 0) sout<<" "<<Interface_Category::Name (catnum);
3849 sout << " (" << ValidityName (ent) << ") ";
3851 sout<<" Type:"<<themodel->TypeName (ent, Standard_False);
3852 // Handle(Interface_GeneralModule) tracemod;
3853 // Standard_Integer CN;
3854 // if (thegtool->Select(ent,tracemod,CN))tracemod->TraceType(ent,CN,sout);
3855 // else sout << "(Not in Protocol) " << ent->DynamicType();
3857 } else if (mode == 2) {
3859 if (newcount > 0) sout<<",";
3862 newcount ++; mods = 0; cnt ++;
3863 if (newcount >= 10) { sout << endl<<"["<<cnt<<"]:"; newcount = 1; }
3864 if (newcount > 0) sout << " ";
3865 themodel->Print(ent,sout,0);
3866 if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; }
3867 if (themodel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
3868 if (themodel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
3869 if (mods) { sout<<")"; newcount ++; }
3872 if (mode == 0) sout<<endl;
3873 if (mode == 2) sout<<")"<<endl;
3875 catch (Standard_Failure) {
3876 sout<<" **** Interruption ListEntities par Exception : ****\n";
3877 sout<<Standard_Failure::Caught()->GetMessageString();
3878 sout<<"\n Abandon"<<endl;
3882 void IFSelect_WorkSession::SetModeStat( Standard_Boolean theStatMode)
3884 themodelstat = theStatMode;
3887 Standard_Boolean IFSelect_WorkSession::GetModeStat() const
3889 return themodelstat;