0027349: XtControl_Reader is not thread-safe

Support of profiles for norms is removed
Getting rid of thread-unsafe static variables.
Sequence is not thread-safe. Replacing it with Vector.
Updating samples due to previous changes.
Resolving conflict with system environment.
This commit is contained in:
anv
2016-04-22 13:51:24 +03:00
committed by bugmaster
parent 299e0ab98f
commit 7f56eba8cd
49 changed files with 1352 additions and 4214 deletions
-48
View File
@@ -17,10 +17,7 @@
#include <IFSelect_Activator.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <Interface_Macros.hxx>
#include <MoniTool_Option.hxx>
#include <MoniTool_Profile.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfInteger.hxx>
@@ -32,8 +29,6 @@ static Handle(Dico_DictionaryOfInteger) thedico; // = new Dico_DictionaryOfInteg
static TColStd_SequenceOfInteger thenums, themodes;
static TColStd_SequenceOfTransient theacts;
static Handle(MoniTool_Profile) thealiases;
void IFSelect_Activator::Adding
(const Handle(IFSelect_Activator)& actor,
@@ -67,49 +62,6 @@ static Handle(MoniTool_Profile) thealiases;
void IFSelect_Activator::Remove (const Standard_CString command)
{ thedico->RemoveItem(command); }
// ALIAS : gere avec un Profile
// Chaque commande est representee par une Option
// Au sein de laquelle chaque configuration nomme un cas, dont la valeur
// est le nom de son alias pour cette conf
// Et chaque conf porte un switch sur cette option avec pour valeur le propre
// nom de la conf
void IFSelect_Activator::SetAlias
(const Standard_CString conf,
const Standard_CString command, const Standard_CString alias)
{
if (thealiases.IsNull()) thealiases = new MoniTool_Profile;
Handle(MoniTool_Option) opt = thealiases->Option(command);
if (opt.IsNull()) {
opt = new MoniTool_Option(STANDARD_TYPE(TCollection_HAsciiString),command);
thealiases->AddOption (opt);
}
opt->Add (conf,new TCollection_HAsciiString(alias));
if (!thealiases->HasConf(conf)) thealiases->AddConf (conf);
thealiases->AddSwitch (conf,command,conf);
}
void IFSelect_Activator::SetCurrentAlias (const Standard_CString conf)
{
if (!thealiases.IsNull()) thealiases->SetCurrent (conf);
}
TCollection_AsciiString IFSelect_Activator::Alias
(const Standard_CString command)
{
TCollection_AsciiString str;
if (thealiases.IsNull()) return str;
Handle(Standard_Transient) aVal;
if (!thealiases->Value(command,aVal)) return str;
Handle(TCollection_HAsciiString) val =
Handle(TCollection_HAsciiString)::DownCast (aVal);
if (!val.IsNull())
str.AssignCat (val->ToCString());
return str;
}
Standard_Boolean IFSelect_Activator::Select
(const Standard_CString command, Standard_Integer& number,
Handle(IFSelect_Activator)& actor)
-15
View File
@@ -81,21 +81,6 @@ public:
//! Removes a Command, if it is recorded (else, does nothing)
Standard_EXPORT static void Remove (const Standard_CString command);
//! Records, for a configuration named <conf>, that the command
//! <command> may be aliased by another command <alias>
//!
//! To be used by call to Alias (no automatic redirection)
//! The configuration typically refers to a norm
Standard_EXPORT static void SetAlias (const Standard_CString conf, const Standard_CString command, const Standard_CString aliasname);
//! Sets <conf> as current configuration for aliases
Standard_EXPORT static void SetCurrentAlias (const Standard_CString conf);
//! Returns, in the current configuration, what alias has been
//! recorded for <command>
//! The returned string is empty if no alias is recorded
Standard_EXPORT static TCollection_AsciiString Alias (const Standard_CString command);
//! Selects, for a Command given by its title, an actor with its
//! command number. Returns True if found, False else
Standard_EXPORT static Standard_Boolean Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor);
+2 -15
View File
@@ -161,17 +161,6 @@ static IFSelect_ReturnStatus fun3
return status;
}
static IFSelect_ReturnStatus fun_whatfile
(const Handle(IFSelect_SessionPilot)& pilot)
{
TCollection_AsciiString whatcom = IFSelect_Activator::Alias ("whatfile");
if (whatcom.Length() > 0) return pilot->ExecuteAlias (whatcom);
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<"Load File : "<<pilot->Session()->LoadedFile()<<endl;
sout<<"No specific whatfile available"<<endl;
return IFSelect_RetVoid;
}
static IFSelect_ReturnStatus fun4
(const Handle(IFSelect_SessionPilot)& pilot)
{
@@ -256,7 +245,7 @@ static IFSelect_ReturnStatus fun8
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 2) { sout<<"Give label to search"<<endl; return IFSelect_RetError; }
if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
Handle(Interface_InterfaceModel) model = WS->Model();
const Handle(Interface_InterfaceModel) &model = WS->Model();
Standard_Integer i, cnt = 0;
Standard_Boolean exact = Standard_False;
sout<<" ** Search Entity Number for Label : "<<arg1<<endl;
@@ -1984,7 +1973,7 @@ static IFSelect_ReturnStatus fun91
}
DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1));
if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return IFSelect_RetError; }
Handle(Interface_InterfaceModel) model = WS->Model(); // pour Print
const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print
if (argc == 2) { // listage simple
Standard_Integer nb = sp->NbItems();
sout<<" SelectPointed : "<<arg1<<" : "<<nb<<" Items :"<<endl;
@@ -2459,9 +2448,7 @@ static int initactor = 0;
IFSelect_Act::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus);
IFSelect_Act::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
IFSelect_Act::AddFunc("xload","file:string : Read File -> Load Model",fun3);
// IFSelect_Act::AddFunc("load","file:string : Read File -> Load Model",fun3);
IFSelect_Act::AddFunc("xread","file:string : Read File -> Load Model",fun3);
IFSelect_Act::AddFunc("whatfile"," -> analyses a file (specific per norm)",fun_whatfile);
IFSelect_Act::AddFunc("writeall","file:string : Write all model (no split)",fun4);
IFSelect_Act::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5);
IFSelect_Act::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
+104 -266
View File
@@ -117,61 +117,16 @@ IFSelect_WorkSession::IFSelect_WorkSession ()
themodelstat = Standard_False;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand)
void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean toHandle)
{
theerrhand = errhand = hand;
theerrhand = errhand = toHandle;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean IFSelect_WorkSession::ErrorHandle () const
{
return theerrhand;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
const Handle(IFSelect_ShareOut)& IFSelect_WorkSession::ShareOut () const
{
return theshareout;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void IFSelect_WorkSession::SetLibrary (const Handle(IFSelect_WorkLibrary)& lib)
{
thelibrary = lib;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(IFSelect_WorkLibrary) IFSelect_WorkSession::WorkLibrary () const
{
return thelibrary;
}
//=======================================================================
//function :
@@ -192,19 +147,7 @@ void IFSelect_WorkSession::SetProtocol
//purpose :
//=======================================================================
Handle(Interface_Protocol) IFSelect_WorkSession::Protocol () const
{
return theprotocol;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void IFSelect_WorkSession::SetSignType
(const Handle(IFSelect_Signature)& signtype)
void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype)
{
thegtool->SetSignType (signtype);
if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type");
@@ -237,17 +180,6 @@ void IFSelect_WorkSession::SetShareOut
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean IFSelect_WorkSession::HasModel () const
{
return (!themodel.IsNull());
}
//=======================================================================
//function :
//purpose :
@@ -257,14 +189,11 @@ void IFSelect_WorkSession::SetModel
(const Handle(Interface_InterfaceModel)& model,
const Standard_Boolean clearpointed)
{
if (themodel != model) {
if (myModel != model)
theloaded.Clear();
//skl if (!themodel.IsNull()) themodel->Clear();
}
themodel = model;
myModel = model;
if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
// themodel->SetProtocol(theprotocol);
themodel->SetGTool (thegtool);
myModel->SetGTool (thegtool);
thegraph.Nullify();
ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien
@@ -277,39 +206,6 @@ void IFSelect_WorkSession::SetModel
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(Interface_InterfaceModel) IFSelect_WorkSession::Model () const
{
return themodel;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void IFSelect_WorkSession::SetLoadedFile (const Standard_CString filename)
{
theloaded.Clear();
theloaded.AssignCat (filename);
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_CString IFSelect_WorkSession::LoadedFile () const
{
return theloaded.ToCString();
}
//=======================================================================
//function :
//purpose :
@@ -351,8 +247,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
{
if (themodel.IsNull()) return 0;
return themodel->NbEntities();
return (myModel.IsNull()? 0 : myModel->NbEntities());
}
@@ -361,13 +256,12 @@ Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
//purpose :
//=======================================================================
Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity
(const Standard_Integer num) const
Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity (const Standard_Integer num) const
{
Handle(Standard_Transient) res; // Null par defaut
if (themodel.IsNull()) return res;
if (num < 1 || num > themodel->NbEntities()) return res;
return themodel->Value(num);
if (myModel.IsNull()) return res;
if (num < 1 || num > myModel->NbEntities()) return res;
return myModel->Value(num);
}
@@ -376,11 +270,9 @@ Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity
//purpose :
//=======================================================================
Standard_Integer IFSelect_WorkSession::StartingNumber
(const Handle(Standard_Transient)& ent) const
Standard_Integer IFSelect_WorkSession::StartingNumber (const Handle(Standard_Transient)& ent) const
{
if (themodel.IsNull()) return 0;
return themodel->Number(ent);
return (myModel.IsNull()? 0 : myModel->Number(ent));
}
@@ -393,13 +285,13 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel
(const Standard_CString val, const Standard_Integer afternum) const
{
Standard_Integer i, cnt = 0, num = atoi(val);
if (num > 0 || themodel.IsNull()) return num; // un n0 direct : gagne !
if (num > 0 || myModel.IsNull()) return num; // un n0 direct : gagne !
// Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
if (num > themodel->NbEntities()) { num = 0; return num; }
if (num > myModel->NbEntities()) { num = 0; return num; }
Standard_Boolean exact = Standard_False;
Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
for (i = themodel->NextNumberForLabel (val, after, exact) ; i != 0;
i = themodel->NextNumberForLabel (val, i, exact)) {
for (i = myModel->NextNumberForLabel (val, after, exact) ; i != 0;
i = myModel->NextNumberForLabel (val, i, exact)) {
cnt ++;
if (num <= 0) num = i;
}
@@ -415,14 +307,11 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel
//purpose :
//=======================================================================
Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel
(const Handle(Standard_Transient)& ent) const
Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel (const Handle(Standard_Transient)& ent) const
{
Handle(TCollection_HAsciiString) name;
if (themodel.IsNull() || ent.IsNull()) return name;
if (!themodel->Contains(ent)) return name;
name = themodel->StringLabel(ent);
return name;
if (myModel.IsNull() || ent.IsNull()) return 0;
if (!myModel->Contains(ent)) return 0;
return myModel->StringLabel(ent);
}
@@ -431,11 +320,9 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel
//purpose :
//=======================================================================
Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName
(const Handle(Standard_Transient)& ent) const
Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName (const Handle(Standard_Transient)& ent) const
{
Handle(TCollection_HAsciiString) name;
if (themodel.IsNull() || ent.IsNull()) return name;
if (myModel.IsNull() || ent.IsNull()) return 0;
Interface_ShareTool sht(thegraph->Graph());
Standard_Integer CN;
@@ -450,12 +337,9 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName
//purpose :
//=======================================================================
Standard_Integer IFSelect_WorkSession::CategoryNumber
(const Handle(Standard_Transient)& ent) const
Standard_Integer IFSelect_WorkSession::CategoryNumber (const Handle(Standard_Transient)& ent) const
{
if (themodel.IsNull()) return -1;
Standard_Integer num = StartingNumber(ent);
return themodel->CategoryNumber(num);
return (myModel.IsNull()? -1 : myModel->CategoryNumber(StartingNumber(ent)));
}
@@ -464,11 +348,9 @@ Standard_Integer IFSelect_WorkSession::CategoryNumber
//purpose :
//=======================================================================
Standard_CString IFSelect_WorkSession::CategoryName
(const Handle(Standard_Transient)& ent) const
Standard_CString IFSelect_WorkSession::CategoryName (const Handle(Standard_Transient)& ent) const
{
Standard_Integer cn = CategoryNumber (ent);
return Interface_Category::Name (cn);
return Interface_Category::Name (CategoryNumber (ent));
}
@@ -477,11 +359,9 @@ Standard_CString IFSelect_WorkSession::CategoryName
//purpose :
//=======================================================================
Standard_CString IFSelect_WorkSession::ValidityName
(const Handle(Standard_Transient)& ent) const
Standard_CString IFSelect_WorkSession::ValidityName (const Handle(Standard_Transient)& ent) const
{
if (StartingNumber(ent) == 0) return "";
return IFSelect_SignValidity::CVal (ent,themodel);
return ((StartingNumber(ent) == 0)? "" : IFSelect_SignValidity::CVal (ent,myModel));
}
@@ -495,8 +375,10 @@ void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
switch (mode) {
case 1 : {
theloaded.Clear();
if (!themodel.IsNull()) themodel->Clear();
themodel.Nullify();
if (!myModel.IsNull()) {
myModel->Clear();
myModel.Nullify();
}
ClearData(2); ClearData(4);
thecheckrun.Clear();
break;
@@ -547,17 +429,16 @@ Standard_Boolean IFSelect_WorkSession::ComputeGraph
(const Standard_Boolean enforce)
{
if (theprotocol.IsNull()) return Standard_False;
if (themodel.IsNull()) return Standard_False;
//if (themodel->NbEntities() == 0) return Standard_False;
if (myModel.IsNull()) return Standard_False;
if (enforce) thegraph.Nullify();
if (!thegraph.IsNull()) {
if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
thegraph.Nullify();
}
if (themodel->NbEntities() == 0) return Standard_False;
if (myModel->NbEntities() == 0) return Standard_False;
// Il faut calculer le graphe pour de bon
thegraph = new Interface_HGraph (themodel,themodelstat);
Standard_Integer nb = themodel->NbEntities();
thegraph = new Interface_HGraph (myModel,themodelstat);
Standard_Integer nb = myModel->NbEntities();
if(themodelstat)
{
Standard_Integer i; // svv #1
@@ -574,8 +455,8 @@ Standard_Boolean IFSelect_WorkSession::ComputeGraph
Interface_Category categ(thegtool);
Interface_ShareTool sht(thegraph);
Standard_Integer i =1;
for ( ; i <= nb; i ++) themodel->SetCategoryNumber
(i,categ.CatNum(themodel->Value(i),sht));
for ( ; i <= nb; i ++)
myModel->SetCategoryNumber(i,categ.CatNum(myModel->Value(i),sht));
}
return Standard_True;
@@ -646,10 +527,10 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings
Standard_Boolean IFSelect_WorkSession::IsLoaded () const
{
if (theprotocol.IsNull()) return Standard_False;
if (themodel.IsNull()) return Standard_False;
if (themodel->NbEntities() == 0) return Standard_False;
if (myModel.IsNull()) return Standard_False;
if (myModel->NbEntities() == 0) return Standard_False;
if (thegraph.IsNull()) return Standard_False;
if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
return Standard_False;
}
@@ -669,7 +550,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck
Interface_Graph& CG = thegraph->CGraph();
Interface_CheckTool cht(thegraph);
Interface_CheckIterator checklist = cht.VerifyCheckList();
themodel->FillSemanticChecks(checklist,Standard_False);
myModel->FillSemanticChecks(checklist,Standard_False);
if(themodelstat)
{
// Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM)
@@ -683,7 +564,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck
if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
}
for (num = 1; num <= nb; num ++)
if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
}
return Standard_True;
}
@@ -720,17 +601,17 @@ Interface_CheckIterator IFSelect_WorkSession::CheckOne
const Standard_Boolean complete)
{
Interface_CheckIterator checks;
checks.SetModel(themodel);
checks.SetModel(myModel);
if (!IsLoaded()) {
checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK");
return checks;
}
Standard_Integer num = -1;
if (ent.IsNull() || ent == themodel) num = 0;
else num = themodel->Number(ent);
if (ent.IsNull() || ent == myModel) num = 0;
else num = myModel->Number(ent);
Handle(Interface_Check) ach = themodel->Check (num,Standard_True);
if (complete) ach->GetMessages (themodel->Check (num,Standard_False));
Handle(Interface_Check) ach = myModel->Check (num,Standard_True);
if (complete) ach->GetMessages (myModel->Check (num,Standard_False));
if (num > 0) ach->SetEntity(ent);
checks.Add (ach,num);
checks.SetName ("Data Check (One Entity)");
@@ -738,17 +619,6 @@ Interface_CheckIterator IFSelect_WorkSession::CheckOne
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const
{
return thecheckrun;
}
// #####################################################################
// .... LES VARIABLES ....
@@ -1346,9 +1216,9 @@ Handle(IFSelect_Signature) IFSelect_WorkSession::Signature
Standard_CString IFSelect_WorkSession::SignValue
(const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const
{
if (sign.IsNull() || themodel.IsNull()) return "";
if (sign.IsNull() || myModel.IsNull()) return "";
if (StartingNumber(ent) == 0) return "";
return sign->Value (ent,themodel);
return sign->Value (ent,myModel);
}
// ########################################################################
@@ -1579,7 +1449,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList
if (counter.IsNull()) return Standard_False;
if (clear) counter->Clear();
if (list.IsNull()) return ComputeCounter (counter,Standard_True);
counter->AddList (list,themodel);
counter->AddList (list,myModel);
return Standard_True;
}
@@ -1646,19 +1516,7 @@ Standard_Integer IFSelect_WorkSession::DispatchRank
//purpose :
//=======================================================================
Handle(IFSelect_ModelCopier) IFSelect_WorkSession::ModelCopier () const
{
return thecopier;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void IFSelect_WorkSession::SetModelCopier
(const Handle(IFSelect_ModelCopier)& copier)
void IFSelect_WorkSession::SetModelCopier (const Handle(IFSelect_ModelCopier)& copier)
{
thecopier = copier;
thecopier->SetShareOut(theshareout);
@@ -1670,8 +1528,7 @@ void IFSelect_WorkSession::SetModelCopier
//purpose :
//=======================================================================
Standard_Integer IFSelect_WorkSession::NbFinalModifiers
(const Standard_Boolean formodel) const
Standard_Integer IFSelect_WorkSession::NbFinalModifiers (const Standard_Boolean formodel) const
{
return theshareout->NbModifiers(formodel);
}
@@ -1700,8 +1557,7 @@ Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents
//purpose :
//=======================================================================
Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier
(const Standard_Integer id) const
Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier (const Standard_Integer id) const
{
return GetCasted(IFSelect_GeneralModifier,Item(id));
}
@@ -1712,8 +1568,7 @@ Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier
//purpose :
//=======================================================================
Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier
(const Standard_Integer id) const
Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier (const Standard_Integer id) const
{
return GetCasted(IFSelect_Modifier,Item(id));
}
@@ -1724,8 +1579,7 @@ Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier
//purpose :
//=======================================================================
Standard_Integer IFSelect_WorkSession::ModifierRank
(const Handle(IFSelect_GeneralModifier)& modif) const
Standard_Integer IFSelect_WorkSession::ModifierRank (const Handle(IFSelect_GeneralModifier)& modif) const
{
if (ItemIdent(modif) == 0) return 0;
return theshareout->ModifierRank(modif);
@@ -1836,8 +1690,7 @@ Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier
//purpose :
//=======================================================================
Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer
(const Standard_Integer id) const
Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer (const Standard_Integer id) const
{
return GetCasted(IFSelect_Transformer,Item(id));
}
@@ -1862,7 +1715,7 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<" ** RunTransformer has produced Check Messages : **"<<endl;
checks.Print (sout,themodel,Standard_False);
checks.Print (sout,myModel,Standard_False);
}
thecheckdone = Standard_False;
thecheckrun = checks;
@@ -1876,7 +1729,7 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
sp->Update(transf);
}
if (newmod == themodel) {
if (newmod == myModel) {
effect = (res ? 2 : -2);
if (!res) return effect;
Handle(Interface_Protocol) newproto = theprotocol;
@@ -1889,7 +1742,7 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
Handle(Interface_Protocol) newproto = theprotocol;
if (transf->ChangeProtocol(newproto))
{ effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); }
theoldel = themodel;
theoldel = myModel;
SetModel(newmod,Standard_False);
}
return effect;
@@ -1955,9 +1808,9 @@ Standard_Boolean IFSelect_WorkSession::SetModelContent
Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph());
if (list.NbEntities() == 0) return Standard_False;
Handle(Interface_InterfaceModel) newmod = themodel->NewEmptyModel();
Interface_CopyTool TC(themodel,theprotocol);
Standard_Integer i, nb = themodel->NbEntities();
Handle(Interface_InterfaceModel) newmod = myModel->NewEmptyModel();
Interface_CopyTool TC(myModel,theprotocol);
Standard_Integer i, nb = myModel->NbEntities();
if (keep) {
for (list.Start(); list.More(); list.Next())
TC.TransferEntity (list.Value());
@@ -1965,18 +1818,18 @@ Standard_Boolean IFSelect_WorkSession::SetModelContent
Standard_Integer* flags = new Standard_Integer[nb+1];
for (i = 0; i <= nb; i ++) flags[i] = 0;
for (list.Start(); list.More(); list.Next()) {
Standard_Integer num = themodel->Number(list.Value());
Standard_Integer num = myModel->Number(list.Value());
if (num <= nb) flags[num] = 1;
}
for (i = 1; i <= nb; i ++) {
if (flags[i] == 0) TC.TransferEntity (themodel->Value(i));
if (flags[i] == 0) TC.TransferEntity (myModel->Value(i));
}
delete [] flags;
}
TC.FillModel(newmod);
if (newmod->NbEntities() == 0) return Standard_False;
// Mettre a jour (ne pas oublier SelectPointed)
theoldel = themodel;
theoldel = myModel;
SetModel(newmod,Standard_False);
// MISE A JOUR des SelectPointed
Handle(TColStd_HSequenceOfInteger) pts =
@@ -2189,7 +2042,7 @@ void IFSelect_WorkSession::EvaluateFile ()
if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<" ** EvaluateFile has produced Check Messages : **"<<endl;
checks.Print (sout,themodel,Standard_False);
checks.Print (sout,myModel,Standard_False);
}
thecopier->SetRemaining (thegraph->CGraph());
thecheckrun = checks;
@@ -2420,16 +2273,16 @@ Standard_Boolean IFSelect_WorkSession::SetRemaining
return Standard_True;
} else if (mode == IFSelect_RemainCompute) {
Handle(Interface_InterfaceModel) newmod;
Interface_CopyTool TC(themodel,theprotocol);
Interface_CopyTool TC(myModel,theprotocol);
thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod);
if (newmod.IsNull()) {
sout<<" No Remaining Data recorded"<<endl; return Standard_False;
} else if (newmod == themodel) {
} else if (newmod == myModel) {
sout<<" Remaining causes all original data to be kept"<<endl;
thecopier->SetRemaining (thegraph->CGraph());
return Standard_False;
} else {
theoldel = themodel;
theoldel = myModel;
SetModel(newmod,Standard_False);
// MISE A JOUR des SelectPointed
Handle(TColStd_HSequenceOfInteger) list =
@@ -2840,7 +2693,7 @@ static void IFSelect_QueryProp (Interface_IntList& list,
void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
{
if (!IsLoaded()) return;
Standard_Integer i,nb = themodel->NbEntities();
Standard_Integer i,nb = myModel->NbEntities();
thecheckana = TCollection_AsciiString (nb+1,' ');
for (chl.Start(); chl.More(); chl.Next()) {
Standard_Integer num = chl.Number();
@@ -2877,7 +2730,7 @@ Standard_Integer IFSelect_WorkSession::QueryCheckStatus
(const Handle(Standard_Transient)& ent) const
{
if (!IsLoaded()) return -1;
Standard_Integer num = themodel->Number(ent);
Standard_Integer num = myModel->Number(ent);
if (num == 0) return -1;
if (thecheckana.Length() < num) return -1;
Standard_Character val = thecheckana.Value (num);
@@ -2937,8 +2790,8 @@ Standard_Integer IFSelect_WorkSession::QueryParent
//=======================================================================
void IFSelect_WorkSession::SetParams
(const TColStd_SequenceOfTransient& params,
const TColStd_SequenceOfInteger& uselist)
(const NCollection_Vector<Handle(Standard_Transient)>& params,
const NCollection_Vector<Standard_Integer>& uselist)
{
Standard_Integer i, nbp = params.Length(), nbu = uselist.Length();
Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor
@@ -3261,9 +3114,9 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
// Le modele : son contenu
list = new TColStd_HSequenceOfTransient();
if (obj == themodel) {
Standard_Integer i, nb = themodel->NbEntities();
for (i = 1; i <= nb; i ++) list->Append (themodel->Value(i));
if (obj == myModel) {
Standard_Integer i, nb = myModel->NbEntities();
for (i = 1; i <= nb; i ++) list->Append (myModel->Value(i));
}
// Une entite du modele : cette entite
@@ -3431,15 +3284,15 @@ void IFSelect_WorkSession::DumpModel
if (level == 0) {
S<<" ******** Short Dump of Header ********\n";
S << " *****************************************************************\n\n";
themodel->DumpHeader(S); S<<endl;
myModel->DumpHeader(S); S<<endl;
}
Standard_Integer nbent = themodel->NbEntities();
Standard_Integer nbent = myModel->NbEntities();
Standard_Integer nbr = 0;
Interface_ShareFlags shar(thegraph->Graph());
for (Standard_Integer i = 1; i <= nbent; i ++) {
if (!shar.IsShared(themodel->Value(i))) nbr ++;
if (!shar.IsShared(myModel->Value(i))) nbr ++;
}
S << " *****************************************************************\n";
S << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)\n";
@@ -3451,7 +3304,7 @@ void IFSelect_WorkSession::DumpModel
ListEntities (shar.RootEntities(),1);
} else if (level == 2) {
S<<" ******** Complete List ******** ";
ListEntities (themodel->Entities(),1);
ListEntities (myModel->Entities(),1);
} else if (level > 2) {
IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
if (level == 5 || level == 8) mode = IFSelect_CountByItem;
@@ -3482,7 +3335,7 @@ void IFSelect_WorkSession::DumpModel
// Check List : si vide (pas demandee), naturellement passee
try {
OCC_CATCH_SIGNALS
C.Print(S,themodel, (level == 3));
C.Print(S,myModel, (level == 3));
}
catch (Standard_Failure) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
@@ -3526,12 +3379,12 @@ void IFSelect_WorkSession::DumpEntity
{
if (!IsLoaded())
{ S<< " *** Data for List not available ***"<<endl; return; }
Standard_Integer num = themodel->Number(ent);
Standard_Integer num = myModel->Number(ent);
if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<<endl; return; }
if (thelibrary.IsNull()) { S<<" *** WorkLibrary not defined ***"<<endl; return; }
S << " ******** Dumping Entity n0 "<<num
<<" level:"<<level<<" ********"<<endl;
thelibrary->DumpEntity (themodel,theprotocol,ent,S,level);
thelibrary->DumpEntity (myModel,theprotocol,ent,S,level);
}
// .... DumpEntity ....
@@ -3563,17 +3416,17 @@ void IFSelect_WorkSession::PrintEntityStatus
if (num == 0) { cout<<" -- PrintEntityStatus : unknown"<<endl; return; }
S <<" Ent. n0/id: ";
Model()->Print(ent,S);
myModel->Print(ent,S);
Handle(TCollection_HAsciiString) hname = EntityName(ent);
if (!hname.IsNull() && hname->Length() > 0) S<<" Name:"<<hname->ToCString();
S<<endl;
Handle(IFSelect_Signature) signtype = SignType();
if (signtype.IsNull()) S<<" Type(CDL):"<<ent->DynamicType()->Name()<<endl;
else S <<" Type:"<<signtype->Value (ent,Model())<<endl;
else S <<" Type:"<<signtype->Value (ent,myModel)<<endl;
S <<" Category : " <<CategoryName (ent)
<<" Validity : " <<ValidityName (ent) << endl;
Interface_CheckIterator chl = CheckOne (ent);
chl.Print (S,Model(),Standard_False,Standard_False);
chl.Print (S,myModel,Standard_False,Standard_False);
Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
if (list.IsNull()) S<<" Root"<<endl;
@@ -3581,7 +3434,7 @@ void IFSelect_WorkSession::PrintEntityStatus
nb = list->Length();
if (nb == 0) S<<" Root";
else S<<" Super-entities:"<<nb<<" : (n0/id):";
for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); }
S<<endl;
}
list = Shareds (ent);
@@ -3590,7 +3443,7 @@ void IFSelect_WorkSession::PrintEntityStatus
nb = list->Length();
if (nb == 0) S<<" No sub-entity";
else S<<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); }
S<<endl;
}
}
@@ -3608,13 +3461,13 @@ void IFSelect_WorkSession::PrintCheckList
{
// mode : 0 comptage 1 n0s entites 2 n0s+id ents
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,themodel,failsonly);
if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,myModel,failsonly);
else {
Interface_CheckIterator chks = checklist;
Handle(IFSelect_CheckCounter) counter =
new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
counter->Analyse (chks,themodel,Standard_True,failsonly);
counter->PrintList (sout,themodel,mode);
counter->Analyse (chks,myModel,Standard_True,failsonly);
counter->PrintList (sout,myModel,mode);
}
}
@@ -3631,7 +3484,7 @@ void IFSelect_WorkSession::PrintSignatureList
{
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (signlist.IsNull()) return;
signlist->PrintList (sout,themodel,mode);
signlist->PrintList (sout,myModel,mode);
}
// #### #### #### #### #### #### #### #### ####
@@ -3854,23 +3707,18 @@ void IFSelect_WorkSession::ListEntities
if (!titre && mode == 2) sout<<"(";
titre = 1;
Handle(Standard_Transient) ent = iter.Value();
Standard_Integer num = themodel->Number(ent);
Standard_Integer num = myModel->Number(ent);
if (mode == 1) {
// n0 id (root?) category validity tracetype
// n0 id (root?) category validity tracetype
sout<<Interface_MSG::Blanks (num,6);
themodel->Print(ent,sout,0);
myModel->Print(ent,sout,0);
if (!tool.IsShared(ent)) sout << " #ROOT#";
else sout << " ";
Standard_Integer catnum = themodel->CategoryNumber(num);
Standard_Integer catnum = myModel->CategoryNumber(num);
if (catnum > 0) sout<<" "<<Interface_Category::Name (catnum);
sout << " (" << ValidityName (ent) << ") ";
sout<<" Type:"<<themodel->TypeName (ent, Standard_False);
// Handle(Interface_GeneralModule) tracemod;
// Standard_Integer CN;
// if (thegtool->Select(ent,tracemod,CN))tracemod->TraceType(ent,CN,sout);
// else sout << "(Not in Protocol) " << ent->DynamicType();
sout << endl;
sout<<" Type:"<<myModel->TypeName (ent, Standard_False)<<endl;
} else if (mode == 2) {
newcount ++;
if (newcount > 0) sout<<",";
@@ -3879,10 +3727,10 @@ void IFSelect_WorkSession::ListEntities
newcount ++; mods = 0; cnt ++;
if (newcount >= 10) { sout << endl<<"["<<cnt<<"]:"; newcount = 1; }
if (newcount > 0) sout << " ";
themodel->Print(ent,sout,0);
myModel->Print(ent,sout,0);
if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; }
if (themodel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
if (themodel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
if (myModel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
if (myModel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
if (mods) { sout<<")"; newcount ++; }
}
}
@@ -3895,13 +3743,3 @@ void IFSelect_WorkSession::ListEntities
sout<<"\n Abandon"<<endl;
}
}
void IFSelect_WorkSession::SetModeStat( Standard_Boolean theStatMode)
{
themodelstat = theStatMode;
}
Standard_Boolean IFSelect_WorkSession::GetModeStat() const
{
return themodelstat;
}
+32 -32
View File
@@ -25,6 +25,7 @@
#include <Interface_CheckIterator.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <MMgt_TShared.hxx>
#include <NCollection_Vector.hxx>
#include <Standard_CString.hxx>
#include <IFSelect_ReturnStatus.hxx>
#include <Standard_Integer.hxx>
@@ -86,13 +87,15 @@ public:
Standard_EXPORT IFSelect_WorkSession();
//! Changes the Error Handler status (by default, it is not set)
Standard_EXPORT void SetErrorHandle (const Standard_Boolean hand);
Standard_EXPORT void SetErrorHandle (const Standard_Boolean toHandle);
//! Returns the Error Handler status
Standard_EXPORT Standard_Boolean ErrorHandle() const;
Standard_Boolean ErrorHandle() const
{ return theerrhand; }
//! Returns the ShareOut defined at creation time
Standard_EXPORT const Handle(IFSelect_ShareOut)& ShareOut() const;
const Handle(IFSelect_ShareOut) & ShareOut() const
{ return theshareout; }
//! Sets a new ShareOut. Fills Items which its content
//! Warning : data from the former ShareOut are lost
@@ -101,17 +104,21 @@ public:
//! Set value of mode responsible for precence of selections after loading
//! If mode set to true that different selections will be accessible after loading
//! else selections will be not accessible after loading( for economy memory in applicatios)
Standard_EXPORT void SetModeStat (const Standard_Boolean theMode);
void SetModeStat (const Standard_Boolean theMode)
{ themodelstat = theMode; }
//! Return value of mode defining of filling selection during loading
Standard_EXPORT Standard_Boolean GetModeStat() const;
Standard_Boolean GetModeStat() const
{ return themodelstat; }
//! Sets a WorkLibrary, which will be used to Read and Write Files
Standard_EXPORT void SetLibrary (const Handle(IFSelect_WorkLibrary)& lib);
void SetLibrary (const Handle(IFSelect_WorkLibrary) &theLib)
{ thelibrary = theLib; }
//! Returns the WorkLibrary. Null Handle if not yet set
//! should be C++ : return const &
Standard_EXPORT Handle(IFSelect_WorkLibrary) WorkLibrary() const;
const Handle(IFSelect_WorkLibrary) & WorkLibrary() const
{ return thelibrary; }
//! Sets a Protocol, which will be used to determine Graphs, to
//! Read and to Write Files
@@ -119,7 +126,8 @@ public:
//! Returns the Protocol. Null Handle if not yet set
//! should be C++ : return const &
Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
const Handle(Interface_Protocol) & Protocol() const
{ return theprotocol; }
//! Sets a specific Signature to be the SignType, i.e. the
//! Signature which will determine TypeName from the Model
@@ -131,7 +139,8 @@ public:
Standard_EXPORT Handle(IFSelect_Signature) SignType() const;
//! Returns True is a Model has been set
Standard_EXPORT Standard_Boolean HasModel() const;
Standard_Boolean HasModel() const
{ return (!myModel.IsNull()); }
//! Sets a Model as input : this will be the Model from which the
//! ShareOut will work
@@ -143,15 +152,18 @@ public:
//! Returns the Model of the Work Session (Null Handle if none)
//! should be C++ : return const &
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
const Handle(Interface_InterfaceModel) & Model () const
{ return myModel; }
//! Stores the filename used for read for setting the model
//! It is cleared by SetModel and ClearData(1)
Standard_EXPORT void SetLoadedFile (const Standard_CString filename);
void SetLoadedFile (const Standard_CString theFileName)
{ theloaded = theFileName; }
//! Returns the filename used to load current model
//! empty if unknown
Standard_EXPORT Standard_CString LoadedFile() const;
Standard_CString LoadedFile() const
{ return theloaded.ToCString(); }
//! Reads a file with the WorkLibrary (sets Model and LoadedFile)
//! Returns a integer status which can be :
@@ -273,7 +285,8 @@ public:
//! Cleared by SetModel or ClearData(1)
//! The field is protected, hence a specialized WorkSession may
//! fill it
Standard_EXPORT Interface_CheckIterator LastRunCheckList() const;
Interface_CheckIterator LastRunCheckList() const
{ return thecheckrun; }
//! Returns the Maximum Value for an Item Identifier. It can be
//! greater to the count of known Items, because some can have
@@ -531,7 +544,8 @@ public:
Standard_EXPORT Standard_Integer DispatchRank (const Handle(IFSelect_Dispatch)& disp) const;
//! Gives access to the complete ModelCopier
Standard_EXPORT Handle(IFSelect_ModelCopier) ModelCopier() const;
const Handle(IFSelect_ModelCopier) & ModelCopier() const
{ return thecopier; }
//! Sets a new ModelCopier. Fills Items which its content
Standard_EXPORT void SetModelCopier (const Handle(IFSelect_ModelCopier)& copier);
@@ -968,7 +982,7 @@ public:
//! xst-params-split 4 Split
//! xst-param-read 5 Transfer on Reading
//! xst-param-write 6 Transfer on Writing
Standard_EXPORT void SetParams (const TColStd_SequenceOfTransient& params, const TColStd_SequenceOfInteger& uselist);
Standard_EXPORT void SetParams (const NCollection_Vector<Handle(Standard_Transient)>& params, const NCollection_Vector<Standard_Integer>& uselist);
//! Traces the Statics attached to a given use number
//! If <use> is given positive (normal), the trace is embedded
@@ -1073,28 +1087,22 @@ public:
//! 2 gives a form suitable for givelist : (n1,n2,n3...)
Standard_EXPORT void ListEntities (const Interface_EntityIterator& iter, const Standard_Integer mode) const;
DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,MMgt_TShared)
protected:
protected:
Handle(Interface_HGraph) thegraph;
Interface_CheckIterator thecheckrun;
TColStd_IndexedDataMapOfTransientTransient theitems;
Handle(Dico_DictionaryOfTransient) thenames;
private:
private:
Standard_Boolean theerrhand;
Handle(IFSelect_ShareOut) theshareout;
Handle(IFSelect_WorkLibrary) thelibrary;
Handle(Interface_Protocol) theprotocol;
Handle(Interface_InterfaceModel) themodel;
Handle(Interface_InterfaceModel) myModel;
TCollection_AsciiString theloaded;
Handle(Interface_GTool) thegtool;
Standard_Boolean thecheckdone;
@@ -1103,14 +1111,6 @@ private:
Handle(IFSelect_ModelCopier) thecopier;
Handle(Interface_InterfaceModel) theoldel;
Standard_Boolean themodelstat;
};
#endif // _IFSelect_WorkSession_HeaderFile