1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0026005: Problem with transient TFunction_Logbook

This commit is contained in:
vro 2015-11-24 08:56:17 +03:00 committed by bugmaster
parent 8156ddddc7
commit f486f64d86
44 changed files with 438 additions and 257 deletions

View File

@ -48,7 +48,7 @@ OCAFSample_CommonDriver::OCAFSample_CommonDriver()
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer OCAFSample_CommonDriver::Execute(TFunction_Logbook& theLogbook) const Standard_Integer OCAFSample_CommonDriver::Execute(Handle(TFunction_Logbook)& theLogbook) const
{ {
Handle(TDF_Reference) aReference; Handle(TDF_Reference) aReference;
TopoDS_Shape aMaster, aTool; TopoDS_Shape aMaster, aTool;
@ -77,14 +77,14 @@ Standard_Integer OCAFSample_CommonDriver::Execute(TFunction_Logbook& theLogbook)
TDocStd_Modified::Add(aNode->Father()->Label()); TDocStd_Modified::Add(aNode->Father()->Label());
theLogbook.SetImpacted(Label()); theLogbook->SetImpacted(Label());
TDocStd_Modified::Add(Label()); TDocStd_Modified::Add(Label());
theLogbook.SetImpacted(ResultLabel); theLogbook->SetImpacted(ResultLabel);
TDF_ChildIterator anIterator(ResultLabel); TDF_ChildIterator anIterator(ResultLabel);
for(; anIterator.More(); anIterator.Next()) { for(; anIterator.More(); anIterator.Next()) {
theLogbook.SetImpacted(anIterator.Value()); theLogbook->SetImpacted(anIterator.Value());
} }
return OK_OPERATION; return OK_OPERATION;

View File

@ -55,7 +55,7 @@ public:
// Methods PUBLIC // Methods PUBLIC
// //
Standard_EXPORT OCAFSample_CommonDriver(); Standard_EXPORT OCAFSample_CommonDriver();
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& theLogbook) const; Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& theLogbook) const;
Standard_EXPORT ~OCAFSample_CommonDriver(); Standard_EXPORT ~OCAFSample_CommonDriver();

View File

@ -59,8 +59,8 @@ public:
// Methods PUBLIC // Methods PUBLIC
// //
Standard_EXPORT void Validate(TFunction_Logbook& log) const; Standard_EXPORT void Validate(TFunction_Logbook& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean Arguments(TDF_LabelMap& theArgs) const; Standard_EXPORT virtual Standard_Boolean Arguments(TDF_LabelMap& theArgs) const;
Standard_EXPORT virtual Standard_Boolean Results(TDF_LabelMap& theRes) const; Standard_EXPORT virtual Standard_Boolean Results(TDF_LabelMap& theRes) const;
Standard_EXPORT ~OCAFSample_Driver(); Standard_EXPORT ~OCAFSample_Driver();

View File

@ -336,7 +336,7 @@ void COcafDoc::OnModify()
Standard_GUID myDriverID=TFF->GetDriverGUID(); Standard_GUID myDriverID=TFF->GetDriverGUID();
Handle(TDocStd_Document) D = GetOcafDoc(); Handle(TDocStd_Document) D = GetOcafDoc();
TFunction_Logbook log; Handle(TFunction_Logbook) log = TFunction_Logbook::Set(D->Main());
TCollection_AsciiString Message("\ TCollection_AsciiString Message("\
// Modification and recomputation of the selected object \n\ // Modification and recomputation of the selected object \n\
@ -607,7 +607,7 @@ D->CommitCommand(); \n\
// Recompute the cut object if it must be (look at the MustExecute function code) // Recompute the cut object if it must be (look at the MustExecute function code)
// if (myCutDriver->MustExecute(log)) // if (myCutDriver->MustExecute(log))
// { // {
log.SetTouched(LabObject); log->SetTouched(LabObject);
if(myCutDriver->Execute(log)) if(myCutDriver->Execute(log))
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Recompute failed", L"Modify cut", MB_ICONEXCLAMATION); MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Recompute failed", L"Modify cut", MB_ICONEXCLAMATION);
// } // }

View File

@ -37,10 +37,10 @@ TOcafFunction_BoxDriver::TOcafFunction_BoxDriver()
//purpose : Validation of the object label, its arguments and its results. //purpose : Validation of the object label, its arguments and its results.
//======================================================================= //=======================================================================
void TOcafFunction_BoxDriver::Validate(TFunction_Logbook& log) const void TOcafFunction_BoxDriver::Validate(Handle(TFunction_Logbook)& log) const
{ {
// We validate the object label ( Label() ), all the arguments and the results of the object: // We validate the object label ( Label() ), all the arguments and the results of the object:
log.SetValid(Label(), Standard_True); log->SetValid(Label(), Standard_True);
} }
//======================================================================= //=======================================================================
@ -49,10 +49,10 @@ void TOcafFunction_BoxDriver::Validate(TFunction_Logbook& log) const
// : be invoked. If the object label or an argument is modified, // : be invoked. If the object label or an argument is modified,
// : we must recompute the object - to call the method Execute(). // : we must recompute the object - to call the method Execute().
//======================================================================= //=======================================================================
Standard_Boolean TOcafFunction_BoxDriver::MustExecute(const TFunction_Logbook& log) const Standard_Boolean TOcafFunction_BoxDriver::MustExecute(const Handle(TFunction_Logbook)& log) const
{ {
// If the object's label is modified: // If the object's label is modified:
if (log.IsModified(Label())) return Standard_True; if (log->IsModified(Label())) return Standard_True;
// Cut (in our simple case) has two arguments: The original shape, and the tool shape. // Cut (in our simple case) has two arguments: The original shape, and the tool shape.
// They are on the child labels of the box's label: // They are on the child labels of the box's label:
@ -60,12 +60,12 @@ Standard_Boolean TOcafFunction_BoxDriver::MustExecute(const TFunction_Logbook& l
// ToolNShape - is attached to the second child label. // ToolNShape - is attached to the second child label.
// //
// Let's check them: // Let's check them:
if (log.IsModified(Label().FindChild(1))) return Standard_True; // width. if (log->IsModified(Label().FindChild(1))) return Standard_True; // width.
if (log.IsModified(Label().FindChild(2))) return Standard_True; // length, if (log->IsModified(Label().FindChild(2))) return Standard_True; // length,
if (log.IsModified(Label().FindChild(3))) return Standard_True; // width. if (log->IsModified(Label().FindChild(3))) return Standard_True; // width.
if (log.IsModified(Label().FindChild(4))) return Standard_True; // length, if (log->IsModified(Label().FindChild(4))) return Standard_True; // length,
if (log.IsModified(Label().FindChild(5))) return Standard_True; // width. if (log->IsModified(Label().FindChild(5))) return Standard_True; // width.
if (log.IsModified(Label().FindChild(6))) return Standard_True; // length, if (log->IsModified(Label().FindChild(6))) return Standard_True; // length,
// if there are no any modifications concerned the box, // if there are no any modifications concerned the box,
// it's not necessary to recompute (to call the method Execute()): // it's not necessary to recompute (to call the method Execute()):
@ -83,7 +83,7 @@ Standard_Boolean TOcafFunction_BoxDriver::MustExecute(const TFunction_Logbook& l
// : if there are no any mistakes occurred we return 0: // : if there are no any mistakes occurred we return 0:
// : 0 - no mistakes were found. // : 0 - no mistakes were found.
//======================================================================= //=======================================================================
Standard_Integer TOcafFunction_BoxDriver::Execute(TFunction_Logbook& /*log*/) const Standard_Integer TOcafFunction_BoxDriver::Execute(Handle(TFunction_Logbook)& /*log*/) const
{ {
// Get the values of dimension and position attributes // Get the values of dimension and position attributes
Handle(TDataStd_Real) TSR; Handle(TDataStd_Real) TSR;

View File

@ -56,9 +56,9 @@ public:
// //
Standard_EXPORT static const Standard_GUID& GetID() ; Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_BoxDriver(); Standard_EXPORT TOcafFunction_BoxDriver();
Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const; Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_BoxDriver(); Standard_EXPORT ~TOcafFunction_BoxDriver();

View File

@ -42,10 +42,10 @@ TOcafFunction_CutDriver::TOcafFunction_CutDriver()
//purpose : Validation of the object label, its arguments and its results. //purpose : Validation of the object label, its arguments and its results.
//======================================================================= //=======================================================================
void TOcafFunction_CutDriver::Validate(TFunction_Logbook& log) const void TOcafFunction_CutDriver::Validate(Handle(TFunction_Logbook)& log) const
{ {
// We validate the object label ( Label() ), all the arguments and the results of the object: // We validate the object label ( Label() ), all the arguments and the results of the object:
log.SetValid(Label(), Standard_True); log->SetValid(Label(), Standard_True);
} }
//======================================================================= //=======================================================================
@ -55,10 +55,10 @@ void TOcafFunction_CutDriver::Validate(TFunction_Logbook& log) const
// : we must recompute the object - to call the method Execute(). // : we must recompute the object - to call the method Execute().
//======================================================================= //=======================================================================
Standard_Boolean TOcafFunction_CutDriver::MustExecute(const TFunction_Logbook& log) const Standard_Boolean TOcafFunction_CutDriver::MustExecute(const Handle(TFunction_Logbook)& log) const
{ {
// If the object's label is modified: // If the object's label is modified:
if (log.IsModified(Label())) return Standard_True; if (log->IsModified(Label())) return Standard_True;
// Cut (in our simple case) has two arguments: The original shape, and the tool shape. // Cut (in our simple case) has two arguments: The original shape, and the tool shape.
// They are on the child labels of the cut's label: // They are on the child labels of the cut's label:
@ -76,11 +76,11 @@ Standard_Boolean TOcafFunction_CutDriver::MustExecute(const TFunction_Logbook& l
TDF_Tool::Entry(Label(), aEntry); TDF_Tool::Entry(Label(), aEntry);
cout << "Entry: "<<aEntry.ToCString()<<endl; cout << "Entry: "<<aEntry.ToCString()<<endl;
Label().FindChild(1).FindAttribute(TDF_Reference::GetID(),OriginalRef); Label().FindChild(1).FindAttribute(TDF_Reference::GetID(),OriginalRef);
if (log.IsModified(OriginalRef->Get())) return Standard_True; // Original shape. if (log->IsModified(OriginalRef->Get())) return Standard_True; // Original shape.
Handle(TDF_Reference) ToolRef; Handle(TDF_Reference) ToolRef;
Label().FindChild(2).FindAttribute(TDF_Reference::GetID(),ToolRef); Label().FindChild(2).FindAttribute(TDF_Reference::GetID(),ToolRef);
if (log.IsModified(ToolRef->Get())) return Standard_True; // Tool shape. if (log->IsModified(ToolRef->Get())) return Standard_True; // Tool shape.
// if there are no any modifications concerned the cut, // if there are no any modifications concerned the cut,
// it's not necessary to recompute (to call the method Execute()): // it's not necessary to recompute (to call the method Execute()):
@ -99,7 +99,7 @@ Standard_Boolean TOcafFunction_CutDriver::MustExecute(const TFunction_Logbook& l
// : 0 - no mistakes were found. // : 0 - no mistakes were found.
//======================================================================= //=======================================================================
Standard_Integer TOcafFunction_CutDriver::Execute(TFunction_Logbook& /*log*/) const Standard_Integer TOcafFunction_CutDriver::Execute(Handle(TFunction_Logbook)& /*log*/) const
{ {
// Let's get the arguments (OriginalNShape, ToolNShape of the object): // Let's get the arguments (OriginalNShape, ToolNShape of the object):

View File

@ -56,9 +56,9 @@ public:
// //
Standard_EXPORT static const Standard_GUID& GetID() ; Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CutDriver(); Standard_EXPORT TOcafFunction_CutDriver();
Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const; Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CutDriver(); Standard_EXPORT ~TOcafFunction_CutDriver();

View File

@ -39,10 +39,10 @@ TOcafFunction_CylDriver::TOcafFunction_CylDriver()
//purpose : Validation of the object label, its arguments and its results. //purpose : Validation of the object label, its arguments and its results.
//======================================================================= //=======================================================================
void TOcafFunction_CylDriver::Validate(TFunction_Logbook& log) const void TOcafFunction_CylDriver::Validate(Handle(TFunction_Logbook)& log) const
{ {
// We validate the object label ( Label() ), all the arguments and the results of the object: // We validate the object label ( Label() ), all the arguments and the results of the object:
log.SetValid(Label(), Standard_True); log->SetValid(Label(), Standard_True);
} }
//======================================================================= //=======================================================================
@ -51,19 +51,19 @@ void TOcafFunction_CylDriver::Validate(TFunction_Logbook& log) const
// : be invoked. If the object label or an argument is modified, // : be invoked. If the object label or an argument is modified,
// : we must recompute the object - to call the method Execute(). // : we must recompute the object - to call the method Execute().
//======================================================================= //=======================================================================
Standard_Boolean TOcafFunction_CylDriver::MustExecute(const TFunction_Logbook& log) const Standard_Boolean TOcafFunction_CylDriver::MustExecute(const Handle(TFunction_Logbook)& log) const
{ {
// If the object's label is modified: // If the object's label is modified:
if (log.IsModified(Label())) return Standard_True; if (log->IsModified(Label())) return Standard_True;
// Cylinder (in our simple case) has 5 arguments: // Cylinder (in our simple case) has 5 arguments:
// //
// Let's check them: // Let's check them:
if (log.IsModified(Label().FindChild(1))) return Standard_True; // radius. if (log->IsModified(Label().FindChild(1))) return Standard_True; // radius.
if (log.IsModified(Label().FindChild(2))) return Standard_True; // height, if (log->IsModified(Label().FindChild(2))) return Standard_True; // height,
if (log.IsModified(Label().FindChild(3))) return Standard_True; // x. if (log->IsModified(Label().FindChild(3))) return Standard_True; // x.
if (log.IsModified(Label().FindChild(4))) return Standard_True; // y, if (log->IsModified(Label().FindChild(4))) return Standard_True; // y,
if (log.IsModified(Label().FindChild(5))) return Standard_True; // z. if (log->IsModified(Label().FindChild(5))) return Standard_True; // z.
// if there are no any modifications concerned the Cyl, // if there are no any modifications concerned the Cyl,
// it's not necessary to recompute (to call the method Execute()): // it's not necessary to recompute (to call the method Execute()):
@ -81,7 +81,7 @@ Standard_Boolean TOcafFunction_CylDriver::MustExecute(const TFunction_Logbook& l
// : if there are no any mistakes occurred we return 0: // : if there are no any mistakes occurred we return 0:
// : 0 - no mistakes were found. // : 0 - no mistakes were found.
//======================================================================= //=======================================================================
Standard_Integer TOcafFunction_CylDriver::Execute(TFunction_Logbook& /*log*/) const Standard_Integer TOcafFunction_CylDriver::Execute(Handle(TFunction_Logbook)& /*log*/) const
{ {
// Get the values of dimension and position attributes // Get the values of dimension and position attributes
Handle(TDataStd_Real) TSR; Handle(TDataStd_Real) TSR;

View File

@ -56,9 +56,9 @@ public:
// //
Standard_EXPORT static const Standard_GUID& GetID() ; Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CylDriver(); Standard_EXPORT TOcafFunction_CylDriver();
Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const; Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CylDriver(); Standard_EXPORT ~TOcafFunction_CylDriver();

View File

@ -88,7 +88,7 @@ TDF_Label TOcaf_Commands::CreateBox(Standard_Real x, Standard_Real y, Standard_R
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_BoxDriver::GetID()); Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_BoxDriver::GetID());
// Initialize and execute the box driver (look at the "Execute()" code) // Initialize and execute the box driver (look at the "Execute()" code)
TFunction_Logbook log; Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
Handle(TOcafFunction_BoxDriver) myBoxDriver; Handle(TOcafFunction_BoxDriver) myBoxDriver;
// Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID // Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID
@ -143,7 +143,7 @@ TDF_Label TOcaf_Commands::CreateCyl(Standard_Real x, Standard_Real y, Standard_R
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CylDriver::GetID()); Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CylDriver::GetID());
// Initialize and execute the cylinder driver (look at the "Execute()" code) // Initialize and execute the cylinder driver (look at the "Execute()" code)
TFunction_Logbook log; Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
Handle(TOcafFunction_CylDriver) myCylDriver; Handle(TOcafFunction_CylDriver) myCylDriver;
// Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID // Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID
@ -156,7 +156,7 @@ TDF_Label TOcaf_Commands::CreateCyl(Standard_Real x, Standard_Real y, Standard_R
} }
TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString &Name, TFunction_Logbook &log) TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString &Name, Handle(TFunction_Logbook) &log)
{ {
// Set the name attribute (if it's not null) // Set the name attribute (if it's not null)
Handle(TDataStd_Name) myStdName; Handle(TDataStd_Name) myStdName;
@ -170,7 +170,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(1), w); TDataStd_Real::Set(MainLab.FindChild(1), w);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(2).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(2).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -178,7 +178,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(2), l); TDataStd_Real::Set(MainLab.FindChild(2), l);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(3).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(3).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -186,7 +186,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(3), h); TDataStd_Real::Set(MainLab.FindChild(3), h);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(4).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(4).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -194,7 +194,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(4), x); TDataStd_Real::Set(MainLab.FindChild(4), x);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(5).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(5).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -202,7 +202,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(5), y); TDataStd_Real::Set(MainLab.FindChild(5), y);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(6).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(6).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -210,7 +210,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(6), z); TDataStd_Real::Set(MainLab.FindChild(6), z);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
// Get the TFunction_Function used to create the box // Get the TFunction_Function used to create the box
@ -231,7 +231,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
if (myBoxDriver->MustExecute(log)) if (myBoxDriver->MustExecute(log))
{ {
// Set the box touched, it will be usefull to recompute an object which used this box as attribute // Set the box touched, it will be usefull to recompute an object which used this box as attribute
log.SetTouched(MainLab); log->SetTouched(MainLab);
if(myBoxDriver->Execute(log)) if(myBoxDriver->Execute(log))
MessageBox (NULL, L"Recompute failed", L"Modify box", MB_ICONEXCLAMATION); MessageBox (NULL, L"Recompute failed", L"Modify box", MB_ICONEXCLAMATION);
} }
@ -239,7 +239,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
return MainLab; return MainLab;
} }
TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString &Name, TFunction_Logbook &log) TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString &Name, Handle(TFunction_Logbook) &log)
{ {
// Set the name attribute (if it's not null) // Set the name attribute (if it's not null)
Handle(TDataStd_Name) myStdName; Handle(TDataStd_Name) myStdName;
@ -253,7 +253,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(1), r); TDataStd_Real::Set(MainLab.FindChild(1), r);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(2).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(2).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -261,7 +261,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(2), h); TDataStd_Real::Set(MainLab.FindChild(2), h);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(3).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(3).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -269,7 +269,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(3), x); TDataStd_Real::Set(MainLab.FindChild(3), x);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(4).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(4).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -277,7 +277,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(4), y); TDataStd_Real::Set(MainLab.FindChild(4), y);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
MainLab.FindChild(5).FindAttribute(TDataStd_Real::GetID(),curReal); MainLab.FindChild(5).FindAttribute(TDataStd_Real::GetID(),curReal);
@ -285,7 +285,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
{ {
TDataStd_Real::Set(MainLab.FindChild(5), z); TDataStd_Real::Set(MainLab.FindChild(5), z);
// Set the label of the attribute as touched for next recomputation // Set the label of the attribute as touched for next recomputation
log.SetTouched(curReal->Label()); log->SetTouched(curReal->Label());
} }
// Get the TFunction_Function used to create the cylinder // Get the TFunction_Function used to create the cylinder
@ -306,7 +306,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
if (myCylDriver->MustExecute(log)) if (myCylDriver->MustExecute(log))
{ {
// Set the cylinder touched, it will be usefull to recompute an object which used this cylinder as attribute // Set the cylinder touched, it will be usefull to recompute an object which used this cylinder as attribute
log.SetTouched(MainLab); log->SetTouched(MainLab);
if(myCylDriver->Execute(log)) if(myCylDriver->Execute(log))
MessageBoxW (NULL, L"Recompute failed", L"Modify cylinder", MB_ICONEXCLAMATION); MessageBoxW (NULL, L"Recompute failed", L"Modify cylinder", MB_ICONEXCLAMATION);
} }
@ -344,7 +344,7 @@ TDF_Label TOcaf_Commands::Cut(TDF_Label ObjectLab, TDF_Label ToolObjectLab)
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CutDriver::GetID()); Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CutDriver::GetID());
// Initialize and execute the cut driver (look at the "Execute()" code) // Initialize and execute the cut driver (look at the "Execute()" code)
TFunction_Logbook log; Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
Handle(TOcafFunction_CutDriver) myCutDriver; Handle(TOcafFunction_CutDriver) myCutDriver;
// Find the TOcafFunction_CutDriver in the TFunction_DriverTable using its GUID // Find the TOcafFunction_CutDriver in the TFunction_DriverTable using its GUID

View File

@ -43,9 +43,9 @@ class TOcaf_Commands {
public: public:
TDF_Label Cut( TDF_Label ObjectLab, TDF_Label ToolObjectLab); TDF_Label Cut( TDF_Label ObjectLab, TDF_Label ToolObjectLab);
TDF_Label ModifyBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name, TFunction_Logbook &log); TDF_Label ModifyBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name, Handle(TFunction_Logbook) &log);
TDF_Label CreateBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name); TDF_Label CreateBox(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString& Name);
TDF_Label ModifyCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString &Name, TFunction_Logbook &log); TDF_Label ModifyCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString &Name, Handle(TFunction_Logbook) &log);
TDF_Label CreateCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString& Name); TDF_Label CreateCyl(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real r, Standard_Real h, const TCollection_ExtendedString& Name);
// Methods PUBLIC // Methods PUBLIC

View File

@ -75,14 +75,14 @@ DNaming_BooleanOperationDriver::DNaming_BooleanOperationDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_BooleanOperationDriver::Validate(TFunction_Logbook&) const void DNaming_BooleanOperationDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_BooleanOperationDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_BooleanOperationDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -91,7 +91,7 @@ Standard_Boolean DNaming_BooleanOperationDriver::MustExecute(const TFunction_Log
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_BooleanOperationDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_BooleanOperationDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -162,7 +162,7 @@ Standard_Integer DNaming_BooleanOperationDriver::Execute(TFunction_Logbook& theL
} }
if(!anIsDone) return -1; if(!anIsDone) return -1;
else { else {
theLog.SetValid(RESPOSITION(aFunction),Standard_True); theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -44,14 +44,14 @@ DNaming_BoxDriver::DNaming_BoxDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_BoxDriver::Validate(TFunction_Logbook&) const void DNaming_BoxDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_BoxDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_BoxDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -60,7 +60,7 @@ Standard_Boolean DNaming_BoxDriver::MustExecute(const TFunction_Logbook&) const
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_BoxDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_BoxDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -103,7 +103,7 @@ Standard_Integer DNaming_BoxDriver::Execute(TFunction_Logbook& theLog) const
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True); TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
theLog.SetValid(RESPOSITION(aFunction), Standard_True); theLog->SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;

View File

@ -48,17 +48,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -51,14 +51,14 @@ DNaming_CylinderDriver::DNaming_CylinderDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_CylinderDriver::Validate(TFunction_Logbook&) const void DNaming_CylinderDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_CylinderDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_CylinderDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -67,7 +67,7 @@ Standard_Boolean DNaming_CylinderDriver::MustExecute(const TFunction_Logbook&) c
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_CylinderDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_CylinderDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -155,8 +155,7 @@ Standard_Integer DNaming_CylinderDriver::Execute(TFunction_Logbook& theLog) cons
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True); TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
theLog->SetValid(RESPOSITION(aFunction), Standard_True);
theLog.SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -48,17 +48,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -52,14 +52,14 @@ DNaming_FilletDriver::DNaming_FilletDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_FilletDriver::Validate(TFunction_Logbook&) const void DNaming_FilletDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_FilletDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_FilletDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -68,7 +68,7 @@ Standard_Boolean DNaming_FilletDriver::MustExecute(const TFunction_Logbook&) con
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_FilletDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_FilletDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -160,7 +160,7 @@ Standard_Integer DNaming_FilletDriver::Execute(TFunction_Logbook& theLog) const
// Naming // Naming
LoadNamingDS(RESPOSITION(aFunction), aMkFillet, aCONTEXT); LoadNamingDS(RESPOSITION(aFunction), aMkFillet, aCONTEXT);
theLog.SetValid(RESPOSITION(aFunction),Standard_True); theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -64,14 +64,14 @@ DNaming_Line3DDriver::DNaming_Line3DDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <theLog>. //purpose : Validates labels of a function in <theLog>.
//======================================================================= //=======================================================================
void DNaming_Line3DDriver::Validate(TFunction_Logbook&) const void DNaming_Line3DDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <theLog> if the loaded function must be executed //purpose : Analyse in <theLog> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_Line3DDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_Line3DDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -80,7 +80,7 @@ Standard_Boolean DNaming_Line3DDriver::MustExecute(const TFunction_Logbook&) con
//function : Execute //function : Execute
//purpose : Execute the function //purpose : Execute the function
//======================================================================= //=======================================================================
Standard_Integer DNaming_Line3DDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_Line3DDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -185,7 +185,7 @@ Standard_Integer DNaming_Line3DDriver::Execute(TFunction_Logbook& theLog) const
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(aResultLabel, aLocation, Standard_True); TNaming::Displace(aResultLabel, aLocation, Standard_True);
theLog.SetValid(aResultLabel, Standard_True); theLog->SetValid(aResultLabel, Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -455,18 +455,12 @@ static Standard_Integer DNaming_BoxDZ (Draw_Interpretor& theDI,
return 1; return 1;
} }
//=======================================================================
static TFunction_Logbook& GetLogBook ()
{
static TFunction_Logbook myLog;
return myLog;
}
//======================================================================= //=======================================================================
//function : Compute //function : Compute
//purpose : Performs the calling to a driver with the given Function ID. //purpose : Performs the calling to a driver with the given Function ID.
//======================================================================= //=======================================================================
static Standard_Integer ComputeFunction(const Handle(TFunction_Function)& theFun, static Standard_Integer ComputeFunction(const Handle(TFunction_Function)& theFun,
TFunction_Logbook& theLog) Handle(TFunction_Logbook)& theLog)
{ {
Handle(TFunction_DriverTable) aTable = TFunction_DriverTable::Get(); Handle(TFunction_DriverTable) aTable = TFunction_DriverTable::Get();
Handle(TFunction_Driver) aDriver; Handle(TFunction_Driver) aDriver;
@ -506,6 +500,7 @@ static Standard_Integer DNaming_SolveFlatFrom (Draw_Interpretor& /*theDI*/,
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "DNaming_SolveFlatFrom: Father label = " << entry << endl; cout << "DNaming_SolveFlatFrom: Father label = " << entry << endl;
#endif #endif
Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(FatherLab);
Standard_Boolean found(Standard_False); Standard_Boolean found(Standard_False);
TDF_ChildIterator it(FatherLab, Standard_False); TDF_ChildIterator it(FatherLab, Standard_False);
for(;it.More(); it.Next()) { for(;it.More(); it.Next()) {
@ -526,7 +521,9 @@ static Standard_Integer DNaming_SolveFlatFrom (Draw_Interpretor& /*theDI*/,
else { else {
TDF_Tool::Entry(funLabel, entry); TDF_Tool::Entry(funLabel, entry);
try { try {
Standard_Integer aRes = ComputeFunction(aFun, GetLogBook()); // We clear the logbook because the execution starts not from the begining of the function list (some functions ar skipped).
logbook->Clear();
Standard_Integer aRes = ComputeFunction(aFun, logbook);
if(aRes != 0) { if(aRes != 0) {
cout << "DNaming_SolveFlatFrom: Driver failed at label = " << entry << endl; cout << "DNaming_SolveFlatFrom: Driver failed at label = " << entry << endl;
return 1; return 1;
@ -558,13 +555,14 @@ static Standard_Integer DNaming_InitLogBook (Draw_Interpretor& /*theDI*/,
Handle(TDocStd_Document) aDoc; Handle(TDocStd_Document) aDoc;
Standard_CString aDocS(theArg[1]); Standard_CString aDocS(theArg[1]);
if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; if (!DDocStd::GetDocument(aDocS, aDoc)) return 1;
if(GetLogBook().IsEmpty()) { Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(aDoc->Main());
if(logbook->IsEmpty()) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "DNaming_InitLogBook : is empty" <<endl; cout << "DNaming_InitLogBook : is empty" <<endl;
#endif #endif
} }
else { else {
GetLogBook().Clear(); logbook->Clear();
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "DNaming_InitLogBook : cleaned" <<endl; cout << "DNaming_InitLogBook : cleaned" <<endl;
#endif #endif
@ -586,12 +584,12 @@ static Standard_Integer DNaming_CheckLogBook (Draw_Interpretor& /*theDI*/,
if (theNb == 2) { if (theNb == 2) {
Handle(TDocStd_Document) aDoc; Handle(TDocStd_Document) aDoc;
Standard_CString aDocS(theArg[1]); Standard_CString aDocS(theArg[1]);
if (!DDocStd::GetDocument(aDocS, aDoc)) return 1; if (!DDocStd::GetDocument(aDocS, aDoc)) return 1;
if(GetLogBook().IsEmpty()) Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(aDoc->Main());
if(logbook->IsEmpty())
cout << "DNaming_CheckLogBook : is empty" <<endl; cout << "DNaming_CheckLogBook : is empty" <<endl;
else { else {
TDF_LabelMap aMap; const TDF_LabelMap& aMap = logbook->GetValid();
aMap = GetLogBook().GetValid();
TDF_MapIteratorOfLabelMap it(aMap); TDF_MapIteratorOfLabelMap it(aMap);
TCollection_AsciiString entry; TCollection_AsciiString entry;
cout << "DNaming_CheckLogBook : LogBook current state:" <<endl; cout << "DNaming_CheckLogBook : LogBook current state:" <<endl;
@ -625,7 +623,8 @@ static Standard_Integer DNaming_ComputeFun (Draw_Interpretor& /*theDI*/,
funLabel.FindAttribute(TFunction_Function::GetID(), aFun); funLabel.FindAttribute(TFunction_Function::GetID(), aFun);
if(aFun.IsNull()) return 1; if(aFun.IsNull()) return 1;
if(!aFun.IsNull()) { if(!aFun.IsNull()) {
Standard_Integer aRes = ComputeFunction(aFun, GetLogBook()); Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(funLabel);
Standard_Integer aRes = ComputeFunction(aFun, logbook);
if(aRes != 0) { if(aRes != 0) {
cout << "DNaming_ComputeFun : No Driver or Driver failed" << endl; cout << "DNaming_ComputeFun : No Driver or Driver failed" << endl;
return 1; return 1;
@ -2169,7 +2168,7 @@ void DNaming::ModelingCommands (Draw_Interpretor& theCommands)
__FILE__, DNaming_AddObject, g2); __FILE__, DNaming_AddObject, g2);
theCommands.Add ("AddFunction", theCommands.Add ("AddFunction",
"AddFunction D ObjEntry FunNane[Box|Sph|Cyl|Cut|Fuse|Prism|Revol|PMove|Fillet|Attach|XAttach]", "AddFunction D ObjEntry FunName[Box|Sph|Cyl|Cut|Fuse|Prism|Revol|PMove|Fillet|Attach|XAttach]",
__FILE__, DNaming_AddFunction, g2); __FILE__, DNaming_AddFunction, g2);
theCommands.Add ("AddBox", "AddBox Doc dx dy dz", __FILE__, DNaming_AddBox, g2); theCommands.Add ("AddBox", "AddBox Doc dx dy dz", __FILE__, DNaming_AddBox, g2);

View File

@ -47,14 +47,14 @@ DNaming_PointDriver::DNaming_PointDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_PointDriver::Validate(TFunction_Logbook&) const void DNaming_PointDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_PointDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_PointDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -63,7 +63,7 @@ Standard_Boolean DNaming_PointDriver::MustExecute(const TFunction_Logbook&) cons
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_PointDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_PointDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -117,7 +117,7 @@ Standard_Integer DNaming_PointDriver::Execute(TFunction_Logbook& theLog) const
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(aResultLabel, aLocation, Standard_True); TNaming::Displace(aResultLabel, aLocation, Standard_True);
theLog.SetValid(aResultLabel, Standard_True); theLog->SetValid(aResultLabel, Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;

View File

@ -46,17 +46,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -66,14 +66,14 @@ DNaming_PrismDriver::DNaming_PrismDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <theLog>. //purpose : Validates labels of a function in <theLog>.
//======================================================================= //=======================================================================
void DNaming_PrismDriver::Validate(TFunction_Logbook&) const void DNaming_PrismDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyses in <theLog> if the loaded function must be executed //purpose : Analyses in <theLog> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_PrismDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_PrismDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -94,7 +94,7 @@ static void Write(const TopoDS_Shape& shape,
//function : Execute //function : Execute
//purpose : Executes the function //purpose : Executes the function
//======================================================================= //=======================================================================
Standard_Integer DNaming_PrismDriver::Execute(TFunction_Logbook& theLog) const { Standard_Integer DNaming_PrismDriver::Execute(Handle(TFunction_Logbook)& theLog) const {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(), aFunction); Label().FindAttribute(TFunction_Function::GetID(), aFunction);
if(aFunction.IsNull()) return -1; if(aFunction.IsNull()) return -1;
@ -206,7 +206,7 @@ Standard_Integer DNaming_PrismDriver::Execute(TFunction_Logbook& theLog) const {
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True); TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
theLog.SetValid(RESPOSITION(aFunction),Standard_True); theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -70,14 +70,14 @@ DNaming_RevolutionDriver::DNaming_RevolutionDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <theLog>. //purpose : Validates labels of a function in <theLog>.
//======================================================================= //=======================================================================
void DNaming_RevolutionDriver::Validate(TFunction_Logbook&) const void DNaming_RevolutionDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyses in <theLog> if the loaded function must be executed //purpose : Analyses in <theLog> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_RevolutionDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_RevolutionDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -86,7 +86,7 @@ Standard_Boolean DNaming_RevolutionDriver::MustExecute(const TFunction_Logbook&)
//function : Execute //function : Execute
//purpose : Executes the function //purpose : Executes the function
//======================================================================= //=======================================================================
Standard_Integer DNaming_RevolutionDriver::Execute(TFunction_Logbook& theLog) const { Standard_Integer DNaming_RevolutionDriver::Execute(Handle(TFunction_Logbook)& theLog) const {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(), aFunction); Label().FindAttribute(TFunction_Function::GetID(), aFunction);
if(aFunction.IsNull()) return -1; if(aFunction.IsNull()) return -1;
@ -259,7 +259,7 @@ Standard_Integer DNaming_RevolutionDriver::Execute(TFunction_Logbook& theLog) co
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True); TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
theLog.SetValid(RESPOSITION(aFunction),Standard_True); theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -45,7 +45,7 @@ DNaming_SelectionDriver::DNaming_SelectionDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <theLog>. //purpose : Validates labels of a function in <theLog>.
//======================================================================= //=======================================================================
void DNaming_SelectionDriver::Validate(TFunction_Logbook& ) const void DNaming_SelectionDriver::Validate(Handle(TFunction_Logbook)& ) const
{} {}
//======================================================================= //=======================================================================
@ -53,7 +53,7 @@ void DNaming_SelectionDriver::Validate(TFunction_Logbook& ) const
//purpose : Analyse in <theLog> if the loaded function must be //purpose : Analyse in <theLog> if the loaded function must be
// executed (i.e.arguments are modified) or not. // executed (i.e.arguments are modified) or not.
//======================================================================= //=======================================================================
Standard_Boolean DNaming_SelectionDriver::MustExecute(const TFunction_Logbook& ) const { Standard_Boolean DNaming_SelectionDriver::MustExecute(const Handle(TFunction_Logbook)& ) const {
return Standard_True; return Standard_True;
} }
@ -82,7 +82,7 @@ static void Write(const TopoDS_Shape& shape,
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TDF_ChildIterator.hxx> #include <TDF_ChildIterator.hxx>
Standard_Integer DNaming_SelectionDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_SelectionDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -105,7 +105,7 @@ Standard_Integer DNaming_SelectionDriver::Execute(TFunction_Logbook& theLog) con
TNaming_Selector aSelector(aRLabel); TNaming_Selector aSelector(aRLabel);
TDF_LabelMap aMap; TDF_LabelMap aMap;
aMap = theLog.ChangeValid(); theLog->GetValid(aMap);
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout <<"#E_DNaming_SelectionDriver:: Valid Label Map:"<<endl; cout <<"#E_DNaming_SelectionDriver:: Valid Label Map:"<<endl;
TDF_MapIteratorOfLabelMap anItr(aMap); TDF_MapIteratorOfLabelMap anItr(aMap);
@ -126,7 +126,7 @@ Standard_Integer DNaming_SelectionDriver::Execute(TFunction_Logbook& theLog) con
//*** //***
if(aSelector.Solve(aMap)) { if(aSelector.Solve(aMap)) {
theLog.SetValid(aRLabel); theLog->SetValid(aRLabel);
Handle(TNaming_NamedShape) aNS; Handle(TNaming_NamedShape) aNS;
if(!aRLabel.FindAttribute(TNaming_NamedShape::GetID(),aNS)) { if(!aRLabel.FindAttribute(TNaming_NamedShape::GetID(),aNS)) {
cout <<"%%%WARNING: DNaming_SelectionDriver::NamedShape is not found"<<endl; cout <<"%%%WARNING: DNaming_SelectionDriver::NamedShape is not found"<<endl;

View File

@ -46,17 +46,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -55,14 +55,14 @@ DNaming_SphereDriver::DNaming_SphereDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <theLog> //purpose : Validates labels of a function in <theLog>
//======================================================================= //=======================================================================
void DNaming_SphereDriver::Validate(TFunction_Logbook&) const void DNaming_SphereDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyses in <theLog> if the loaded function must be executed //purpose : Analyses in <theLog> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_SphereDriver::MustExecute(const TFunction_Logbook&) const { Standard_Boolean DNaming_SphereDriver::MustExecute(const Handle(TFunction_Logbook)&) const {
return Standard_True; return Standard_True;
} }
@ -70,7 +70,7 @@ Standard_Boolean DNaming_SphereDriver::MustExecute(const TFunction_Logbook&) con
//function : Execute //function : Execute
//purpose : Executes the function //purpose : Executes the function
//======================================================================= //=======================================================================
Standard_Integer DNaming_SphereDriver::Execute(TFunction_Logbook& theLog) const { Standard_Integer DNaming_SphereDriver::Execute(Handle(TFunction_Logbook)& theLog) const {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(aFunction.IsNull()) return -1; if(aFunction.IsNull()) return -1;
@ -127,7 +127,7 @@ Standard_Integer DNaming_SphereDriver::Execute(TFunction_Logbook& theLog) const
if(!aLocation.IsIdentity()) if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True); TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
theLog.SetValid(RESPOSITION(aFunction), Standard_True); theLog->SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -48,17 +48,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -86,14 +86,14 @@ DNaming_TransformationDriver::DNaming_TransformationDriver()
//function : Validate //function : Validate
//purpose : Validates labels of a function in <log>. //purpose : Validates labels of a function in <log>.
//======================================================================= //=======================================================================
void DNaming_TransformationDriver::Validate(TFunction_Logbook&) const void DNaming_TransformationDriver::Validate(Handle(TFunction_Logbook)&) const
{} {}
//======================================================================= //=======================================================================
//function : MustExecute //function : MustExecute
//purpose : Analyse in <log> if the loaded function must be executed //purpose : Analyse in <log> if the loaded function must be executed
//======================================================================= //=======================================================================
Standard_Boolean DNaming_TransformationDriver::MustExecute(const TFunction_Logbook&) const Standard_Boolean DNaming_TransformationDriver::MustExecute(const Handle(TFunction_Logbook)&) const
{ {
return Standard_True; return Standard_True;
} }
@ -103,7 +103,7 @@ Standard_Boolean DNaming_TransformationDriver::MustExecute(const TFunction_Logbo
//function : Execute //function : Execute
//purpose : Execute the function and push in <log> the impacted labels //purpose : Execute the function and push in <log> the impacted labels
//======================================================================= //=======================================================================
Standard_Integer DNaming_TransformationDriver::Execute(TFunction_Logbook& theLog) const Standard_Integer DNaming_TransformationDriver::Execute(Handle(TFunction_Logbook)& theLog) const
{ {
Handle(TFunction_Function) aFunction; Handle(TFunction_Function) aFunction;
Label().FindAttribute(TFunction_Function::GetID(),aFunction); Label().FindAttribute(TFunction_Function::GetID(),aFunction);
@ -178,7 +178,7 @@ Standard_Integer DNaming_TransformationDriver::Execute(TFunction_Logbook& theLog
// Naming // Naming
LoadNamingDS(RESPOSITION(aFunction), aContextNS, aTransformation); LoadNamingDS(RESPOSITION(aFunction), aContextNS, aTransformation);
theLog.SetValid(RESPOSITION(aFunction),Standard_True); theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE); aFunction->SetFailure(DONE);
return 0; return 0;
} }

View File

@ -49,17 +49,17 @@ public:
//! the valid label scope. //! the valid label scope.
//! execution of function //! execution of function
//! ====================== //! ======================
Standard_EXPORT virtual void Validate (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Analyse in <log> if the loaded function must be executed //! Analyse in <log> if the loaded function must be executed
//! (i.e.arguments are modified) or not. //! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must //! If the Function label itself is modified, the function must
//! be executed. //! be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;
//! Execute the function and push in <log> the impacted //! Execute the function and push in <log> the impacted
//! labels (see method SetImpacted). //! labels (see method SetImpacted).
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& theLog) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& theLog) const Standard_OVERRIDE;

View File

@ -47,14 +47,15 @@ void TFunction_Driver::Init(const TDF_Label& L)
//purpose : Validates labels of a function //purpose : Validates labels of a function
//======================================================================= //=======================================================================
void TFunction_Driver::Validate(TFunction_Logbook& log) const void TFunction_Driver::Validate(Handle(TFunction_Logbook)& log) const
{ {
TDF_LabelList res; TDF_LabelList res;
Results(res); Results(res);
TDF_ListIteratorOfLabelList itr(res); TDF_ListIteratorOfLabelList itr(res);
for (; itr.More(); itr.Next()) for (; itr.More(); itr.Next())
{ {
log.SetValid(itr.Value(), Standard_True); log->SetValid(itr.Value(), Standard_True);
} }
} }
@ -64,15 +65,16 @@ void TFunction_Driver::Validate(TFunction_Logbook& log) const
//purpose : Analyzes the labels in the logbook //purpose : Analyzes the labels in the logbook
//======================================================================= //=======================================================================
Standard_Boolean TFunction_Driver::MustExecute(const TFunction_Logbook& log) const Standard_Boolean TFunction_Driver::MustExecute(const Handle(TFunction_Logbook)& log) const
{ {
// Check modification of arguments. // Check modification of arguments.
TDF_LabelList args; TDF_LabelList args;
Arguments(args); Arguments(args);
TDF_ListIteratorOfLabelList itr(args); TDF_ListIteratorOfLabelList itr(args);
for (; itr.More(); itr.Next()) for (; itr.More(); itr.Next())
{ {
if (log.IsModified(itr.Value())) if (log->IsModified(itr.Value()))
return Standard_True; return Standard_True;
} }
return Standard_False; return Standard_False;

View File

@ -62,18 +62,18 @@ public:
//! method even if the function is not executed. //! method even if the function is not executed.
//! execution of function //! execution of function
//! ===================== //! =====================
Standard_EXPORT virtual void Validate (TFunction_Logbook& log) const; Standard_EXPORT virtual void Validate (Handle(TFunction_Logbook)& log) const;
//! Analyzes the labels in the logbook log. //! Analyzes the labels in the logbook log.
//! Returns true if attributes have been modified. //! Returns true if attributes have been modified.
//! If the function label itself has been modified, the function must be executed. //! If the function label itself has been modified, the function must be executed.
Standard_EXPORT virtual Standard_Boolean MustExecute (const TFunction_Logbook& log) const; Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle(TFunction_Logbook)& log) const;
//! Executes the function in this function driver and //! Executes the function in this function driver and
//! puts the impacted labels in the logbook log. //! puts the impacted labels in the logbook log.
//! arguments & results of functions //! arguments & results of functions
//! ================================ //! ================================
Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& log) const = 0; Standard_EXPORT virtual Standard_Integer Execute (Handle(TFunction_Logbook)& log) const = 0;
//! The method fills-in the list by labels, //! The method fills-in the list by labels,
//! where the arguments of the function are located. //! where the arguments of the function are located.

View File

@ -406,7 +406,7 @@ const TFunction_DoubleMapOfIntegerLabel& TFunction_IFunction::GetAllFunctions()
//purpose : Returns the Logbook. //purpose : Returns the Logbook.
//======================================================================= //=======================================================================
TFunction_Logbook& TFunction_IFunction::GetLogbook() const Handle(TFunction_Logbook) TFunction_IFunction::GetLogbook() const
{ {
return TFunction_Scope::Set(myLabel)->GetLogbook(); return TFunction_Scope::Set(myLabel)->GetLogbook();
} }

View File

@ -97,7 +97,7 @@ public:
Standard_EXPORT const TFunction_DoubleMapOfIntegerLabel& GetAllFunctions() const; Standard_EXPORT const TFunction_DoubleMapOfIntegerLabel& GetAllFunctions() const;
//! Returns the Logbook - keeper of modifications. //! Returns the Logbook - keeper of modifications.
Standard_EXPORT TFunction_Logbook& GetLogbook() const; Standard_EXPORT Handle(TFunction_Logbook) GetLogbook() const;
//! Returns a driver of the function. //! Returns a driver of the function.
Standard_EXPORT Handle(TFunction_Driver) GetDriver (const Standard_Integer thread = 0) const; Standard_EXPORT Handle(TFunction_Driver) GetDriver (const Standard_Integer thread = 0) const;

View File

@ -21,8 +21,46 @@
#include <TDF_Label.hxx> #include <TDF_Label.hxx>
#include <TDF_LabelMap.hxx> #include <TDF_LabelMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx> #include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx> #include <TDF_Tool.hxx>
#include <TFunction_Logbook.hxx> #include <TFunction_Logbook.hxx>
#include <Standard_GUID.hxx>
//=======================================================================
//function : GetID
//purpose : Static method to get an ID
//=======================================================================
const Standard_GUID& TFunction_Logbook::GetID()
{
static Standard_GUID TFunction_LogbookID("CF519724-5CA4-4B90-835F-8919BE1DDE4B");
return TFunction_LogbookID;
}
//=======================================================================
//function : Set
//purpose : Finds or creates a Scope attribute
//=======================================================================
Handle(TFunction_Logbook) TFunction_Logbook::Set(const TDF_Label& Access)
{
Handle(TFunction_Logbook) S;
if (!Access.Root().FindAttribute(TFunction_Logbook::GetID(), S))
{
S = new TFunction_Logbook();
Access.Root().AddAttribute(S);
}
return S;
}
//=======================================================================
//function : ID
//purpose : Returns GUID of the function
//=======================================================================
const Standard_GUID& TFunction_Logbook::ID() const
{
return GetID();
}
//======================================================================= //=======================================================================
//function : TFunction_Logbook //function : TFunction_Logbook
@ -38,9 +76,13 @@ TFunction_Logbook::TFunction_Logbook():isDone(Standard_False)
void TFunction_Logbook::Clear() void TFunction_Logbook::Clear()
{ {
myTouched.Clear(); if (!IsEmpty())
myImpacted.Clear(); {
myValid.Clear(); Backup();
myTouched.Clear();
myImpacted.Clear();
myValid.Clear();
}
} }
//======================================================================= //=======================================================================
@ -59,15 +101,22 @@ Standard_Boolean TFunction_Logbook::IsEmpty () const
//======================================================================= //=======================================================================
Standard_Boolean TFunction_Logbook::IsModified(const TDF_Label& L, Standard_Boolean TFunction_Logbook::IsModified(const TDF_Label& L,
const Standard_Boolean WithChildren) const const Standard_Boolean WithChildren) const
{ {
if (myTouched.Contains(L)) return Standard_True; if (myTouched.Contains(L))
if (myImpacted.Contains(L)) return Standard_True; return Standard_True;
if (WithChildren) { if (myImpacted.Contains(L))
return Standard_True;
if (WithChildren)
{
TDF_ChildIterator itr(L); TDF_ChildIterator itr(L);
for (; itr.More(); itr.Next()) for (; itr.More(); itr.Next())
{
if (IsModified(itr.Value(), Standard_True)) if (IsModified(itr.Value(), Standard_True))
return Standard_True; {
return Standard_True;
}
}
} }
return Standard_False; return Standard_False;
} }
@ -78,34 +127,169 @@ Standard_Boolean TFunction_Logbook::IsModified(const TDF_Label& L,
//======================================================================= //=======================================================================
void TFunction_Logbook::SetValid(const TDF_Label& L, void TFunction_Logbook::SetValid(const TDF_Label& L,
const Standard_Boolean WithChildren) const Standard_Boolean WithChildren)
{ {
Backup();
myValid.Add(L); myValid.Add(L);
if (WithChildren) { if (WithChildren)
{
TDF_ChildIterator itr(L, Standard_True); TDF_ChildIterator itr(L, Standard_True);
for (; itr.More(); itr.Next()) { for (; itr.More(); itr.Next())
{
myValid.Add(itr.Value()); myValid.Add(itr.Value());
} }
} }
} }
void TFunction_Logbook::SetValid(const TDF_LabelMap& Ls)
{
Backup();
TDF_MapIteratorOfLabelMap itrm(Ls);
for (; itrm.More(); itrm.Next())
{
const TDF_Label& L = itrm.Key();
myValid.Add(L);
}
}
//======================================================================= //=======================================================================
//function : SetImpacted //function : SetImpacted
//purpose : //purpose :
//======================================================================= //=======================================================================
void TFunction_Logbook::SetImpacted(const TDF_Label& L, void TFunction_Logbook::SetImpacted(const TDF_Label& L,
const Standard_Boolean WithChildren) const Standard_Boolean WithChildren)
{ {
Backup();
myImpacted.Add(L); myImpacted.Add(L);
if (WithChildren) { if (WithChildren)
{
TDF_ChildIterator itr(L, Standard_True); TDF_ChildIterator itr(L, Standard_True);
for (; itr.More(); itr.Next()) { for (; itr.More(); itr.Next())
{
myImpacted.Add(itr.Value()); myImpacted.Add(itr.Value());
} }
} }
} }
//=======================================================================
//function : GetValid
//purpose : Returns valid labels.
//=======================================================================
void TFunction_Logbook::GetValid(TDF_LabelMap& Ls) const
{
// Copy valid labels.
TDF_MapIteratorOfLabelMap itrm(myValid);
for (; itrm.More(); itrm.Next())
{
const TDF_Label& L = itrm.Key();
Ls.Add(L);
}
}
//=======================================================================
//function : Restore
//purpose : Undos (and redos) the attribute.
//=======================================================================
void TFunction_Logbook::Restore(const Handle(TDF_Attribute)& other)
{
Handle(TFunction_Logbook) logbook = Handle(TFunction_Logbook)::DownCast(other);
// Status.
isDone = logbook->isDone;
// Valid labels
TDF_MapIteratorOfLabelMap itrm;
for (itrm.Initialize(logbook->myValid); itrm.More(); itrm.Next())
{
myValid.Add(itrm.Key());
}
// Touched labels
for (itrm.Initialize(logbook->myTouched); itrm.More(); itrm.Next())
{
myTouched.Add(itrm.Key());
}
// Impacted labels
for (itrm.Initialize(logbook->myImpacted); itrm.More(); itrm.Next())
{
myImpacted.Add(itrm.Key());
}
}
//=======================================================================
//function : Paste
//purpose : Method for Copy mechanism
//=======================================================================
void TFunction_Logbook::Paste(const Handle(TDF_Attribute)& into,
const Handle(TDF_RelocationTable)& RT) const
{
Handle(TFunction_Logbook) logbook = Handle(TFunction_Logbook)::DownCast(into);
// Status.
logbook->isDone = isDone;
// Touched.
logbook->myTouched.Clear();
TDF_MapIteratorOfLabelMap itr(myTouched);
for (; itr.More(); itr.Next())
{
const TDF_Label& L = itr.Value();
if (!L.IsNull())
{
TDF_Label relocL;
if (RT->HasRelocation(L, relocL))
logbook->myTouched.Add(relocL);
else
logbook->myTouched.Add(L);
}
}
// Impacted.
logbook->myImpacted.Clear();
itr.Initialize(myImpacted);
for (; itr.More(); itr.Next())
{
const TDF_Label& L = itr.Value();
if (!L.IsNull())
{
TDF_Label relocL;
if (RT->HasRelocation(L, relocL))
logbook->myImpacted.Add(relocL);
else
logbook->myImpacted.Add(L);
}
}
// Valid.
logbook->myValid.Clear();
itr.Initialize(myValid);
for (; itr.More(); itr.Next())
{
const TDF_Label& L = itr.Value();
if (!L.IsNull())
{
TDF_Label relocL;
if (RT->HasRelocation(L, relocL))
logbook->myValid.Add(relocL);
else
logbook->myValid.Add(L);
}
}
}
//=======================================================================
//function : NewEmpty
//purpose : Returns new empty graph node attribute
//=======================================================================
Handle(TDF_Attribute) TFunction_Logbook::NewEmpty() const
{
return new TFunction_Logbook();
}
//======================================================================= //=======================================================================
//function : Dump //function : Dump
//purpose : Dump of modifications //purpose : Dump of modifications
@ -118,17 +302,20 @@ Standard_OStream& TFunction_Logbook::Dump(Standard_OStream& stream) const
stream<<"Done = "<<isDone<<endl; stream<<"Done = "<<isDone<<endl;
stream<<"Touched labels: "<<endl; stream<<"Touched labels: "<<endl;
for (itr.Initialize(myTouched); itr.More(); itr.Next()) { for (itr.Initialize(myTouched); itr.More(); itr.Next())
{
TDF_Tool::Entry(itr.Key(), as); TDF_Tool::Entry(itr.Key(), as);
stream<<as<<endl; stream<<as<<endl;
} }
stream<<"Impacted labels: "<<endl; stream<<"Impacted labels: "<<endl;
for (itr.Initialize(myImpacted); itr.More(); itr.Next()) { for (itr.Initialize(myImpacted); itr.More(); itr.Next())
{
TDF_Tool::Entry(itr.Key(), as); TDF_Tool::Entry(itr.Key(), as);
stream<<as<<endl; stream<<as<<endl;
} }
stream<<"Valid labels: "<<endl; stream<<"Valid labels: "<<endl;
for (itr.Initialize(myValid); itr.More(); itr.Next()) { for (itr.Initialize(myValid); itr.More(); itr.Next())
{
TDF_Tool::Entry(itr.Key(), as); TDF_Tool::Entry(itr.Key(), as);
stream<<as<<endl; stream<<as<<endl;
} }

View File

@ -22,10 +22,17 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <TDF_LabelMap.hxx> #include <TDF_LabelMap.hxx>
#include <TDF_Attribute.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx> #include <Standard_OStream.hxx>
class TDF_Label; class TDF_Label;
class Standard_GUID;
class TFunction_Logbook;
class TDF_Attribute;
class TDF_RelocationTable;
class TFunction_Logbook;
DEFINE_STANDARD_HANDLE(TFunction_Logbook, TDF_Attribute)
//! This class contains information which is written and //! This class contains information which is written and
//! read during the solving process. Information is divided //! read during the solving process. Information is divided
@ -34,25 +41,32 @@ class TDF_Label;
//! * Touched Labels (modified by the end user), //! * Touched Labels (modified by the end user),
//! * Impacted Labels (modified during execution of the function), //! * Impacted Labels (modified during execution of the function),
//! * Valid Labels (within the valid label scope). //! * Valid Labels (within the valid label scope).
class TFunction_Logbook class TFunction_Logbook : public TDF_Attribute
{ {
public: public:
DEFINE_STANDARD_ALLOC
//! next methods are solving declaration //! Finds or Creates a TFunction_Logbook attribute at the root label accessed by <Access>.
//! =================================== //! Returns the attribute.
Standard_EXPORT static Handle(TFunction_Logbook) Set(const TDF_Label& Access);
//! Returns the GUID for logbook attribute.
Standard_EXPORT static const Standard_GUID& GetID();
//! The methods manipulating the data
//! (touched, impacted and valid labels)
// ====================================
//! Constructor (empty).
Standard_EXPORT TFunction_Logbook(); Standard_EXPORT TFunction_Logbook();
//! Clears this logbook to its default, empty state. //! Clears this logbook to its default, empty state.
Standard_EXPORT void Clear(); Standard_EXPORT void Clear();
Standard_EXPORT Standard_Boolean IsEmpty() const; Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Sets the label L as a touched label in this logbook. //! Sets the label L as a touched label in this logbook.
//! In other words, L is understood to have been modified by the end user. //! In other words, L is understood to have been modified by the end user.
void SetTouched (const TDF_Label& L); Standard_EXPORT void SetTouched (const TDF_Label& L);
//! Sets the label L as an impacted label in this logbook. //! Sets the label L as an impacted label in this logbook.
//! This method is called by execution of the function driver. //! This method is called by execution of the function driver.
@ -60,62 +74,59 @@ public:
//! Sets the label L as a valid label in this logbook. //! Sets the label L as a valid label in this logbook.
Standard_EXPORT void SetValid (const TDF_Label& L, const Standard_Boolean WithChildren = Standard_False); Standard_EXPORT void SetValid (const TDF_Label& L, const Standard_Boolean WithChildren = Standard_False);
Standard_EXPORT void SetValid (const TDF_LabelMap& Ls);
TDF_LabelMap& ChangeValid();
//! Returns True if the label L is touched or impacted. This method //! Returns True if the label L is touched or impacted. This method
//! is called by <TFunction_FunctionDriver::MustExecute>. //! is called by <TFunction_FunctionDriver::MustExecute>.
//! If <WithChildren> is set to true, the method checks //! If <WithChildren> is set to true, the method checks
//! all the sublabels of <L> too. //! all the sublabels of <L> too.
//! next method to consult solving result
//! =====================================
Standard_EXPORT Standard_Boolean IsModified (const TDF_Label& L, const Standard_Boolean WithChildren = Standard_False) const; Standard_EXPORT Standard_Boolean IsModified (const TDF_Label& L, const Standard_Boolean WithChildren = Standard_False) const;
//! Returns the map of touched labels in this logbook. //! Returns the map of touched labels in this logbook.
//! A touched label is the one modified by the end user. //! A touched label is the one modified by the end user.
const TDF_LabelMap& GetTouched() const; Standard_EXPORT const TDF_LabelMap& GetTouched() const;
//! Returns the map of impacted labels contained in this logbook. //! Returns the map of impacted labels contained in this logbook.
const TDF_LabelMap& GetImpacted() const; Standard_EXPORT const TDF_LabelMap& GetImpacted() const;
//! Returns the map of valid labels in this logbook. //! Returns the map of valid labels in this logbook.
const TDF_LabelMap& GetValid() const; Standard_EXPORT const TDF_LabelMap& GetValid() const;
Standard_EXPORT void GetValid(TDF_LabelMap& Ls) const;
//! Sets if the execution failed //! Sets status of execution.
void Done (const Standard_Boolean status); Standard_EXPORT void Done (const Standard_Boolean status);
Standard_Boolean IsDone() const; //! Returns status of execution.
Standard_EXPORT Standard_Boolean IsDone() const;
//! The methods inherited from TDF_Attribute
// ========================================
//! Returns the ID of the attribute.
Standard_EXPORT const Standard_GUID& ID() const;
Standard_EXPORT Standard_OStream& Dump (Standard_OStream& stream) const; //! Undos (and redos) the attribute.
Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& with);
//! Pastes the attribute to another label.
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const;
protected:
//! Returns a new empty instance of the attribute.
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
//! Prints th data of the attributes (touched, impacted and valid labels).
Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
private: private:
TDF_LabelMap myTouched; TDF_LabelMap myTouched;
TDF_LabelMap myImpacted; TDF_LabelMap myImpacted;
TDF_LabelMap myValid; TDF_LabelMap myValid;
Standard_Boolean isDone; Standard_Boolean isDone;
}; };
#include <TFunction_Logbook.lxx> #include <TFunction_Logbook.lxx>
#endif // _TFunction_Logbook_HeaderFile #endif // _TFunction_Logbook_HeaderFile

View File

@ -16,7 +16,11 @@
inline void TFunction_Logbook::SetTouched(const TDF_Label& L) inline void TFunction_Logbook::SetTouched(const TDF_Label& L)
{ {
myTouched.Add(L); if (!myTouched.Contains(L))
{
Backup();
myTouched.Add(L);
}
} }
inline const TDF_LabelMap& TFunction_Logbook::GetTouched() const inline const TDF_LabelMap& TFunction_Logbook::GetTouched() const
@ -29,11 +33,6 @@ inline const TDF_LabelMap& TFunction_Logbook::GetImpacted() const
return myImpacted; return myImpacted;
} }
inline TDF_LabelMap& TFunction_Logbook::ChangeValid()
{
return myValid;
}
inline const TDF_LabelMap& TFunction_Logbook::GetValid() const inline const TDF_LabelMap& TFunction_Logbook::GetValid() const
{ {
return myValid; return myValid;
@ -41,7 +40,11 @@ inline const TDF_LabelMap& TFunction_Logbook::GetValid() const
inline void TFunction_Logbook::Done(const Standard_Boolean status) inline void TFunction_Logbook::Done(const Standard_Boolean status)
{ {
isDone = status; if (isDone != status)
{
Backup();
isDone = status;
}
} }
inline Standard_Boolean TFunction_Logbook::IsDone() const inline Standard_Boolean TFunction_Logbook::IsDone() const

View File

@ -20,7 +20,6 @@
#include <TDF_Label.hxx> #include <TDF_Label.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx> #include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_RelocationTable.hxx> #include <TDF_RelocationTable.hxx>
#include <TFunction_Logbook.hxx>
#include <TFunction_Scope.hxx> #include <TFunction_Scope.hxx>
//======================================================================= //=======================================================================
@ -175,9 +174,11 @@ const TDF_Label& TFunction_Scope::GetFunction(const Standard_Integer ID) const
//purpose : Returns the Logbook. //purpose : Returns the Logbook.
//======================================================================= //=======================================================================
TFunction_Logbook& TFunction_Scope::GetLogbook() Handle(TFunction_Logbook) TFunction_Scope::GetLogbook() const
{ {
return myLogbook; Handle(TFunction_Logbook) logbook;
FindAttribute(TFunction_Logbook::GetID(), logbook);
return logbook;
} }
//======================================================================= //=======================================================================
@ -192,26 +193,6 @@ void TFunction_Scope::Restore(const Handle(TDF_Attribute)& other)
// Functions // Functions
myFunctions = S->myFunctions; // copying... myFunctions = S->myFunctions; // copying...
myFreeID = S->myFreeID; myFreeID = S->myFreeID;
// Logbook
myLogbook.Clear();
TDF_MapIteratorOfLabelMap itrm;
// Valid labels
for (itrm.Initialize(S->myLogbook.GetValid()); itrm.More(); itrm.Next())
{
myLogbook.SetValid(itrm.Key(), Standard_False);
}
// Touched labels
for (itrm.Initialize(S->myLogbook.GetTouched()); itrm.More(); itrm.Next())
{
myLogbook.SetTouched(itrm.Key());
}
// Impacted labels
for (itrm.Initialize(S->myLogbook.GetImpacted()); itrm.More(); itrm.Next())
{
myLogbook.SetImpacted(itrm.Key(), Standard_False);
}
myLogbook.Done(S->myLogbook.IsDone());
} }
//======================================================================= //=======================================================================

View File

@ -83,7 +83,7 @@ public:
//! Returns the Logbook used in TFunction_Driver methods. //! Returns the Logbook used in TFunction_Driver methods.
//! Implementation of Attribute methods //! Implementation of Attribute methods
//! =================================== //! ===================================
Standard_EXPORT TFunction_Logbook& GetLogbook(); Standard_EXPORT Handle(TFunction_Logbook) GetLogbook() const;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
@ -120,7 +120,6 @@ private:
TFunction_DoubleMapOfIntegerLabel myFunctions; TFunction_DoubleMapOfIntegerLabel myFunctions;
TFunction_Logbook myLogbook;
Standard_Integer myFreeID; Standard_Integer myFreeID;