1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 //#1 svv 10.01.00 : porting on DEC
15 //smh#14 17.03.2000 : FRA62479 Clearing of gtool
16 #include <Standard_ErrorHandler.hxx>
17 #include <IFSelect_WorkSession.ixx>
18 #include <IFSelect_DispPerOne.hxx>
19 #include <IFSelect_DispPerCount.hxx>
20 #include <IFSelect_DispGlobal.hxx>
21 #include <IFSelect_ShareOutResult.hxx>
22 #include <Interface_Graph.hxx>
23 #include <IFGraph_SubPartsIterator.hxx>
24 #include <IFSelect_PacketList.hxx>
25 #include <Interface_ReportEntity.hxx>
26 #include <Interface_Static.hxx>
28 #include <IFSelect_SignValidity.hxx>
29 #include <Interface_Category.hxx>
30 #include <Interface_Check.hxx>
31 #include <Interface_CheckTool.hxx>
32 #include <Interface_CheckIterator.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Interface_ShareFlags.hxx>
35 #include <Interface_GeneralLib.hxx>
36 #include <Interface_GeneralModule.hxx>
37 #include <Dico_IteratorOfDictionaryOfTransient.hxx>
38 #include <Dico_IteratorOfDictionaryOfInteger.hxx>
39 #include <Interface_CopyTool.hxx>
40 #include <Interface_CopyControl.hxx>
42 #include <IFSelect_SelectDeduct.hxx>
43 #include <IFSelect_SelectExtract.hxx>
44 #include <IFSelect_SelectModelRoots.hxx>
45 #include <IFSelect_SelectModelEntities.hxx>
46 #include <IFSelect_SelectEntityNumber.hxx>
47 #include <IFSelect_SelectPointed.hxx>
48 #include <IFSelect_SelectControl.hxx>
49 #include <IFSelect_SelectDiff.hxx>
50 #include <IFSelect_SelectCombine.hxx>
51 #include <IFSelect_SelectUnion.hxx>
52 #include <IFSelect_SelectIntersection.hxx>
53 #include <IFSelect_SelectSignature.hxx>
55 #include <IFSelect_EditForm.hxx>
56 #include <IFSelect_Editor.hxx>
57 #include <IFSelect_ParamEditor.hxx>
58 #include <IFSelect_CheckCounter.hxx>
59 #include <IFSelect_TransformStandard.hxx>
61 #include <TColStd_MapOfInteger.hxx>
62 #include <OSD_Path.hxx>
63 #include <Interface_Macros.hxx>
64 #include <Interface_MSG.hxx>
65 #include <Message_Messenger.hxx>
66 #include <Message.hxx>
67 #include <Standard_Failure.hxx>
68 #include <IFSelect_SignatureList.hxx>
69 #include <TCollection_HAsciiString.hxx>
70 #include <IFSelect_Dispatch.hxx>
71 #include <IFSelect_Modifier.hxx>
72 #include <IFSelect_Signature.hxx>
73 #include <IFSelect_IntParam.hxx>
75 #define Flag_Incorrect 2
79 static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite
80 static TCollection_AsciiString bufstr;
83 // #################################################################
86 //=======================================================================
89 //=======================================================================
91 IFSelect_WorkSession::IFSelect_WorkSession ()
93 theshareout = new IFSelect_ShareOut;
94 theerrhand = errhand = Standard_True;
95 thenames = new Dico_DictionaryOfTransient;
96 thecopier = new IFSelect_ModelCopier;
97 thecopier->SetShareOut (theshareout);
98 thecheckdone = Standard_False;
99 thegtool = new Interface_GTool;
100 themodelstat = Standard_False;
104 //=======================================================================
107 //=======================================================================
109 void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand)
111 theerrhand = errhand = hand;
115 //=======================================================================
118 //=======================================================================
120 Standard_Boolean IFSelect_WorkSession::ErrorHandle () const
126 //=======================================================================
129 //=======================================================================
131 const Handle(IFSelect_ShareOut)& IFSelect_WorkSession::ShareOut () const
137 //=======================================================================
140 //=======================================================================
142 void IFSelect_WorkSession::SetLibrary (const Handle(IFSelect_WorkLibrary)& lib)
148 //=======================================================================
151 //=======================================================================
153 Handle(IFSelect_WorkLibrary) IFSelect_WorkSession::WorkLibrary () const
159 //=======================================================================
162 //=======================================================================
164 void IFSelect_WorkSession::SetProtocol
165 (const Handle(Interface_Protocol)& protocol)
167 theprotocol = protocol;
168 Interface_Protocol::SetActive(protocol);
169 thegtool->SetProtocol (protocol);
173 //=======================================================================
176 //=======================================================================
178 Handle(Interface_Protocol) IFSelect_WorkSession::Protocol () const
184 //=======================================================================
187 //=======================================================================
189 void IFSelect_WorkSession::SetSignType
190 (const Handle(IFSelect_Signature)& signtype)
192 thegtool->SetSignType (signtype);
193 if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type");
194 else thenames->SetItem ("xst-sign-type",signtype);
198 //=======================================================================
201 //=======================================================================
203 Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const
205 return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
209 //=======================================================================
212 //=======================================================================
214 void IFSelect_WorkSession::SetShareOut
215 (const Handle(IFSelect_ShareOut)& shareout)
217 theshareout = shareout;
218 thecopier->SetShareOut (theshareout);
219 // ... faudrait ajouter les Params, Dispatches, etc...
223 //=======================================================================
226 //=======================================================================
228 Standard_Boolean IFSelect_WorkSession::HasModel () const
230 return (!themodel.IsNull());
234 //=======================================================================
237 //=======================================================================
239 void IFSelect_WorkSession::SetModel
240 (const Handle(Interface_InterfaceModel)& model,
241 const Standard_Boolean clearpointed)
243 if (themodel != model) {
245 //skl if (!themodel.IsNull()) themodel->Clear();
248 if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
249 // themodel->SetProtocol(theprotocol);
250 themodel->SetGTool (thegtool);
253 ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien
254 ClearData(3); // RAZ CheckList, a refaire
257 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
258 if (clearpointed) ClearData(4);
263 //=======================================================================
266 //=======================================================================
267 Handle(Interface_InterfaceModel) IFSelect_WorkSession::Model () const
273 //=======================================================================
276 //=======================================================================
278 void IFSelect_WorkSession::SetLoadedFile (const Standard_CString filename)
281 theloaded.AssignCat (filename);
285 //=======================================================================
288 //=======================================================================
290 Standard_CString IFSelect_WorkSession::LoadedFile () const
292 return theloaded.ToCString();
296 //=======================================================================
299 //=======================================================================
301 IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
302 (const Standard_CString filename)
304 if (thelibrary.IsNull()) return IFSelect_RetVoid;
305 if (theprotocol.IsNull()) return IFSelect_RetVoid;
306 Handle(Interface_InterfaceModel) model;
307 IFSelect_ReturnStatus status = IFSelect_RetVoid;
310 Standard_Integer stat = thelibrary->ReadFile (filename,model,theprotocol);
311 if (stat == 0) status = IFSelect_RetDone;
312 else if (stat < 0) status = IFSelect_RetError;
313 else status = IFSelect_RetFail;
315 catch(Standard_Failure) {
316 Handle(Message_Messenger) sout = Message::DefaultMessenger();
317 sout<<" **** Interruption ReadFile par Exception : ****\n";
318 sout << Standard_Failure::Caught()->GetMessageString();
319 sout<<"\n Abandon"<<endl;
320 status = IFSelect_RetFail;
322 if (status != IFSelect_RetDone) return status;
323 if (model.IsNull()) return IFSelect_RetVoid;
325 SetLoadedFile (filename);
330 //=======================================================================
333 //=======================================================================
335 Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
337 if (themodel.IsNull()) return 0;
338 return themodel->NbEntities();
342 //=======================================================================
345 //=======================================================================
347 Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity
348 (const Standard_Integer num) const
350 Handle(Standard_Transient) res; // Null par defaut
351 if (themodel.IsNull()) return res;
352 if (num < 1 || num > themodel->NbEntities()) return res;
353 return themodel->Value(num);
357 //=======================================================================
360 //=======================================================================
362 Standard_Integer IFSelect_WorkSession::StartingNumber
363 (const Handle(Standard_Transient)& ent) const
365 if (themodel.IsNull()) return 0;
366 return themodel->Number(ent);
370 //=======================================================================
373 //=======================================================================
375 Standard_Integer IFSelect_WorkSession::NumberFromLabel
376 (const Standard_CString val, const Standard_Integer afternum) const
378 Standard_Integer i, cnt = 0, num = atoi(val);
379 if (num > 0 || themodel.IsNull()) return num; // un n0 direct : gagne !
380 // Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
381 if (num > themodel->NbEntities()) { num = 0; return num; }
382 Standard_Boolean exact = Standard_False;
383 Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
384 for (i = themodel->NextNumberForLabel (val, after, exact) ; i != 0;
385 i = themodel->NextNumberForLabel (val, i, exact)) {
387 if (num <= 0) num = i;
389 if (cnt == 1) return num;
396 //=======================================================================
399 //=======================================================================
401 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel
402 (const Handle(Standard_Transient)& ent) const
404 Handle(TCollection_HAsciiString) name;
405 if (themodel.IsNull() || ent.IsNull()) return name;
406 if (!themodel->Contains(ent)) return name;
407 name = themodel->StringLabel(ent);
412 //=======================================================================
415 //=======================================================================
417 Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName
418 (const Handle(Standard_Transient)& ent) const
420 Handle(TCollection_HAsciiString) name;
421 if (themodel.IsNull() || ent.IsNull()) return name;
422 Interface_ShareTool sht(thegraph->Graph());
425 Handle(Interface_GeneralModule) module;
426 if (!thegtool->Select (ent,module,CN)) return 0;
427 return module->Name (CN,ent,sht);
431 //=======================================================================
434 //=======================================================================
436 Standard_Integer IFSelect_WorkSession::CategoryNumber
437 (const Handle(Standard_Transient)& ent) const
439 if (themodel.IsNull()) return -1;
440 Standard_Integer num = StartingNumber(ent);
441 return themodel->CategoryNumber(num);
445 //=======================================================================
448 //=======================================================================
450 Standard_CString IFSelect_WorkSession::CategoryName
451 (const Handle(Standard_Transient)& ent) const
453 Standard_Integer cn = CategoryNumber (ent);
454 return Interface_Category::Name (cn);
458 //=======================================================================
461 //=======================================================================
463 Standard_CString IFSelect_WorkSession::ValidityName
464 (const Handle(Standard_Transient)& ent) const
466 if (StartingNumber(ent) == 0) return "";
467 return IFSelect_SignValidity::CVal (ent,themodel);
471 //=======================================================================
474 //=======================================================================
476 void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
481 if (!themodel.IsNull()) themodel->Clear();
483 ClearData(2); ClearData(4);
487 case 2 : { thegraph.Nullify(); thecheckdone = Standard_False; thecheckana.Clear(); break; }
488 case 3 : { thecheckdone = Standard_False; break; }
490 // MISE A JOUR des SelectPointed C-A-D on efface leur contenu
491 // AINSI que des editeurs (en fait, les EditForm)
492 // Des compteurs C-A-D on efface leur contenu (a reevaluer)
493 Handle(TColStd_HSequenceOfInteger) list =
494 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
495 Standard_Integer nb = list->Length();
496 Standard_Integer i; // svv #1
497 for (i = 1; i <= nb; i ++) {
498 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
499 if (!sp.IsNull()) sp->Clear();
501 list = ItemIdents(STANDARD_TYPE(IFSelect_SignatureList));
503 for (i = 1; i <= nb; i ++) {
504 DeclareAndCast(IFSelect_SignatureList,sl,Item(list->Value(i)));
505 if (!sl.IsNull()) sl->Clear();
506 DeclareAndCast(IFSelect_SignCounter,sc,sl);
507 if (!sc.IsNull()) sc->SetSelMode(-1);
509 list = ItemIdents(STANDARD_TYPE(IFSelect_EditForm));
511 Handle(Standard_Transient) nulent;
512 for (i = 1; i <= nb; i ++) {
513 DeclareAndCast(IFSelect_EditForm,edf,Item(list->Value(i)));
524 //=======================================================================
527 //=======================================================================
529 Standard_Boolean IFSelect_WorkSession::ComputeGraph
530 (const Standard_Boolean enforce)
532 if (theprotocol.IsNull()) return Standard_False;
533 if (themodel.IsNull()) return Standard_False;
534 //if (themodel->NbEntities() == 0) return Standard_False;
535 if (enforce) thegraph.Nullify();
536 if (!thegraph.IsNull()) {
537 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
540 if (themodel->NbEntities() == 0) return Standard_False;
541 // Il faut calculer le graphe pour de bon
542 thegraph = new Interface_HGraph (themodel,themodelstat);
543 Standard_Integer nb = themodel->NbEntities();
546 Standard_Integer i; // svv #1
547 for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0);
548 Interface_BitMap& bm = thegraph->CGraph().CBitMap();
550 bm.SetFlagName (Flag_Incorrect,"Incorrect");
553 thecheckdone = Standard_True;
556 // Calcul des categories, a present memorisees dans le modele
557 Interface_Category categ(thegtool);
558 Interface_ShareTool sht(thegraph);
559 Standard_Integer i =1;
560 for ( ; i <= nb; i ++) themodel->SetCategoryNumber
561 (i,categ.CatNum(themodel->Value(i),sht));
564 return Standard_True;
568 //=======================================================================
571 //=======================================================================
573 Handle(Interface_HGraph) IFSelect_WorkSession::HGraph ()
580 //=======================================================================
583 //=======================================================================
585 const Interface_Graph& IFSelect_WorkSession::Graph ()
588 if (thegraph.IsNull()) Standard_DomainError::Raise
589 ("IFSelect WorkSession : Graph not available");
590 return thegraph->Graph();
594 //=======================================================================
597 //=======================================================================
599 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds
600 (const Handle(Standard_Transient)& ent)
602 Handle(TColStd_HSequenceOfTransient) list;
603 if (!ComputeGraph()) return list;
604 if (StartingNumber(ent) == 0) return list;
605 return thegraph->Graph().Shareds(ent).Content();
609 //=======================================================================
612 //=======================================================================
614 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings
615 (const Handle(Standard_Transient)& ent)
617 Handle(TColStd_HSequenceOfTransient) list;
618 if (!ComputeGraph()) return list;
619 if (StartingNumber(ent) == 0) return list;
620 return thegraph->Graph().Sharings(ent).Content();
624 //=======================================================================
627 //=======================================================================
629 Standard_Boolean IFSelect_WorkSession::IsLoaded () const
631 if (theprotocol.IsNull()) return Standard_False;
632 if (themodel.IsNull()) return Standard_False;
633 if (themodel->NbEntities() == 0) return Standard_False;
634 if (thegraph.IsNull()) return Standard_False;
635 if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
636 return Standard_False;
640 //=======================================================================
643 //=======================================================================
645 Standard_Boolean IFSelect_WorkSession::ComputeCheck
646 (const Standard_Boolean enforce)
648 if (enforce) thecheckdone = Standard_False;
649 if (thecheckdone) return Standard_True;
650 if (!IsLoaded()) return Standard_False;
652 Interface_Graph& CG = thegraph->CGraph();
653 Interface_CheckTool cht(thegraph);
654 Interface_CheckIterator checklist = cht.VerifyCheckList();
655 themodel->FillSemanticChecks(checklist,Standard_False);
658 // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM)
659 Interface_BitMap& BM = CG.CBitMap();
660 BM.Init (Standard_False,Flag_Incorrect);
661 Standard_Integer num, nb = CG.Size();
662 for (checklist.Start(); checklist.More(); checklist.Next()) {
663 const Handle(Interface_Check) chk = checklist.Value();
664 if (!chk->HasFailed()) continue;
665 num = checklist.Number();
666 if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
668 for (num = 1; num <= nb; num ++)
669 if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
671 return Standard_True;
675 //=======================================================================
678 //=======================================================================
680 Interface_CheckIterator IFSelect_WorkSession::ModelCheckList
681 (const Standard_Boolean complete)
683 Interface_CheckIterator checks;
685 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
688 Interface_CheckTool cht(Graph());
689 checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList());
691 ((char*)(complete ? "Model Complete Check List" : "Model Syntactic Check List"));
696 //=======================================================================
699 //=======================================================================
701 Interface_CheckIterator IFSelect_WorkSession::CheckOne
702 (const Handle(Standard_Transient)& ent,
703 const Standard_Boolean complete)
705 Interface_CheckIterator checks;
706 checks.SetModel(themodel);
708 checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
711 Standard_Integer num = -1;
712 if (ent.IsNull() || ent == themodel) num = 0;
713 else num = themodel->Number(ent);
715 Handle(Interface_Check) ach = themodel->Check (num,Standard_True);
716 if (complete) ach->GetMessages (themodel->Check (num,Standard_False));
717 if (num > 0) ach->SetEntity(ent);
718 checks.Add (ach,num);
719 checks.SetName ("Data Check (One Entity)");
724 //=======================================================================
727 //=======================================================================
729 Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const
735 // #####################################################################
736 // .... LES VARIABLES ....
738 //=======================================================================
741 //=======================================================================
743 Standard_Integer IFSelect_WorkSession::MaxIdent () const
745 return theitems.Extent();
749 //=======================================================================
752 //=======================================================================
754 Handle(Standard_Transient) IFSelect_WorkSession::Item
755 (const Standard_Integer id) const
757 Handle(Standard_Transient) res;
758 if (id <= 0 || id > MaxIdent()) return res;
759 if (theitems.FindFromIndex(id).IsNull()) return res;
760 return theitems.FindKey(id);
764 //=======================================================================
767 //=======================================================================
769 Standard_Integer IFSelect_WorkSession::ItemIdent
770 (const Handle(Standard_Transient)& item) const
772 if (item.IsNull()) return 0;
773 Standard_Integer id = theitems.FindIndex(item);
774 if (id == 0) return 0;
775 if (theitems.FindFromIndex(id).IsNull()) return 0;
780 //=======================================================================
783 //=======================================================================
785 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
786 (const Standard_CString name) const
788 Handle(Standard_Transient) res;
789 if (name[0] == '\0') return res;
790 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
791 Standard_Integer id = atoi( &name[1] );
794 if (!thenames->GetItem(name,res)) res.Nullify();
799 //=======================================================================
802 //=======================================================================
804 Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
805 (const Handle(TCollection_HAsciiString)& name) const
807 Handle(Standard_Transient) res;
808 if (!name.IsNull()) res = NamedItem (name->ToCString());
813 //=======================================================================
816 //=======================================================================
818 Standard_Integer IFSelect_WorkSession::NameIdent
819 (const Standard_CString name) const
821 Handle(Standard_Transient) res;
822 if (name[0] == '\0') return 0;
823 if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
824 Standard_Integer id = atoi( &name[1] );
827 if (!thenames->GetItem(name,res)) return 0;
828 return ItemIdent(res);
832 //=======================================================================
835 //=======================================================================
837 Standard_Boolean IFSelect_WorkSession::HasName
838 (const Handle(Standard_Transient)& item) const
840 if (item.IsNull()) return Standard_False;
841 Standard_Integer id = theitems.FindIndex(item);
842 if (id == 0) return Standard_False;
843 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
844 if (att.IsNull()) return Standard_False;
845 return att->IsKind(STANDARD_TYPE(TCollection_HAsciiString));
849 //=======================================================================
852 //=======================================================================
854 Handle(TCollection_HAsciiString) IFSelect_WorkSession::Name
855 (const Handle(Standard_Transient)& item) const
857 Handle(TCollection_HAsciiString) res;
858 if (item.IsNull()) return res;
859 Standard_Integer id = theitems.FindIndex(item);
860 if (id == 0) return res; // Null
861 Handle(Standard_Transient) att = theitems.FindFromIndex(id);
862 return GetCasted(TCollection_HAsciiString,att);
866 //=======================================================================
869 //=======================================================================
871 Standard_Integer IFSelect_WorkSession::AddItem
872 (const Handle(Standard_Transient)& item,
873 const Standard_Boolean active)
875 if (item.IsNull()) return 0;
876 Standard_Integer id = theitems.FindIndex(item);
878 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
879 if (att.IsNull()) att = item;
881 else id = theitems.Add(item,item);
883 // Cas particuliers : Dispatch,Modifier
884 if (active) SetActive(item,Standard_True);
889 //=======================================================================
892 //=======================================================================
894 Standard_Integer IFSelect_WorkSession::AddNamedItem
895 (const Standard_CString name, const Handle(Standard_Transient)& item,
896 const Standard_Boolean active)
898 if (item.IsNull()) return 0;
899 if (name[0] == '#' || name[0] == '!') return 0;
900 // #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom)
901 // nom deja pris : on ecrase l ancienne valeur
902 if (name[0] != '\0') {
903 Standard_Boolean deja;
904 Handle(Standard_Transient)& newitem = thenames->NewItem(name,deja);
905 // if (deja & item != newitem) return 0;
908 Standard_Integer id = theitems.FindIndex(item);
910 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
911 if (att.IsNull()) att = item;
912 if (name[0] != '\0') {
913 // if (!att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) ecrasement admis !
914 att = new TCollection_HAsciiString(name);
917 else if (name[0] != '\0')
918 id = theitems.Add(item,new TCollection_HAsciiString(name));
919 else id = theitems.Add(item,item);
921 // Cas particuliers : Dispatch,Modifier
922 if (active) SetActive(item,Standard_True);
927 //=======================================================================
930 //=======================================================================
932 Standard_Boolean IFSelect_WorkSession::SetActive
933 (const Handle(Standard_Transient)& item, const Standard_Boolean mode)
935 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
936 DeclareAndCast(IFSelect_Dispatch,disp,item);
937 Standard_Integer num = theshareout->DispatchRank(disp);
938 if ( num > theshareout->NbDispatches()) return Standard_False;
940 if (num > 0) return Standard_False;
941 theshareout->AddDispatch (disp);
942 return Standard_True;
944 if (num <= theshareout->LastRun()) return Standard_False;
945 theshareout->RemoveDispatch(num);
946 SetFileRoot(disp,""); // si onlynamed : nettoie aussi ShareOut
947 return Standard_True;
951 return Standard_False;
955 //=======================================================================
958 //=======================================================================
960 Standard_Boolean IFSelect_WorkSession::RemoveNamedItem
961 (const Standard_CString name)
963 Handle(Standard_Transient) item = NamedItem(name);
964 if (item.IsNull()) return Standard_False;
965 if (!RemoveItem(item)) return Standard_False; // qui se charge de tout
966 return Standard_True;
970 //=======================================================================
973 //=======================================================================
975 Standard_Boolean IFSelect_WorkSession::RemoveName
976 (const Standard_CString name)
978 Handle(Standard_Transient) item = NamedItem(name);
979 if (item.IsNull()) return Standard_False;
980 theitems.Add(item,item); // reste mais sans nom
981 return thenames->RemoveItem(name);
985 //=======================================================================
988 //=======================================================================
990 Standard_Boolean IFSelect_WorkSession::RemoveItem
991 (const Handle(Standard_Transient)& item)
993 if (item.IsNull()) return Standard_False;
994 Standard_Integer id = theitems.FindIndex(item);
995 if (id == 0) return Standard_False;
996 Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
997 if (att.IsNull()) return Standard_False; // deja annulle
999 // Cas particuliers : Dispatch,Modifier
1000 theshareout->RemoveItem(item);
1002 // Marquer "Removed" dans la Map (on ne peut pas la vider)
1003 if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) {
1004 if (!thenames->RemoveItem
1005 (GetCasted(TCollection_HAsciiString,att)->ToCString()))
1006 return Standard_False;
1008 att.Nullify(); // cf ChangeFromIndex
1009 // id = theitems.Add(item,att);
1010 return Standard_True;
1014 //=======================================================================
1017 //=======================================================================
1019 void IFSelect_WorkSession::ClearItems ()
1023 theshareout->Clear(Standard_False);
1027 //=======================================================================
1030 //=======================================================================
1032 Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel
1033 (const Standard_Integer id) const
1035 Handle(TCollection_HAsciiString) res;
1036 Handle(Standard_Transient) var = Item(id);
1037 if (var.IsNull()) return res;
1038 DeclareAndCast(TCollection_HAsciiString,text,var);
1039 if (!text.IsNull()) {
1040 res = new TCollection_HAsciiString("Text:");
1041 res->AssignCat(text);
1044 DeclareAndCast(IFSelect_IntParam,intpar,var);
1045 if (!intpar.IsNull()) {
1046 res = new TCollection_HAsciiString(intpar->Value());
1047 res->Insert(1,"Integer:");
1050 DeclareAndCast(IFSelect_Selection,sel,var);
1051 if (!sel.IsNull()) {
1052 res = new TCollection_HAsciiString("Selection:");
1053 res->AssignCat(sel->Label().ToCString());
1056 DeclareAndCast(IFSelect_GeneralModifier,mod,var);
1057 if (!mod.IsNull()) {
1058 if (mod->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
1059 res = new TCollection_HAsciiString("ModelModifier:");
1060 else res = new TCollection_HAsciiString("FileModifier:");
1061 res->AssignCat(mod->Label().ToCString());
1064 DeclareAndCast(IFSelect_Dispatch,disp,var);
1065 if (!disp.IsNull()) {
1066 res = new TCollection_HAsciiString("Dispatch:");
1067 res->AssignCat(disp->Label().ToCString());
1070 DeclareAndCast(IFSelect_Transformer,tsf,var);
1071 if (!tsf.IsNull()) {
1072 res = new TCollection_HAsciiString("Transformer:");
1073 res->AssignCat(tsf->Label().ToCString());
1076 DeclareAndCast(IFSelect_SignatureList,slc,var);
1077 if (!slc.IsNull()) {
1078 res = new TCollection_HAsciiString("Counter:");
1079 res->AssignCat(slc->Name());
1082 DeclareAndCast(IFSelect_Signature,sig,var);
1083 if (!sig.IsNull()) {
1084 res = new TCollection_HAsciiString("Signature:");
1085 res->AssignCat(sig->Name());
1088 DeclareAndCast(IFSelect_EditForm,edf,var);
1089 if (!edf.IsNull()) {
1090 res = new TCollection_HAsciiString("EditForm:");
1091 res->AssignCat(edf->Label());
1094 DeclareAndCast(IFSelect_Editor,edt,var);
1095 if (!edt.IsNull()) {
1096 res = new TCollection_HAsciiString("Editor:");
1097 res->AssignCat(edt->Label().ToCString());
1100 res = new TCollection_HAsciiString("VariableType:");
1101 res->AssignCat(var->DynamicType()->Name());
1106 //=======================================================================
1109 //=======================================================================
1111 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents
1112 (const Handle(Standard_Type)& type) const
1114 Handle(TColStd_HSequenceOfInteger) list =
1115 new TColStd_HSequenceOfInteger();
1116 Standard_Integer nb = theitems.Extent();
1117 for (Standard_Integer i = 1; i <= nb; i ++) {
1118 if (theitems.FindKey(i)->IsKind(type)) list->Append(i);
1124 //=======================================================================
1127 //=======================================================================
1129 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNames
1130 (const Handle(Standard_Type)& type) const
1132 Handle(TColStd_HSequenceOfHAsciiString) list =
1133 new TColStd_HSequenceOfHAsciiString();
1134 for (Dico_IteratorOfDictionaryOfTransient IT(thenames); IT.More(); IT.Next()){
1135 if (IT.Value()->IsKind(type)) list->Append
1136 (new TCollection_HAsciiString(IT.Name().ToCString()));
1142 // .. Recherche par label : recherche en liste(noms) ou iterative
1144 //=======================================================================
1147 //=======================================================================
1149 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNamesForLabel
1150 (const Standard_CString label) const
1152 Handle(TColStd_HSequenceOfHAsciiString) list =
1153 new TColStd_HSequenceOfHAsciiString();
1154 Standard_Integer i, nb = MaxIdent();
1155 for (i = 1; i <= nb; i ++) {
1156 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1157 Handle(Standard_Transient) item = Item(i);
1158 if (lab.IsNull()) continue;
1159 if (label[0] != '\0' && lab->Search(label) <= 0) continue;
1161 Handle(TCollection_HAsciiString) nom = Name(Item(i));
1162 if (nom.IsNull()) { nom = new TCollection_HAsciiString(i); nom->Insert(1,'#'); }
1163 else nom = new TCollection_HAsciiString (nom);
1164 list->Append (new TCollection_HAsciiString(lab));
1170 //=======================================================================
1173 //=======================================================================
1175 Standard_Integer IFSelect_WorkSession::NextIdentForLabel
1176 (const Standard_CString label, const Standard_Integer id,
1177 const Standard_Integer mode) const
1179 Standard_Integer nb = MaxIdent();
1180 for (Standard_Integer i = id+1; i <= nb; i ++) {
1181 Handle(TCollection_HAsciiString) lab = ItemLabel(i);
1182 if (lab.IsNull()) continue;
1184 case 0 : if (!strcmp(lab->ToCString(),label)) return i; break; // switch
1185 case 1 : if (lab->Search(label) == 1 ) return i; break;
1186 case 2 : if (lab->Search(label) > 0 ) return i; break;
1187 default : break; // break du switch
1190 return 0; // ici : pas trouve
1194 // #################################################################
1195 // .... Parametres (Int et Text) ....
1197 //=======================================================================
1200 //=======================================================================
1202 Handle(Standard_Transient) IFSelect_WorkSession::NewParamFromStatic
1203 (const Standard_CString statname, const Standard_CString name)
1205 Handle(Standard_Transient) param;
1206 Handle(Interface_Static) stat = Interface_Static::Static(statname);
1207 if (stat.IsNull()) return param;
1208 if (stat->Type() == Interface_ParamInteger) {
1209 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1210 intpar->SetStaticName (statname);
1213 param = stat->HStringValue();
1215 if (param.IsNull()) return param;
1216 if ( AddNamedItem (name, param) == 0 ) param.Nullify();
1221 //=======================================================================
1224 //=======================================================================
1226 Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam
1227 (const Standard_Integer id) const
1228 { return Handle(IFSelect_IntParam)::DownCast(Item(id)); }
1231 //=======================================================================
1234 //=======================================================================
1236 Standard_Integer IFSelect_WorkSession::IntValue
1237 (const Handle(IFSelect_IntParam)& par) const
1239 if (!par.IsNull()) return par->Value();
1244 //=======================================================================
1247 //=======================================================================
1249 Handle(IFSelect_IntParam) IFSelect_WorkSession::NewIntParam
1250 (const Standard_CString name)
1252 Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
1253 if ( AddNamedItem (name, intpar) == 0 ) intpar.Nullify();
1258 //=======================================================================
1261 //=======================================================================
1263 Standard_Boolean IFSelect_WorkSession::SetIntValue
1264 (const Handle(IFSelect_IntParam)& par, const Standard_Integer val)
1266 if (ItemIdent(par) == 0) return Standard_False;
1268 return Standard_True;
1272 //=======================================================================
1275 //=======================================================================
1277 Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam
1278 (const Standard_Integer id) const
1279 { return Handle(TCollection_HAsciiString)::DownCast(Item(id)); }
1282 //=======================================================================
1285 //=======================================================================
1287 TCollection_AsciiString IFSelect_WorkSession::TextValue
1288 (const Handle(TCollection_HAsciiString)& par) const
1290 if (!par.IsNull()) return TCollection_AsciiString(par->ToCString());
1291 else return TCollection_AsciiString();
1295 Handle(TCollection_HAsciiString) IFSelect_WorkSession::NewTextParam
1296 (const Standard_CString name)
1298 Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString("");
1299 if ( AddNamedItem (name, textpar) == 0 ) textpar.Nullify();
1304 //=======================================================================
1307 //=======================================================================
1309 Standard_Boolean IFSelect_WorkSession::SetTextValue
1310 (const Handle(TCollection_HAsciiString)& par, const Standard_CString val)
1312 if (ItemIdent(par) == 0) return Standard_False;
1313 par->Clear(); par->AssignCat(val);
1314 return Standard_True;
1317 // ########################################################################
1318 // .... SIGNATURES ....
1320 //=======================================================================
1323 //=======================================================================
1325 Handle(IFSelect_Signature) IFSelect_WorkSession::Signature
1326 (const Standard_Integer id) const
1327 { return GetCasted(IFSelect_Signature,Item(id)); }
1329 Standard_CString IFSelect_WorkSession::SignValue
1330 (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const
1332 if (sign.IsNull() || themodel.IsNull()) return "";
1333 if (StartingNumber(ent) == 0) return "";
1334 return sign->Value (ent,themodel);
1337 // ########################################################################
1338 // .... SELECTIONS & Cie ....
1340 //=======================================================================
1343 //=======================================================================
1345 Handle(IFSelect_Selection) IFSelect_WorkSession::Selection
1346 (const Standard_Integer id) const
1347 { return GetCasted(IFSelect_Selection,Item(id)); }
1350 //=======================================================================
1353 //=======================================================================
1355 Interface_EntityIterator IFSelect_WorkSession::EvalSelection
1356 (const Handle(IFSelect_Selection)& sel) const
1358 Interface_EntityIterator iter;
1360 errhand = Standard_False;
1363 iter = EvalSelection(sel); // appel normal (donc, code pas duplique)
1365 catch (Standard_Failure) {
1366 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1367 sout<<" **** Interruption EvalSelection par Exception : ****\n";
1368 sout<<Standard_Failure::Caught()->GetMessageString();
1369 sout<<"\n Abandon"<<endl;
1371 errhand = theerrhand;
1375 if (thegraph.IsNull()) return iter;
1376 iter = sel->UniqueResult(thegraph->Graph());
1381 //=======================================================================
1384 //=======================================================================
1386 IFSelect_SelectionIterator IFSelect_WorkSession::Sources
1387 (const Handle(IFSelect_Selection)& sel) const
1389 return IFSelect_SelectionIterator (sel);
1393 //=======================================================================
1396 //=======================================================================
1398 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResult
1399 (const Handle(IFSelect_Selection)& sel) const
1401 Handle(TColStd_HSequenceOfTransient) res;
1403 errhand = Standard_False;
1406 res = SelectionResult(sel); // appel normal (->code unique)
1408 catch (Standard_Failure) {
1409 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1410 sout<<" **** Interruption SelectionResult par Exception : ****\n";
1411 sout<<Standard_Failure::Caught()->GetMessageString();
1412 sout<<"\n Abandon"<<endl;
1414 errhand = theerrhand;
1419 cout<< " *** Data for Evaluation not available ***"<<endl;
1420 return new TColStd_HSequenceOfTransient();
1422 // if (ItemIdent(sel) == 0)
1424 { cout << " Selection : "<<" Unknown"<<endl; return res; } //cout<<Handle
1425 return EvalSelection (sel).Content();
1429 //=======================================================================
1432 //=======================================================================
1434 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromList
1435 (const Handle(IFSelect_Selection)& sel,
1436 const Handle(TColStd_HSequenceOfTransient)& list) const
1438 if (list.IsNull()) return SelectionResult (sel);
1439 DeclareAndCast(IFSelect_SelectDeduct,deduct,sel);
1440 if (deduct.IsNull()) return SelectionResult (sel);
1442 // On va chercher la derniere deduction de la chaine des inputs
1443 Handle(IFSelect_Selection) ssel, newinput;
1445 Standard_Integer i, nb = MaxIdent();
1446 for (i = 1; i <= nb * 2; i ++) {
1447 newinput = deduct->Input();
1448 deduct = GetCasted(IFSelect_SelectDeduct,newinput);
1449 if (deduct.IsNull()) break;
1453 // on y est (enfin, on devrait)
1454 // ssel est la derniere selection auscultee, deduct son downcast
1455 // input son Input (nulle si sel pas une deduction)
1456 deduct = GetCasted(IFSelect_SelectDeduct,ssel);
1458 deduct->Alternate()->SetList (list);
1460 // On execute puis on nettoie
1461 Handle(TColStd_HSequenceOfTransient) res = SelectionResult (sel);
1462 //// deduct->SetInput (newinput);
1467 //=======================================================================
1470 //=======================================================================
1472 Standard_Boolean IFSelect_WorkSession::SetItemSelection
1473 (const Handle(Standard_Transient)& item,
1474 const Handle(IFSelect_Selection)& sel)
1476 DeclareAndCast(IFSelect_Dispatch,disp,item);
1477 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1478 if (!disp.IsNull()) {
1479 if (ItemIdent(disp) == 0) return Standard_False;
1480 // Selection Nulle : Annuler FinalSelection
1481 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1482 disp->SetFinalSelection(sel);
1483 return Standard_True;
1485 if (!modif.IsNull()) {
1486 if (ItemIdent(modif) == 0) return Standard_False;
1487 if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
1488 // Selection Nulle : Annuler Selection
1489 modif->SetSelection(sel);
1490 return Standard_True;
1492 return Standard_False;
1496 //=======================================================================
1499 //=======================================================================
1501 Standard_Boolean IFSelect_WorkSession::ResetItemSelection
1502 (const Handle(Standard_Transient)& item)
1504 Handle(IFSelect_Selection) nulsel;
1505 return SetItemSelection (item,nulsel);
1509 //=======================================================================
1512 //=======================================================================
1514 Handle(IFSelect_Selection) IFSelect_WorkSession::ItemSelection
1515 (const Handle(Standard_Transient)& item) const
1517 Handle(IFSelect_Selection) sel;
1518 DeclareAndCast(IFSelect_Dispatch,disp,item);
1519 DeclareAndCast(IFSelect_GeneralModifier,modif,item);
1520 if (ItemIdent(disp) > 0) return disp->FinalSelection();
1521 if (ItemIdent(modif) > 0) return modif->Selection();
1522 return sel; // Nul ou inconnu -> Null
1525 // ######################################################################
1526 // .... Les COMPTEURS ....
1528 //=======================================================================
1531 //=======================================================================
1533 Handle(IFSelect_SignCounter) IFSelect_WorkSession::SignCounter
1534 (const Standard_Integer id) const
1535 { return GetCasted(IFSelect_SignCounter,Item(id)); }
1538 //=======================================================================
1541 //=======================================================================
1543 Standard_Boolean IFSelect_WorkSession::ComputeCounter
1544 (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced)
1546 if (counter.IsNull()) return Standard_False;
1547 if (!ComputeGraph()) return Standard_False;
1548 return counter->ComputeSelected (Graph(),forced);
1552 //=======================================================================
1555 //=======================================================================
1557 Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList
1558 (const Handle(IFSelect_SignCounter)& counter,
1559 const Handle(TColStd_HSequenceOfTransient)& list,
1560 const Standard_Boolean clear)
1562 if (counter.IsNull()) return Standard_False;
1563 if (clear) counter->Clear();
1564 if (list.IsNull()) return ComputeCounter (counter,Standard_True);
1565 counter->AddList (list,themodel);
1566 return Standard_True;
1569 // ######################################################################
1570 // .... Les DISPATCHES ....
1572 //=======================================================================
1575 //=======================================================================
1577 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::AppliedDispatches
1580 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1581 Standard_Integer nb = theshareout->NbDispatches();
1582 for (Standard_Integer i = 1; i <= nb; i ++) {
1583 list->Append (ItemIdent(theshareout->Dispatch(i)));
1589 //=======================================================================
1592 //=======================================================================
1594 void IFSelect_WorkSession::ClearShareOut (const Standard_Boolean onlydisp)
1596 theshareout->Clear(onlydisp);
1600 //=======================================================================
1603 //=======================================================================
1605 Handle(IFSelect_Dispatch) IFSelect_WorkSession::Dispatch
1606 (const Standard_Integer id) const
1608 return GetCasted(IFSelect_Dispatch,Item(id));
1612 //=======================================================================
1615 //=======================================================================
1617 Standard_Integer IFSelect_WorkSession::DispatchRank
1618 (const Handle(IFSelect_Dispatch)& disp) const
1620 if (ItemIdent(disp) == 0) return 0;
1621 return theshareout->DispatchRank(disp);
1624 // ######################################################################
1625 // .... Les MODIFIERS ....
1627 //=======================================================================
1630 //=======================================================================
1632 Handle(IFSelect_ModelCopier) IFSelect_WorkSession::ModelCopier () const
1638 //=======================================================================
1641 //=======================================================================
1643 void IFSelect_WorkSession::SetModelCopier
1644 (const Handle(IFSelect_ModelCopier)& copier)
1647 thecopier->SetShareOut(theshareout);
1651 //=======================================================================
1654 //=======================================================================
1656 Standard_Integer IFSelect_WorkSession::NbFinalModifiers
1657 (const Standard_Boolean formodel) const
1659 return theshareout->NbModifiers(formodel);
1663 //=======================================================================
1666 //=======================================================================
1668 Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents
1669 (const Standard_Boolean formodel) const
1671 // return ItemIdents(STANDARD_TYPE(IFSelect_Modifier));
1672 // On donne la liste dans l ordre du ModelCopier, qui fait foi
1673 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
1674 Standard_Integer nbm = theshareout->NbModifiers(formodel);
1675 for (Standard_Integer i = 1; i <= nbm; i ++)
1676 list->Append(ItemIdent(theshareout->GeneralModifier(formodel,i)));
1681 //=======================================================================
1684 //=======================================================================
1686 Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier
1687 (const Standard_Integer id) const
1689 return GetCasted(IFSelect_GeneralModifier,Item(id));
1693 //=======================================================================
1696 //=======================================================================
1698 Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier
1699 (const Standard_Integer id) const
1701 return GetCasted(IFSelect_Modifier,Item(id));
1705 //=======================================================================
1708 //=======================================================================
1710 Standard_Integer IFSelect_WorkSession::ModifierRank
1711 (const Handle(IFSelect_GeneralModifier)& modif) const
1713 if (ItemIdent(modif) == 0) return 0;
1714 return theshareout->ModifierRank(modif);
1718 //=======================================================================
1721 //=======================================================================
1723 Standard_Boolean IFSelect_WorkSession::ChangeModifierRank
1724 (const Standard_Boolean formodel,
1725 const Standard_Integer before, const Standard_Integer after)
1727 return theshareout->ChangeModifierRank(formodel,before,after);
1731 //=======================================================================
1734 //=======================================================================
1736 void IFSelect_WorkSession::ClearFinalModifiers ()
1738 Handle(TColStd_HSequenceOfInteger) list = FinalModifierIdents (Standard_True);
1739 Standard_Integer nb = list->Length();
1740 Standard_Integer i; // svv #1
1741 for (i = 1; i <= nb; i ++)
1742 RemoveItem(GeneralModifier(list->Value(i)));
1743 list = FinalModifierIdents (Standard_False);
1744 nb = list->Length();
1745 for (i = 1; i <= nb; i ++)
1746 RemoveItem(GeneralModifier(list->Value(i)));
1750 //=======================================================================
1753 //=======================================================================
1755 Standard_Boolean IFSelect_WorkSession::SetAppliedModifier
1756 (const Handle(IFSelect_GeneralModifier)& modif,
1757 const Handle(Standard_Transient)& item)
1759 if (ItemIdent(modif) == 0) return Standard_False;
1761 if (item.IsNull()) return Standard_False;
1762 if (item == theshareout) {
1763 theshareout->AddModifier(modif,0);
1764 return Standard_True;
1766 if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) {
1767 DeclareAndCast(IFSelect_Dispatch,disp,item);
1768 theshareout->AddModifier(modif,0);
1769 modif->SetDispatch(disp);
1770 return Standard_True;
1772 if (item->IsKind(STANDARD_TYPE(IFSelect_TransformStandard))) {
1773 DeclareAndCast(IFSelect_TransformStandard,stf,item);
1774 DeclareAndCast(IFSelect_Modifier,tmod,modif);
1775 if (tmod.IsNull()) return Standard_False;
1776 stf->AddModifier (tmod);
1777 theshareout->RemoveItem(modif);
1778 return Standard_True;
1780 return Standard_False;
1784 //=======================================================================
1787 //=======================================================================
1789 Standard_Boolean IFSelect_WorkSession::ResetAppliedModifier
1790 (const Handle(IFSelect_GeneralModifier)& modif)
1792 if (ItemIdent(modif) == 0) return Standard_False;
1794 return theshareout->RemoveItem(modif);
1798 //=======================================================================
1801 //=======================================================================
1803 Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier
1804 (const Handle(IFSelect_GeneralModifier)& modif) const
1806 Handle(Standard_Transient) res;
1807 if (ItemIdent(modif) == 0) return res;
1808 if (theshareout->ModifierRank(modif) == 0) return res;
1809 res = modif->Dispatch();
1810 if (res.IsNull()) res = theshareout;
1814 // #################################################################
1815 // .... Transformer ....
1817 //=======================================================================
1820 //=======================================================================
1822 Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer
1823 (const Standard_Integer id) const
1825 return GetCasted(IFSelect_Transformer,Item(id));
1829 //=======================================================================
1832 //=======================================================================
1834 Standard_Integer IFSelect_WorkSession::RunTransformer
1835 (const Handle(IFSelect_Transformer)& transf)
1837 Standard_Integer effect = 0;
1838 if (transf.IsNull() || !IsLoaded()) return effect;
1839 Handle(Interface_InterfaceModel) newmod; // Null au depart
1840 Interface_CheckIterator checks;
1841 checks.SetName("X-STEP WorkSession : RunTransformer");
1842 Standard_Boolean res = transf->Perform
1843 (thegraph->Graph(),theprotocol,checks,newmod);
1845 if (!checks.IsEmpty(Standard_False)) {
1846 Handle(Message_Messenger) sout = Message::DefaultMessenger();
1847 sout<<" ** RunTransformer has produced Check Messages : **"<<endl;
1848 checks.Print (sout,themodel,Standard_False);
1850 thecheckdone = Standard_False;
1851 thecheckrun = checks;
1853 if (newmod.IsNull()) return (res ? 1 : -1);
1854 // MISE A JOUR des SelectPointed
1855 Handle(TColStd_HSequenceOfInteger) list =
1856 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1857 Standard_Integer nb = list->Length();
1858 for (Standard_Integer i = 1; i <= nb; i ++) {
1859 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
1862 if (newmod == themodel) {
1863 effect = (res ? 2 : -2);
1864 if (!res) return effect;
1865 Handle(Interface_Protocol) newproto = theprotocol;
1866 if (transf->ChangeProtocol(newproto))
1867 { effect = 4; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1868 return (ComputeGraph(Standard_True) ? 4 : -4);
1870 effect = (res ? 3 : -3);
1871 if (!res) return effect;
1872 Handle(Interface_Protocol) newproto = theprotocol;
1873 if (transf->ChangeProtocol(newproto))
1874 { effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); }
1875 theoldel = themodel;
1876 SetModel(newmod,Standard_False);
1882 //=======================================================================
1885 //=======================================================================
1887 Standard_Integer IFSelect_WorkSession::RunModifier
1888 (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy)
1890 Handle(IFSelect_Selection) sel; // null
1891 return RunModifierSelected (modif,sel,copy);
1895 //=======================================================================
1898 //=======================================================================
1900 Standard_Integer IFSelect_WorkSession::RunModifierSelected
1901 (const Handle(IFSelect_Modifier)& modif,
1902 const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy)
1904 if (ItemIdent(modif) == 0) return Standard_False;
1905 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1906 stf->SetCopyOption(copy);
1907 stf->SetSelection (sel);
1908 stf->AddModifier (modif);
1909 return RunTransformer (stf);
1913 //=======================================================================
1916 //=======================================================================
1918 Handle(IFSelect_Transformer) IFSelect_WorkSession::NewTransformStandard
1919 (const Standard_Boolean copy, const Standard_CString name)
1921 Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard;
1922 stf->SetCopyOption(copy);
1923 if (AddNamedItem (name, stf) == 0) stf.Nullify();
1928 // Ceci est une action directe : pourrait etre fait par un Transformer ...
1929 //=======================================================================
1932 //=======================================================================
1934 Standard_Boolean IFSelect_WorkSession::SetModelContent
1935 (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep)
1937 if (sel.IsNull() || !IsLoaded()) return Standard_False;
1938 Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph());
1939 if (list.NbEntities() == 0) return Standard_False;
1941 Handle(Interface_InterfaceModel) newmod = themodel->NewEmptyModel();
1942 Interface_CopyTool TC(themodel,theprotocol);
1943 Standard_Integer i, nb = themodel->NbEntities();
1945 for (list.Start(); list.More(); list.Next())
1946 TC.TransferEntity (list.Value());
1948 Standard_Integer* flags = new Standard_Integer[nb+1];
1949 for (i = 0; i <= nb; i ++) flags[i] = 0;
1950 for (list.Start(); list.More(); list.Next()) {
1951 Standard_Integer num = themodel->Number(list.Value());
1952 if (num <= nb) flags[num] = 1;
1954 for (i = 1; i <= nb; i ++) {
1955 if (flags[i] == 0) TC.TransferEntity (themodel->Value(i));
1959 TC.FillModel(newmod);
1960 if (newmod->NbEntities() == 0) return Standard_False;
1961 // Mettre a jour (ne pas oublier SelectPointed)
1962 theoldel = themodel;
1963 SetModel(newmod,Standard_False);
1964 // MISE A JOUR des SelectPointed
1965 Handle(TColStd_HSequenceOfInteger) pts =
1966 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
1968 for (i = 1; i <= nb; i ++) {
1969 DeclareAndCast(IFSelect_SelectPointed,sp,Item(pts->Value(i)));
1970 sp->Update(TC.Control());
1972 return Standard_True;
1976 // #################################################################
1977 // .... File Name ....
1979 //=======================================================================
1982 //=======================================================================
1984 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FilePrefix () const
1986 return theshareout->Prefix();
1990 //=======================================================================
1993 //=======================================================================
1995 Handle(TCollection_HAsciiString) IFSelect_WorkSession::DefaultFileRoot () const
1997 return theshareout->DefaultRootName();
2001 //=======================================================================
2004 //=======================================================================
2006 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileExtension () const
2008 return theshareout->Extension();
2012 //=======================================================================
2015 //=======================================================================
2017 Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileRoot
2018 (const Handle(IFSelect_Dispatch)& disp) const
2020 return theshareout->RootName(theshareout->DispatchRank(disp));
2024 //=======================================================================
2027 //=======================================================================
2029 void IFSelect_WorkSession::SetFilePrefix (const Standard_CString name)
2031 theshareout->SetPrefix (new TCollection_HAsciiString(name));
2035 //=======================================================================
2038 //=======================================================================
2040 void IFSelect_WorkSession::SetFileExtension (const Standard_CString name)
2042 theshareout->SetExtension (new TCollection_HAsciiString(name));
2046 //=======================================================================
2049 //=======================================================================
2051 Standard_Boolean IFSelect_WorkSession::SetDefaultFileRoot
2052 (const Standard_CString name)
2054 Handle(TCollection_HAsciiString) defrt;
2055 if (name[0] != '\0') defrt = new TCollection_HAsciiString(name);
2056 return theshareout->SetDefaultRootName (defrt);
2060 //=======================================================================
2063 //=======================================================================
2065 Standard_Boolean IFSelect_WorkSession::SetFileRoot
2066 (const Handle(IFSelect_Dispatch)& disp, const Standard_CString namefile)
2068 Standard_Integer id = ItemIdent(disp);
2069 if (id == 0) return Standard_False;
2070 Standard_Integer nd = theshareout->DispatchRank(disp);
2071 /* if (theonlynamed) {
2072 if (nd == 0 && namefile[0] != 0)
2073 theshareout->AddDispatch(disp);
2074 else if (nd != 0 && namefile[0] == 0)
2075 theshareout->RemoveDispatch (nd);
2077 if (nd == 0) return Standard_False;
2078 // The order below prevented to change the root name on a given dispatch !
2079 // if (theshareout->HasRootName(nd)) return Standard_False;
2080 Handle(TCollection_HAsciiString) filename;
2081 if (namefile[0] != '\0') filename = new TCollection_HAsciiString (namefile);
2082 return theshareout->SetRootName(nd,filename);
2086 //=======================================================================
2089 //=======================================================================
2091 Standard_CString IFSelect_WorkSession::GiveFileRoot
2092 (const Standard_CString file) const
2094 OSD_Path path (file);
2095 if (!path.IsValid(TCollection_AsciiString(file))) return file; // tant pis ..
2096 bufstr = path.Name();
2097 return bufstr.ToCString();
2101 //=======================================================================
2104 //=======================================================================
2106 Standard_CString IFSelect_WorkSession::GiveFileComplete
2107 (const Standard_CString file) const
2109 // ajouter si besoin : Prefix; Extension
2110 bufstr.Clear(); bufstr.AssignCat (file);
2111 Standard_Integer i,j = 0,nb = bufstr.Length();
2112 Handle(TCollection_HAsciiString) ext = FileExtension ();
2113 if (!ext.IsNull()) {
2114 char val0 = '\0'; if (ext->Length() > 0) val0 = ext->Value(1);
2115 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val0) { j = 1; break; }
2116 if (j == 0) bufstr.AssignCat (ext->ToCString());
2118 Handle(TCollection_HAsciiString) pre = FilePrefix ();
2119 if (!pre.IsNull()) {
2120 char val1 = '\0'; if (pre->Length() > 0) val1 = pre->Value(pre->Length());
2122 for (i = nb; i > 0; i --) if (bufstr.Value(i) == val1) { j = 1; break; }
2123 if (j == 0) bufstr.Insert (1,pre->ToCString());
2126 return bufstr.ToCString();
2130 //=======================================================================
2133 //=======================================================================
2135 void IFSelect_WorkSession::ClearFile ()
2137 thecopier->ClearResult();
2138 theshareout->ClearResult(Standard_True);
2142 //=======================================================================
2145 //=======================================================================
2147 void IFSelect_WorkSession::EvaluateFile ()
2150 if (!IsLoaded()) return;
2151 Interface_CheckIterator checks;
2153 errhand = Standard_False;
2156 EvaluateFile(); // appel normal (donc, code pas duplique)
2158 catch (Standard_Failure) {
2159 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2160 sout<<" **** Interruption EvaluateFile par Exception : ****\n";
2161 sout<<Standard_Failure::Caught()->GetMessageString();
2162 sout<<"\n Abandon"<<endl;
2163 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2165 errhand = theerrhand;
2166 thecheckrun = checks;
2170 IFSelect_ShareOutResult R(theshareout,thegraph->Graph());
2171 checks = thecopier->Copy (R,thelibrary,theprotocol);
2172 if (!checks.IsEmpty(Standard_False)) {
2173 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2174 sout<<" ** EvaluateFile has produced Check Messages : **"<<endl;
2175 checks.Print (sout,themodel,Standard_False);
2177 thecopier->SetRemaining (thegraph->CGraph());
2178 thecheckrun = checks;
2182 //=======================================================================
2185 //=======================================================================
2187 Standard_Integer IFSelect_WorkSession::NbFiles () const
2189 return thecopier->NbFiles();
2193 //=======================================================================
2196 //=======================================================================
2198 Handle(Interface_InterfaceModel) IFSelect_WorkSession::FileModel
2199 (const Standard_Integer num) const
2201 Handle(Interface_InterfaceModel) mod;
2202 if (num > 0 && num <= NbFiles()) mod = thecopier->FileModel(num);
2207 //=======================================================================
2210 //=======================================================================
2212 TCollection_AsciiString IFSelect_WorkSession::FileName
2213 (const Standard_Integer num) const
2215 TCollection_AsciiString name;
2216 if (num > 0 && num <= NbFiles()) name = thecopier->FileName(num);
2221 //=======================================================================
2224 //=======================================================================
2226 void IFSelect_WorkSession::BeginSentFiles (const Standard_Boolean record)
2228 thecopier->BeginSentFiles(theshareout,record);
2232 //=======================================================================
2235 //=======================================================================
2237 Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::SentFiles () const
2239 return thecopier->SentFiles();
2243 // #########################################################################
2244 // .... Action de Transfert proprement dite : la grande affaire ! ....
2246 //=======================================================================
2249 //=======================================================================
2251 Standard_Boolean IFSelect_WorkSession::SendSplit ()
2254 Interface_CheckIterator checks;
2257 errhand = Standard_False;
2260 return SendSplit(); // appel normal (donc, code pas duplique)
2262 catch (Standard_Failure) {
2263 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2264 sout<<" **** Interruption SendSplit par Exception : ****\n";
2265 sout<<Standard_Failure::Caught()->GetMessageString();
2266 sout<<"\n Abandon"<<endl;
2267 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2269 errhand = theerrhand;
2270 thecheckrun = checks;
2271 return Standard_False;
2274 if (thelibrary.IsNull()) {
2275 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2276 thecheckrun = checks;
2277 return Standard_False;
2280 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2281 sout<< " *** Data for SendSplit not available ***"<<endl;
2282 checks.CCheck(0)->AddFail("Data not available");
2283 thecheckrun = checks;
2284 return Standard_False;
2287 if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol);
2290 IFSelect_ShareOutResult eval (ShareOut(), thegraph->Graph());
2291 checks = thecopier->Send (eval, thelibrary, theprotocol);
2292 thecopier->SetRemaining (thegraph->CGraph());
2295 if (theshareout.IsNull()) return Standard_False;
2296 Standard_Integer i, nbd = theshareout->NbDispatches();
2297 Standard_Integer nf = 0;
2298 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2299 sout<<" SendSplit .. ";
2300 for (i = 1; i <= nbd; i ++) {
2301 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
2302 if (disp.IsNull()) continue;
2303 IFGraph_SubPartsIterator packs(thegraph->Graph(),Standard_False);
2304 disp->Packets (thegraph->Graph(),packs);
2305 for (packs.Start(); packs.More(); packs.Next()) {
2306 Interface_EntityIterator iter = packs.Entities();
2307 if (iter.NbEntities() == 0) continue;
2308 // Ecrire une liste d entites
2309 Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
2310 sp->SetList (iter.Content());
2312 TCollection_AsciiString filnam (nf);
2313 filnam.Insert (1,"_");
2314 Handle(TCollection_HAsciiString) filepart;
2315 filepart = FileRoot(disp);
2316 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2317 filepart = FilePrefix();
2318 if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString());
2319 filepart = FileExtension();
2320 if (!filepart.IsNull()) filnam.AssignCat (filepart->ToCString());
2321 IFSelect_ReturnStatus stat = SendSelected (filnam.ToCString(),sp);
2322 if (stat != IFSelect_RetDone) cout<<"File "<<filnam<<" failed"<<endl;
2325 sout<<" .. Files Written : "<<nf<<endl;
2327 thecheckrun = checks;
2328 return Standard_True;
2332 //=======================================================================
2335 //=======================================================================
2337 Handle(IFSelect_PacketList) IFSelect_WorkSession::EvalSplit () const
2339 Handle(IFSelect_PacketList) pks;
2340 if (!IsLoaded()) return pks;
2341 IFSelect_ShareOutResult sho (ShareOut(), thegraph->Graph());
2342 return sho.Packets();
2346 //=======================================================================
2349 //=======================================================================
2351 Interface_EntityIterator IFSelect_WorkSession::SentList
2352 (const Standard_Integer newcount) const
2354 Interface_EntityIterator iter;
2355 if (!IsLoaded()) return iter;
2356 const Interface_Graph& G = thegraph->Graph();
2357 Standard_Integer nb = G.Size();
2359 for ( i = 1; i <= nb; i ++) {
2360 Standard_Integer stat = G.Status(i);
2361 if ( (stat > 0 && newcount < 0) || stat == newcount)
2362 iter.GetOneItem(G.Entity(i));
2368 //=======================================================================
2371 //=======================================================================
2373 Standard_Integer IFSelect_WorkSession::MaxSendingCount () const
2375 Standard_Integer newcount = 0;
2376 if (!IsLoaded()) return newcount;
2377 const Interface_Graph& G = thegraph->Graph();
2378 Standard_Integer nb = G.Size();
2380 for (i = 1; i <= nb; i ++) {
2381 Standard_Integer stat = G.Status(i);
2382 if (stat > newcount) newcount = stat;
2388 //=======================================================================
2391 //=======================================================================
2393 Standard_Boolean IFSelect_WorkSession::SetRemaining
2394 (const IFSelect_RemainMode mode)
2396 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2397 if (!IsLoaded()) return Standard_False;
2398 if (mode == IFSelect_RemainForget) {
2399 Standard_Integer nb = thegraph->Graph().Size();
2400 for (Standard_Integer i = 1; i <= nb; i ++)
2401 thegraph->CGraph().SetStatus (i,0);
2403 return Standard_True;
2404 } else if (mode == IFSelect_RemainCompute) {
2405 Handle(Interface_InterfaceModel) newmod;
2406 Interface_CopyTool TC(themodel,theprotocol);
2407 thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod);
2408 if (newmod.IsNull()) {
2409 sout<<" No Remaining Data recorded"<<endl; return Standard_False;
2410 } else if (newmod == themodel) {
2411 sout<<" Remaining causes all original data to be kept"<<endl;
2412 thecopier->SetRemaining (thegraph->CGraph());
2413 return Standard_False;
2415 theoldel = themodel;
2416 SetModel(newmod,Standard_False);
2417 // MISE A JOUR des SelectPointed
2418 Handle(TColStd_HSequenceOfInteger) list =
2419 ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed));
2420 Standard_Integer nb = list->Length();
2421 for (Standard_Integer i = 1; i <= nb; i ++) {
2422 DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
2423 sp->Update(TC.Control());
2425 return Standard_True;
2427 } else if (mode == IFSelect_RemainDisplay) {
2428 Standard_Integer ne = 0;
2429 Standard_Integer nb = thegraph->Graph().Size();
2430 for (Standard_Integer i = 1; i <= nb; i ++)
2431 { if (thegraph->Graph().Status(i) >= 0) ne ++; }
2433 sout<<" - All entities are remaining, none yet sent"<<endl; return Standard_True;
2435 Interface_EntityIterator iter = SentList(0);
2436 nb = iter.NbEntities();
2438 sout<<" - No recorded remaining entities"<<endl; return Standard_True;
2440 sout <<" -- Recorded Remaining (not yet sent) Entities --"<<endl;
2441 ListEntities(iter,2);
2442 sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
2443 MaxSendingCount() << endl;
2446 sout<< " - Now, dispatches are deactivated"<<endl;
2447 nb = theshareout->NbDispatches();
2448 for (Standard_Integer i = nb; i > theshareout->LastRun(); i --)
2449 theshareout->RemoveDispatch(i);
2451 return Standard_True;
2452 } else if (mode == IFSelect_RemainUndo) {
2453 if (theoldel.IsNull()) return Standard_False;
2454 SetModel(theoldel); theoldel.Nullify();
2455 return Standard_True;
2457 else return Standard_False;
2461 //=======================================================================
2464 //=======================================================================
2466 IFSelect_ReturnStatus IFSelect_WorkSession::SendAll
2467 (const Standard_CString filename, const Standard_Boolean computegraph)
2470 Interface_CheckIterator checks;
2471 if (!IsLoaded()) return IFSelect_RetVoid;
2472 if (thelibrary.IsNull()) {
2473 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2474 thecheckrun = checks;
2475 return IFSelect_RetError;
2479 errhand = Standard_False;
2482 ComputeGraph(computegraph);
2483 checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2485 catch (Standard_Failure) {
2486 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2487 sout<<" **** Interruption SendAll par Exception : ****\n";
2488 sout<<Standard_Failure::Caught()->GetMessageString();
2489 sout<<"\n Abandon"<<endl;
2490 errhand = theerrhand;
2491 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2492 thecheckrun = checks;
2493 return IFSelect_RetFail;
2496 else checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol);
2497 Handle(Interface_Check) aMainFail = checks.CCheck(0);
2498 if (!aMainFail.IsNull() && aMainFail->HasFailed ())
2500 return IFSelect_RetStop;
2502 if (theloaded.Length() == 0) theloaded.AssignCat(filename);
2503 thecheckrun = checks;
2504 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2505 return IFSelect_RetError;
2509 //=======================================================================
2512 //=======================================================================
2514 IFSelect_ReturnStatus IFSelect_WorkSession::SendSelected
2515 (const Standard_CString filename,
2516 const Handle(IFSelect_Selection)& sel,
2517 const Standard_Boolean computegraph)
2520 if (!IsLoaded()) return IFSelect_RetVoid;
2521 Interface_CheckIterator checks;
2522 if (thelibrary.IsNull()) {
2523 checks.CCheck(0)->AddFail("WorkLibrary undefined");
2524 thecheckrun = checks;
2525 return IFSelect_RetVoid;
2529 errhand = Standard_False;
2532 ComputeGraph(computegraph);
2533 return SendSelected (filename,sel); // appel normal
2535 catch (Standard_Failure) {
2536 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2537 sout<<" **** Interruption SendSelected par Exception : ****\n";
2538 sout<<Standard_Failure::Caught()->GetMessageString();
2539 sout<<"\n Abandon"<<endl;
2540 checks.CCheck(0)->AddFail ("Exception Raised -> Abandon");
2541 errhand = theerrhand;
2542 thecheckrun = checks;
2543 return IFSelect_RetFail;
2546 // if (ItemIdent(sel) == 0) return 3;
2547 Interface_EntityIterator iter = sel->UniqueResult(thegraph->Graph());
2548 if (iter.NbEntities() == 0) return IFSelect_RetVoid;
2550 checks = thecopier->SendSelected
2551 (filename,thegraph->Graph(),thelibrary,theprotocol,iter);
2552 thecopier->SetRemaining (thegraph->CGraph());
2553 thecheckrun = checks;
2554 if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone;
2555 return IFSelect_RetError;
2559 //=======================================================================
2562 //=======================================================================
2564 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2565 (const Standard_CString filename)
2567 if (WorkLibrary().IsNull()) return IFSelect_RetVoid;
2568 ComputeGraph(Standard_True);
2569 if (!IsLoaded()) return IFSelect_RetVoid;
2570 return SendAll (filename);
2574 //=======================================================================
2577 //=======================================================================
2579 IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile
2580 (const Standard_CString filename, const Handle(IFSelect_Selection)& sel)
2582 if (WorkLibrary().IsNull() || sel.IsNull()) return IFSelect_RetVoid;
2583 ComputeGraph(Standard_True);
2584 if (!IsLoaded()) return IFSelect_RetVoid;
2585 return SendSelected (filename,sel);
2588 // ################################################################
2589 // .... Actions particulieres sur les Selections ....
2591 //=======================================================================
2594 //=======================================================================
2596 Standard_Integer IFSelect_WorkSession::NbSources
2597 (const Handle(IFSelect_Selection)& sel) const
2599 if (ItemIdent(sel) == 0) return 0;
2600 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ||
2601 sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) return 1;
2602 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) return 2;
2603 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) return
2604 GetCasted(IFSelect_SelectCombine,sel)->NbInputs();
2609 //=======================================================================
2612 //=======================================================================
2614 Handle(IFSelect_Selection) IFSelect_WorkSession::Source
2615 (const Handle(IFSelect_Selection)& sel, const Standard_Integer num) const
2617 Handle(IFSelect_Selection) sr;
2618 if (ItemIdent(sel) == 0) return sr;
2619 if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ) sr =
2620 GetCasted(IFSelect_SelectExtract,sel)->Input();
2621 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) sr =
2622 GetCasted(IFSelect_SelectDeduct,sel)->Input();
2623 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) {
2624 if (num == 1) sr = GetCasted(IFSelect_SelectControl,sel)->MainInput();
2625 else if (num == 2) sr = GetCasted(IFSelect_SelectControl,sel)->SecondInput();
2627 else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) sr =
2628 GetCasted(IFSelect_SelectCombine,sel)->Input(num);
2633 //=======================================================================
2636 //=======================================================================
2638 Standard_Boolean IFSelect_WorkSession::IsReversedSelectExtract
2639 (const Handle(IFSelect_Selection)& sel) const
2641 if (ItemIdent(sel) == 0) return Standard_False;
2642 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2643 if (sxt.IsNull()) return Standard_False;
2644 return (!sxt->IsDirect());
2648 //=======================================================================
2651 //=======================================================================
2653 Standard_Boolean IFSelect_WorkSession::ToggleSelectExtract
2654 (const Handle(IFSelect_Selection)& sel)
2656 if (ItemIdent(sel) == 0) return Standard_False;
2657 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2658 if (sxt.IsNull()) return Standard_False;
2659 sxt->SetDirect(!sxt->IsDirect());
2660 return Standard_True;
2664 //=======================================================================
2667 //=======================================================================
2669 Standard_Boolean IFSelect_WorkSession::SetInputSelection
2670 (const Handle(IFSelect_Selection)& sel,
2671 const Handle(IFSelect_Selection)& inp)
2673 if (ItemIdent(sel) == 0) return Standard_False;
2674 if (!inp.IsNull() && ItemIdent(inp) == 0) return Standard_False;
2675 DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
2676 if (!sxt.IsNull()) { sxt->SetInput(inp); return Standard_True; }
2677 DeclareAndCast(IFSelect_SelectDeduct,sdt,sel);
2678 if (!sdt.IsNull()) { sdt->SetInput(inp); return Standard_True; }
2679 return Standard_False;
2683 //=======================================================================
2686 //=======================================================================
2688 Standard_Boolean IFSelect_WorkSession::SetControl
2689 (const Handle(IFSelect_Selection)& sel,
2690 const Handle(IFSelect_Selection)& sc,
2691 const Standard_Boolean formain)
2693 DeclareAndCast(IFSelect_SelectControl,dsel,sel);
2694 if (ItemIdent(dsel) == 0) return Standard_False;
2695 if (ItemIdent(sc) == 0) return Standard_False;
2696 if (formain) dsel->SetMainInput (sc);
2697 else dsel->SetSecondInput (sc);
2698 return Standard_True;
2702 //=======================================================================
2705 //=======================================================================
2707 Standard_Integer IFSelect_WorkSession::CombineAdd
2708 (const Handle(IFSelect_Selection)& sel,
2709 const Handle(IFSelect_Selection)& seladd,
2710 const Standard_Integer atnum)
2712 DeclareAndCast(IFSelect_SelectCombine,csel,sel);
2713 if (ItemIdent(csel) == 0) return 0;
2714 if (ItemIdent(seladd) == 0) return 0;
2715 csel->Add (seladd,atnum);
2716 return csel->NbInputs();
2720 //=======================================================================
2723 //=======================================================================
2725 Standard_Boolean IFSelect_WorkSession::CombineRemove
2726 (const Handle(IFSelect_Selection)& selcomb,
2727 const Handle(IFSelect_Selection)& selrem)
2729 DeclareAndCast(IFSelect_SelectCombine,csel,selcomb);
2730 if (ItemIdent(csel) == 0) return Standard_False;
2731 if (ItemIdent(selrem) == 0) return Standard_False;
2732 Standard_Integer nb = csel->NbInputs();
2733 for (Standard_Integer i = nb; i > 0; i --) {
2734 if (csel->Input(i) == selrem) {
2736 return Standard_True;
2739 return Standard_True;
2743 //=======================================================================
2746 //=======================================================================
2748 Handle(IFSelect_Selection) IFSelect_WorkSession::NewSelectPointed
2749 (const Handle(TColStd_HSequenceOfTransient)& list,
2750 const Standard_CString name)
2752 Handle(IFSelect_SelectPointed) sel = new IFSelect_SelectPointed;
2753 if (!list.IsNull()) sel->AddList (list);
2754 if (AddNamedItem (name,sel) == 0) sel.Nullify();
2759 //=======================================================================
2762 //=======================================================================
2764 Standard_Boolean IFSelect_WorkSession::SetSelectPointed
2765 (const Handle(IFSelect_Selection)& sel,
2766 const Handle(TColStd_HSequenceOfTransient)& list,
2767 const Standard_Integer mode) const
2769 DeclareAndCast(IFSelect_SelectPointed,sp,sel);
2770 if (sp.IsNull() || list.IsNull()) return Standard_False;
2771 if (mode == 0) sp->Clear();
2772 if (mode >= 0) sp->AddList(list);
2773 else sp->RemoveList(list);
2774 return Standard_True;
2778 // ###########################################################################
2779 // .... Analyse d un CheckIterator par rapport a un graphe ....
2781 //=======================================================================
2784 //=======================================================================
2786 static void IFSelect_QueryProp (Interface_IntList& list,
2787 TCollection_AsciiString& ana,
2788 const Standard_Integer num, const int quoi)
2790 list.SetNumber(num);
2791 Standard_Integer i, nb = list.Length();
2792 for (i = 1; i <= nb; i ++) {
2793 if (i > 1) list.SetNumber(num); // because recursive call + depth first
2794 Standard_Integer n = list.Value(i);
2795 // y a t il lieu de propager ?
2796 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2797 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2798 char val = ana.Value(n);
2800 case ' ' : val = (quoi ? '3' : '6'); break;
2801 case '1' : val = (quoi ? '4' : '7'); break;
2802 case '2' : val = (quoi ? '5' : '8'); break;
2803 case '3' : val = (quoi ? ' ' : '6'); break;
2804 case '4' : val = (quoi ? ' ' : '7'); break;
2805 case '5' : val = (quoi ? ' ' : '8'); break;
2806 case '6' : val = ' '; break;
2807 case '7' : val = ' '; break;
2808 case '8' : val = ' '; break;
2809 default : val = ' '; break;
2811 if (val == ' ') continue;
2812 ana.SetValue(n,val);
2813 IFSelect_QueryProp (list,ana,n,quoi);
2818 //=======================================================================
2821 //=======================================================================
2823 void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
2825 if (!IsLoaded()) return;
2826 Standard_Integer i,nb = themodel->NbEntities();
2827 thecheckana = TCollection_AsciiString (nb+1,' ');
2828 for (chl.Start(); chl.More(); chl.Next()) {
2829 Standard_Integer num = chl.Number();
2830 const Handle(Interface_Check) ach = chl.Value();
2831 if (ach->HasFailed()) thecheckana.SetValue(num,'2');
2832 else if (ach->HasWarnings()) thecheckana.SetValue(num,'1');
2834 // analyse selon le graphe ... codes : blc = rien
2835 // 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place
2836 // 6 Fprop 7 Fprop+W/place 8 Fprop+F/place
2837 Interface_IntList list;// = thegraph->Graph().SharingNums(0);
2838 // deux passes : d abord Warning, puis Fail
2839 for (i = 1; i <= nb; i ++) {
2840 char val = thecheckana.Value(i);
2842 if (val == '1' || val == '4' || val == '7') quoi = 0;
2843 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2845 for (i = 1; i <= nb; i ++) {
2846 char val = thecheckana.Value(i);
2848 if (val == '2' || val == '5' || val == '8') quoi = 1;
2849 if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi);
2854 //=======================================================================
2857 //=======================================================================
2859 Standard_Integer IFSelect_WorkSession::QueryCheckStatus
2860 (const Handle(Standard_Transient)& ent) const
2862 if (!IsLoaded()) return -1;
2863 Standard_Integer num = themodel->Number(ent);
2864 if (num == 0) return -1;
2865 if (thecheckana.Length() < num) return -1;
2866 Standard_Character val = thecheckana.Value (num);
2867 // codes : blc = rien -> 0
2868 // 1 W/place -> 1 2 F/place -> 2
2869 // 3 Wprop -> 10 4 Wprop+W/place -> 11 5 Wprop+F/place -> 12
2870 // 6 Fprop -> 20 7 Fprop+W/place -> 21 8 Fprop+F/place -> 22
2871 if (val == ' ') return 0;
2872 if (val == '1') return 1;
2873 if (val == '2') return 2;
2874 if (val == '3') return 10;
2875 if (val == '4') return 11;
2876 if (val == '5') return 12;
2877 if (val == '6') return 20;
2878 if (val == '7') return 21;
2879 if (val == '8') return 22;
2884 //=======================================================================
2887 //=======================================================================
2889 Standard_Integer IFSelect_WorkSession::QueryParent
2890 (const Handle(Standard_Transient)& entdad,
2891 const Handle(Standard_Transient)& entson) const
2893 Standard_Integer ndad = StartingNumber(entdad);
2894 Standard_Integer nson = StartingNumber(entson);
2895 if (ndad < 1 || nson < 1) return -1;
2896 if (ndad == nson) return 0;
2897 // on va calculer : pour chaque pere immediat, de <son>, status avec <dad> + 1
2898 // nb : pas protege contre les boucles ...
2899 Handle(TColStd_HSequenceOfTransient) list =
2900 thegraph->Graph().Sharings(entson).Content();
2901 if (list.IsNull()) return -1;
2902 Standard_Integer i, nb = list->Length();
2903 for (i = 1; i <= nb; i ++) {
2904 if (list->Value(i) == entdad) return 1;
2905 Standard_Integer stat = QueryParent ( entdad,list->Value(i) );
2906 if (stat >= 0) return stat+1;
2908 return -1; // not yet implemented ...
2911 // ###########################################################################
2912 // .... Dumps et Evaluations, pas faciles a passer en arguments ....
2914 // #### #### #### #### #### #### #### #### ####
2915 // .... DumpShare ....
2917 //=======================================================================
2920 //=======================================================================
2922 void IFSelect_WorkSession::SetParams
2923 (const TColStd_SequenceOfTransient& params,
2924 const TColStd_SequenceOfInteger& uselist)
2926 Standard_Integer i, nbp = params.Length(), nbu = uselist.Length();
2927 Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor
2928 (nbp+nbu+50,"Parameter Editor");
2929 for (i = 1; i <= nbp; i ++) {
2930 DeclareAndCast(Interface_TypedValue,val,params.Value(i));
2931 if (val.IsNull()) continue;
2932 editor->AddValue(val);
2934 AddNamedItem("xst-params-edit",editor);
2936 Handle(IFSelect_EditForm) paramsall = editor->Form(Standard_False);
2937 AddNamedItem("xst-params-all",paramsall);
2939 // On attaque les EditForms partielles
2940 TColStd_SequenceOfInteger listgen,listload,listsend,listsplit,listread,listwrite;
2941 for (i = 1; i <= nbu; i ++) {
2942 Standard_Integer use = uselist.Value(i);
2944 case 1 : listgen.Append(i); break;
2945 case 2 : listread.Append(i); break;
2946 case 3 : listsend.Append(i); break;
2947 case 4 : listsplit.Append(i); break;
2948 case 5 : listread.Append(i); break;
2949 case 6 : listwrite.Append(i); break;
2953 Handle(IFSelect_EditForm) paramsgen = new IFSelect_EditForm
2954 (editor,listgen ,Standard_False,Standard_True,"General Parameters");
2955 if (listgen.Length() > 0) AddNamedItem("xst-params-general",paramsgen);
2956 Handle(IFSelect_EditForm) paramsload = new IFSelect_EditForm
2957 (editor,listload,Standard_False,Standard_True,"Loading Parameters");
2958 if (listload.Length() > 0) AddNamedItem("xst-params-load", paramsload);
2959 Handle(IFSelect_EditForm) paramssend = new IFSelect_EditForm
2960 (editor,listsend,Standard_False,Standard_True,"Sending Parameters");
2961 if (listsend.Length() > 0) AddNamedItem("xst-params-send", paramssend);
2962 Handle(IFSelect_EditForm) paramsplit = new IFSelect_EditForm
2963 (editor,listsplit,Standard_False,Standard_True,"Split Parameters");
2964 if (listsplit.Length() > 0) AddNamedItem("xst-params-split", paramsplit);
2965 Handle(IFSelect_EditForm) paramsread = new IFSelect_EditForm
2966 (editor,listread,Standard_False,Standard_True,"Read(Transfer) Parameters");
2967 if (listread.Length() > 0) AddNamedItem("xst-params-read", paramsread);
2968 Handle(IFSelect_EditForm) paramswrite = new IFSelect_EditForm
2969 (editor,listwrite,Standard_False,Standard_True,"Write(Transfer) Parameters");
2970 if (listwrite.Length() > 0) AddNamedItem("xst-params-write", paramswrite);
2974 //=======================================================================
2977 //=======================================================================
2979 void IFSelect_WorkSession::TraceStatics
2980 (const Standard_Integer use, const Standard_Integer mode) const
2982 Handle(Message_Messenger) sout = Message::DefaultMessenger();
2984 if (mode == 0) sout<<"******************************************"<<endl;
2986 if (mode == 0) sout<<"***** General Parameters *****"<<endl;
2987 } else if (use == 2) {
2988 if (mode == 0) sout<<"***** Load File *****"<<endl;
2989 } else if (use == 3) {
2990 if (mode == 0) sout<<"***** Write File *****"<<endl;
2991 } else if (use == 4) {
2992 if (mode == 0) sout<<"***** Split File *****"<<endl;
2993 } else if (use == 5) {
2994 if (mode == 0) sout<<"***** Transfer (Read) *****"<<endl;
2995 } else if (use == 6) {
2996 if (mode == 0) sout<<"***** Transfer (Write) *****"<<endl;
2998 if (mode == 0) sout<<"******************************************"<<endl<<endl;
3001 // Echainements particuliers (use > 0)
3003 TraceStatics (-2,mode);
3004 if (mode == 0) sout<<endl;
3005 } else if (use == 4 || use == 6) {
3006 TraceStatics (-3,mode);
3007 if (mode == 0) sout<<endl;
3010 // Valeurs particulieres
3011 if (use == 1 || use == -1) { // General : trace
3013 // sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<endl;
3015 } else if (use == 4 || use == -4) { // Split : Prefix & cie
3017 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3018 if (!str.IsNull()) sout << "Prefix : "<<str->ToCString()<<endl;
3019 else sout << "Prefix not Defined" << endl;
3020 str = theshareout->DefaultRootName();
3021 if (!str.IsNull()) sout << "Default Root : "<<str->ToCString()<<endl;
3022 else sout << "Default Root not Defined" << endl;
3023 str = theshareout->Extension();
3024 if (!str.IsNull()) sout << "Extension : "<<str->ToCString()<<endl;
3025 else sout << "Extension not defined" << endl;
3029 // LISTER LES STATICS
3030 // Passer par les ParamEditor ...
3034 if (mode == 0) sout<<"******************************************"<<endl<<endl;
3039 //=======================================================================
3042 //=======================================================================
3044 void IFSelect_WorkSession::DumpShare () const
3046 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3047 sout<<" ********** Definition ShareOut (Complete) **********"<<endl;
3049 Handle(TCollection_HAsciiString) str = theshareout->Prefix();
3050 if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << endl;
3051 else sout << "Prefix not Defined" << endl;
3052 str = theshareout->DefaultRootName();
3053 if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << endl;
3054 else sout << "Default Root not Defined" << endl;
3055 str = theshareout->Extension();
3056 if (!str.IsNull()) sout << "Extension : " << str->ToCString() << endl;
3057 else sout << "Extension not defined" << endl;
3059 Standard_Integer lr = theshareout->LastRun();
3060 Standard_Integer nb = theshareout->NbDispatches();
3061 sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<<endl;
3062 for (Standard_Integer i = 1; i <= nb; i ++) {
3063 Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i);
3064 sout << "Dispatch n0 " << i;
3065 if (HasName(disp)) sout << " Name:"<< Name(disp)->ToCString();
3066 sout << " Label:" << disp->Label() << endl;
3067 Handle(IFSelect_Selection) sel = disp->FinalSelection();
3068 if (sel.IsNull()) sout << " No Final Selection Defined" << endl;
3069 else if (HasName(sel)) sout << " Final Selection : Name:"
3070 << Name(sel)->ToCString() << " Label:" << sel->Label() << endl;
3071 else sout << " Final Selection : " << sel->Label() << endl;
3072 if (disp->HasRootName())
3073 sout<<" File Root Name : "<<disp->RootName()->ToCString()<<endl;
3074 else sout<<" No specific file root name (see Default Root)"<<endl;
3076 Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
3078 " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<endl;
3079 Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
3081 " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<endl;
3082 if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<endl;
3085 // #### #### #### #### #### #### #### #### ####
3086 // .... ListItems ....
3088 //=======================================================================
3091 //=======================================================================
3093 void IFSelect_WorkSession::ListItems (const Standard_CString lab) const
3095 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3096 sout<< " ********** Items in Session **********"<<endl;
3097 Standard_Integer nb = MaxIdent();
3098 Handle(TCollection_HAsciiString) str;
3099 if (lab[0] != '\0') str = new TCollection_HAsciiString (lab);
3100 for (Standard_Integer i = 1; i <= nb; i ++) {
3101 const Handle(Standard_Transient)& var = theitems.FindKey(i);
3102 Handle(TCollection_HAsciiString) label = ItemLabel(i);
3103 if (label.IsNull()) continue; // -> item supprime
3104 if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; }
3106 if (HasName(var)) sout<<" - Named : "<<Name(var)->ToCString()<<" - ";
3107 else sout<<" - (no name) - ";
3108 sout<<var->DynamicType()->Name()<<endl<<" "<<label->ToCString()<<endl;
3112 // #### #### #### #### #### #### #### #### ####
3113 // .... ListModifiers
3115 //=======================================================================
3118 //=======================================================================
3120 void IFSelect_WorkSession::ListFinalModifiers
3121 (const Standard_Boolean formodel) const
3123 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3124 Standard_Integer nb = theshareout->NbModifiers(formodel);
3125 sout<< " ********** Modifiers in Session ";
3126 sout<<(formodel ? "(For Model)" : "(For File)");
3127 sout<<": "<<nb<<" **********"<<endl;
3128 for (Standard_Integer i = 1; i <= nb; i ++) {
3129 Handle(IFSelect_GeneralModifier) modif =
3130 theshareout->GeneralModifier(formodel,i);
3131 if (!modif.IsNull()) sout<<"Modifier n0."<<i<<" : "<<modif->Label();
3132 if (HasName(modif)) sout << " Named as : " << Name(modif)->ToCString();
3137 // #### #### #### #### #### #### #### #### ####
3138 // .... DumpSelection ....
3140 //=======================================================================
3143 //=======================================================================
3145 void IFSelect_WorkSession::DumpSelection
3146 (const Handle(IFSelect_Selection)& sel) const
3148 Handle(Message_Messenger) sout = Message::DefaultMessenger();
3149 if (ItemIdent(sel) == 0) {
3150 sout << "Selection : "<<" Unknown"<<endl; //sout<<Handle
3153 sout << " ********** Selection";
3154 if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
3155 sout <<" **********"<<endl;
3156 sout<< "Label : " << sel->Label() << " . Input(s) : "<< endl;
3157 Standard_Integer nb = 0;
3158 IFSelect_SelectionIterator iter; sel->FillIterator(iter);
3159 for (; iter.More(); iter.Next()) {
3161 Handle(IFSelect_Selection) newsel = iter.Value();
3162 sout<<" -- "<<newsel->Label()<<endl;
3164 sout << " Nb Inputs:"<<nb<<endl;
3168 // ##########################################
3169 // ######### Fonctions complementaires
3170 // ##########################################
3172 // #### #### #### #### #### #### #### #### ####
3173 // .... DumpModel ....
3175 //=======================================================================
3178 //=======================================================================
3180 Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
3181 (const Standard_CString selname) const
3184 Standard_Integer np = -1, nf = -1, nivp = 0;
3185 for (Standard_Integer n = 0; selname[n] != '\0'; n ++) {
3186 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3187 if (selname[n] == '(') { np = n; nivp ++; }
3188 if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3189 //// if (selname[n] == ' ') { nb = n; break; }
3192 Handle(IFSelect_Selection) sel;
3193 if (np >= 0) nomsel[np] = 0; if (nf >= 0) nomsel[nf] = '\0';
3194 Handle(Standard_Transient) item = NamedItem(nomsel);
3196 // Parentheses ? essayer Signature (plus tard : Selection parametree)
3197 // NB : on compte les niveaux de parentheses (imbrications repercutees)
3198 if (np > 0 && nf > 0) {
3199 Handle(IFSelect_SelectSignature) selsign;
3200 Standard_Integer debsign = np+1;
3202 DeclareAndCast(IFSelect_Signature,sign,item);
3203 DeclareAndCast(IFSelect_SignCounter,cnt,item);
3204 if (!sign.IsNull()) selsign =
3205 new IFSelect_SelectSignature (sign,&nomsel[debsign],Standard_False);
3206 else if (!cnt.IsNull()) selsign =
3207 new IFSelect_SelectSignature (cnt,&nomsel[debsign],Standard_False);
3209 cout<<selname<<" : neither Signature nor Counter"<<endl;
3213 selsign->SetInput (new IFSelect_SelectModelEntities); // par defaut
3217 else sel = GetCasted(IFSelect_Selection,item);
3223 //=======================================================================
3226 //=======================================================================
3228 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3229 (const Handle(Standard_Transient)& obj) const
3232 DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
3233 if (!list.IsNull()) return list;
3235 // Rien du tout : retourne rien du tout
3236 if (obj.IsNull()) return list;
3238 // Une selection : son resultat (standard)
3239 DeclareAndCast(IFSelect_Selection,sel,obj);
3240 if (!sel.IsNull()) {
3241 Interface_EntityIterator iter = EvalSelection(sel);
3242 return iter.Content();
3245 // Le modele : son contenu
3246 list = new TColStd_HSequenceOfTransient();
3247 if (obj == themodel) {
3248 Standard_Integer i, nb = themodel->NbEntities();
3249 for (i = 1; i <= nb; i ++) list->Append (themodel->Value(i));
3252 // Une entite du modele : cette entite
3253 else if (StartingNumber(obj) > 0) list->Append (obj);
3255 // Un Texte : son interpretation
3257 DeclareAndCast(TCollection_HAsciiString,str,obj);
3258 if (!str.IsNull()) return GiveList (str->ToCString());
3261 // Si c est pas tout ca : une liste vide
3266 //=======================================================================
3269 //=======================================================================
3271 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
3272 (const Standard_CString first, const Standard_CString second) const
3274 Handle(TColStd_HSequenceOfTransient) list;
3275 if (!first || first[0] == '\0') return list;
3276 if (first[0] == ' ') return GiveList (&first[1],second);
3277 if (second && second[0] == ' ') return GiveList (first,&second[1]);
3279 // list NULLE sera interpretee comme SelectionResult (selection toute crue)
3280 // sinon comme SelectionResultFromList
3281 if (second && second[0] != '\0') list = GiveList (second,"");
3283 list = GiveListFromList (first,list);
3288 //=======================================================================
3291 //=======================================================================
3293 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
3294 (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
3296 Handle(TColStd_HSequenceOfTransient) list;
3297 Standard_Integer num;
3299 // LISTE DEFINIE D OFFICE (en ce cas, la liste d entree est ignoree)
3300 if (selname[0] == '(') {
3301 // liste d entites donnees a la queue leu leu : (ID,ID,ID...)
3302 char entid[50]; Standard_Integer i,j = 0;
3303 TColStd_MapOfInteger numap;
3304 list = new TColStd_HSequenceOfTransient();
3305 for (i = 1; selname[i] != '\0'; i ++) {
3306 if (selname[i] == ' ') continue;
3307 if (selname[i] == ',' || selname[i] == ')') {
3309 if (j == 0) continue; j = 0;
3310 num = NumberFromLabel (entid);
3311 if (num <= 0 || !numap.Add (num)) continue;
3312 Handle(Standard_Transient) anent = StartingEntity(num);
3313 if (!anent.IsNull()) list->Append (anent);
3314 if (selname[i] == ')') break;
3317 entid[j] = selname[i]; j ++;
3321 num = NumberFromLabel (selname);
3322 if (num > 0) return GiveList(StartingEntity(num));
3324 // Autres cas : y atil une liste d entree.
3325 // Si OUI -> SelectionResultFromList. Si NON -> SelectionResult
3326 // Si une entite isolee -> on en fait une liste
3328 list = GiveList(ent); // ent NULL -> list NULL sinon intreprete
3330 // Decomposition term1 term2 ...
3332 char nomsel[500]; nomsel[0] = '\0';
3333 Standard_Integer n= 0 , nb = -1;
3334 for (n = 0; selname[n] != '\0'; n ++) {
3335 nomsel[n] = selname[n]; nomsel[n+1] = '\0';
3336 // if (selname[n] == '(') { np = n; nivp ++; }
3337 // if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
3338 if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
3340 if (nomsel[0] == '\0') return list;
3342 Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
3344 cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<endl;
3348 if (nb > 0) list = GiveListFromList (&selname[nb+1],list);
3350 if (list.IsNull()) list = SelectionResult (sel);
3351 else list = SelectionResultFromList (sel,list);
3357 //=======================================================================
3360 //=======================================================================
3362 Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
3363 (const Handle(TColStd_HSequenceOfTransient)& l1,
3364 const Handle(TColStd_HSequenceOfTransient)& l2,
3365 const Standard_Integer mode) const
3367 Handle(TColStd_HSequenceOfTransient) list;
3368 if (l1.IsNull() || l2.IsNull()) return list;
3370 // mode < 0 l1-l2 = 0 l1&l2 > 0 l1|l2 (l1+l2)
3371 TColStd_MapOfTransient numap;
3372 Standard_Integer i,n = l2->Length();
3373 for (i = n; i > 0; i --) {
3374 Handle(Standard_Transient) ent = l2->Value(i);
3375 if (ent.IsNull()) continue;
3377 if (mode > 0) list->Append(ent);
3380 // ents de l1 pas deja dans l2
3382 for (i = n; i > 0; i --) {
3383 Handle(Standard_Transient) ent = l1->Value(i);
3384 if (ent.IsNull()) continue;
3386 if (numap.Contains(ent)) {
3387 // dans l1 et dans l2
3388 if (mode == 0) list->Append(ent);
3390 // dans l1 mais pas dans l2
3391 if (mode != 0) list->Append(ent);
3400 //=======================================================================
3403 //=======================================================================
3405 void IFSelect_WorkSession::DumpModel
3406 (const Standard_Integer level, const Handle(Message_Messenger)& S)
3409 { S<< " *** Data for List not available ***"<<endl; return; }
3410 S << "\n *****************************************************************\n";
3411 if (theloaded.Length() > 0)
3412 S << " ******** Loaded File : "<<theloaded.ToCString()<<Interface_MSG::Blanks(32-theloaded.Length())<<" ********"<<endl;
3413 else S << " ******** No name for Loaded File"<<endl;
3415 S<<" ******** Short Dump of Header ********"<<"\n";
3416 S << " *****************************************************************\n\n";
3417 themodel->DumpHeader(S); S<<endl;
3420 Standard_Integer nbent = themodel->NbEntities();
3421 Standard_Integer nbr = 0;
3422 Interface_ShareFlags shar(thegraph->Graph());
3424 for (Standard_Integer i = 1; i <= nbent; i ++) {
3425 if (!shar.IsShared(themodel->Value(i))) nbr ++;
3427 S << " *****************************************************************\n";
3428 S << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<"\n";
3429 S << " *****************************************************************\n"<<endl;
3431 if (level <= 0) return;
3432 else if (level == 1) {
3433 S<<" ******** Root Entities ******** ";
3434 ListEntities (shar.RootEntities(),1);
3435 } else if (level == 2) {
3436 S<<" ******** Complete List ******** ";
3437 ListEntities (themodel->Entities(),1);
3438 } else if (level > 2) {
3439 IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
3440 if (level == 5 || level == 8) mode = IFSelect_CountByItem;
3441 if (level == 6 || level == 9) mode = IFSelect_ListByItem;
3442 if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
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;