//purpose :
//=======================================================================
-Standard_Integer OCAFSample_CommonDriver::Execute(TFunction_Logbook& theLogbook) const
+Standard_Integer OCAFSample_CommonDriver::Execute(Handle(TFunction_Logbook)& theLogbook) const
{
Handle(TDF_Reference) aReference;
TopoDS_Shape aMaster, aTool;
TDocStd_Modified::Add(aNode->Father()->Label());
- theLogbook.SetImpacted(Label());
+ theLogbook->SetImpacted(Label());
TDocStd_Modified::Add(Label());
- theLogbook.SetImpacted(ResultLabel);
+ theLogbook->SetImpacted(ResultLabel);
TDF_ChildIterator anIterator(ResultLabel);
for(; anIterator.More(); anIterator.Next()) {
- theLogbook.SetImpacted(anIterator.Value());
+ theLogbook->SetImpacted(anIterator.Value());
}
return OK_OPERATION;
// Methods PUBLIC
//
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();
// Methods PUBLIC
//
Standard_EXPORT void Validate(TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(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 Results(TDF_LabelMap& theRes) const;
Standard_EXPORT ~OCAFSample_Driver();
Standard_GUID myDriverID=TFF->GetDriverGUID();
Handle(TDocStd_Document) D = GetOcafDoc();
- TFunction_Logbook log;
+ Handle(TFunction_Logbook) log = TFunction_Logbook::Set(D->Main());
TCollection_AsciiString Message("\
// Modification and recomputation of the selected object \n\
// Recompute the cut object if it must be (look at the MustExecute function code)
// if (myCutDriver->MustExecute(log))
// {
- log.SetTouched(LabObject);
+ log->SetTouched(LabObject);
if(myCutDriver->Execute(log))
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Recompute failed", L"Modify cut", MB_ICONEXCLAMATION);
// }
//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:
- log.SetValid(Label(), Standard_True);
+ log->SetValid(Label(), Standard_True);
}
//=======================================================================
// : be invoked. If the object label or an argument is modified,
// : 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 (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.
// They are on the child labels of the box's label:
// ToolNShape - is attached to the second child label.
//
// Let's check them:
- 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(3))) return Standard_True; // width.
- 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(6))) return Standard_True; // length,
+ 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(3))) return Standard_True; // width.
+ 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(6))) return Standard_True; // length,
// if there are no any modifications concerned the box,
// it's not necessary to recompute (to call the method Execute()):
// : if there are no any mistakes occurred we return 0:
// : 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
Handle(TDataStd_Real) TSR;
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_BoxDriver();
-Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_BoxDriver();
//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:
- log.SetValid(Label(), Standard_True);
+ log->SetValid(Label(), Standard_True);
}
//=======================================================================
// : 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 (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.
// They are on the child labels of the cut's label:
TDF_Tool::Entry(Label(), aEntry);
cout << "Entry: "<<aEntry.ToCString()<<endl;
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;
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,
// it's not necessary to recompute (to call the method Execute()):
// : 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):
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CutDriver();
-Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CutDriver();
//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:
- log.SetValid(Label(), Standard_True);
+ log->SetValid(Label(), Standard_True);
}
//=======================================================================
// : be invoked. If the object label or an argument is modified,
// : 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 (log.IsModified(Label())) return Standard_True;
+ if (log->IsModified(Label())) return Standard_True;
// Cylinder (in our simple case) has 5 arguments:
//
// Let's check them:
- 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(3))) return Standard_True; // x.
- 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(1))) return Standard_True; // radius.
+ 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(4))) return Standard_True; // y,
+ if (log->IsModified(Label().FindChild(5))) return Standard_True; // z.
// if there are no any modifications concerned the Cyl,
// it's not necessary to recompute (to call the method Execute()):
// : if there are no any mistakes occurred we return 0:
// : 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
Handle(TDataStd_Real) TSR;
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CylDriver();
-Standard_EXPORT virtual void Validate(TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Boolean MustExecute(const TFunction_Logbook& log) const;
-Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
+Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CylDriver();
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_BoxDriver::GetID());
// 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;
// Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CylDriver::GetID());
// 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;
// Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID
}
-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)
Handle(TDataStd_Name) myStdName;
{
TDataStd_Real::Set(MainLab.FindChild(1), w);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(2), l);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(3), h);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(4), x);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(5), y);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(6), z);
// 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
if (myBoxDriver->MustExecute(log))
{
// 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))
MessageBox (NULL, L"Recompute failed", L"Modify box", MB_ICONEXCLAMATION);
}
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)
Handle(TDataStd_Name) myStdName;
{
TDataStd_Real::Set(MainLab.FindChild(1), r);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(2), h);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(3), x);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(4), y);
// 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);
{
TDataStd_Real::Set(MainLab.FindChild(5), z);
// 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
if (myCylDriver->MustExecute(log))
{
// 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))
MessageBoxW (NULL, L"Recompute failed", L"Modify cylinder", MB_ICONEXCLAMATION);
}
Handle(TFunction_Function) myFunction = TFunction_Function::Set(L, TOcafFunction_CutDriver::GetID());
// 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;
// Find the TOcafFunction_CutDriver in the TFunction_DriverTable using its GUID
public:
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 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);
// Methods PUBLIC
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
}
if(!anIsDone) return -1;
else {
- theLog.SetValid(RESPOSITION(aFunction),Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
- theLog.SetValid(RESPOSITION(aFunction), Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE);
return 0;
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
-
- theLog.SetValid(RESPOSITION(aFunction), Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
// Naming
LoadNamingDS(RESPOSITION(aFunction), aMkFillet, aCONTEXT);
- theLog.SetValid(RESPOSITION(aFunction),Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(!aLocation.IsIdentity())
TNaming::Displace(aResultLabel, aLocation, Standard_True);
- theLog.SetValid(aResultLabel, Standard_True);
+ theLog->SetValid(aResultLabel, Standard_True);
aFunction->SetFailure(DONE);
return 0;
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
return 1;
}
-//=======================================================================
-static TFunction_Logbook& GetLogBook ()
-{
- static TFunction_Logbook myLog;
- return myLog;
-}
//=======================================================================
//function : Compute
//purpose : Performs the calling to a driver with the given Function ID.
//=======================================================================
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_Driver) aDriver;
#ifdef OCCT_DEBUG
cout << "DNaming_SolveFlatFrom: Father label = " << entry << endl;
#endif
+ Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(FatherLab);
Standard_Boolean found(Standard_False);
TDF_ChildIterator it(FatherLab, Standard_False);
for(;it.More(); it.Next()) {
else {
TDF_Tool::Entry(funLabel, entry);
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) {
cout << "DNaming_SolveFlatFrom: Driver failed at label = " << entry << endl;
return 1;
Handle(TDocStd_Document) aDoc;
Standard_CString aDocS(theArg[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
cout << "DNaming_InitLogBook : is empty" <<endl;
#endif
}
else {
- GetLogBook().Clear();
+ logbook->Clear();
#ifdef OCCT_DEBUG
cout << "DNaming_InitLogBook : cleaned" <<endl;
#endif
if (theNb == 2) {
Handle(TDocStd_Document) aDoc;
Standard_CString aDocS(theArg[1]);
- if (!DDocStd::GetDocument(aDocS, aDoc)) return 1;
- if(GetLogBook().IsEmpty())
+ if (!DDocStd::GetDocument(aDocS, aDoc)) return 1;
+ Handle(TFunction_Logbook) logbook = TFunction_Logbook::Set(aDoc->Main());
+ if(logbook->IsEmpty())
cout << "DNaming_CheckLogBook : is empty" <<endl;
else {
- TDF_LabelMap aMap;
- aMap = GetLogBook().GetValid();
+ const TDF_LabelMap& aMap = logbook->GetValid();
TDF_MapIteratorOfLabelMap it(aMap);
TCollection_AsciiString entry;
cout << "DNaming_CheckLogBook : LogBook current state:" <<endl;
funLabel.FindAttribute(TFunction_Function::GetID(), aFun);
if(aFun.IsNull()) return 1;
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) {
cout << "DNaming_ComputeFun : No Driver or Driver failed" << endl;
return 1;
__FILE__, DNaming_AddObject, g2);
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);
theCommands.Add ("AddBox", "AddBox Doc dx dy dz", __FILE__, DNaming_AddBox, g2);
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(!aLocation.IsIdentity())
TNaming::Displace(aResultLabel, aLocation, Standard_True);
- theLog.SetValid(aResultLabel, Standard_True);
+ theLog->SetValid(aResultLabel, Standard_True);
aFunction->SetFailure(DONE);
return 0;
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(), aFunction);
if(aFunction.IsNull()) return -1;
if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
- theLog.SetValid(RESPOSITION(aFunction),Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(), aFunction);
if(aFunction.IsNull()) return -1;
if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
- theLog.SetValid(RESPOSITION(aFunction),Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//purpose : Validates labels of a function in <theLog>.
//=======================================================================
-void DNaming_SelectionDriver::Validate(TFunction_Logbook& ) const
+void DNaming_SelectionDriver::Validate(Handle(TFunction_Logbook)& ) const
{}
//=======================================================================
//purpose : Analyse in <theLog> if the loaded function must be
// 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;
}
#include <TCollection_AsciiString.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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
TNaming_Selector aSelector(aRLabel);
TDF_LabelMap aMap;
- aMap = theLog.ChangeValid();
+ theLog->GetValid(aMap);
#ifdef OCCT_DEBUG
cout <<"#E_DNaming_SelectionDriver:: Valid Label Map:"<<endl;
TDF_MapIteratorOfLabelMap anItr(aMap);
//***
if(aSelector.Solve(aMap)) {
- theLog.SetValid(aRLabel);
+ theLog->SetValid(aRLabel);
Handle(TNaming_NamedShape) aNS;
if(!aRLabel.FindAttribute(TNaming_NamedShape::GetID(),aNS)) {
cout <<"%%%WARNING: DNaming_SelectionDriver::NamedShape is not found"<<endl;
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
if(aFunction.IsNull()) return -1;
if(!aLocation.IsIdentity())
TNaming::Displace(RESPOSITION(aFunction), aLocation, Standard_True);
- theLog.SetValid(RESPOSITION(aFunction), Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction), Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//function : Validate
//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
//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;
}
//function : Execute
//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;
Label().FindAttribute(TFunction_Function::GetID(),aFunction);
// Naming
LoadNamingDS(RESPOSITION(aFunction), aContextNS, aTransformation);
- theLog.SetValid(RESPOSITION(aFunction),Standard_True);
+ theLog->SetValid(RESPOSITION(aFunction),Standard_True);
aFunction->SetFailure(DONE);
return 0;
}
//! the valid label scope.
//! 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
//! (i.e.arguments are modified) or not.
//! If the Function label itself is modified, the function must
//! 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
//! 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;
//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;
Results(res);
+
TDF_ListIteratorOfLabelList itr(res);
for (; itr.More(); itr.Next())
{
- log.SetValid(itr.Value(), Standard_True);
+ log->SetValid(itr.Value(), Standard_True);
}
}
//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.
TDF_LabelList args;
Arguments(args);
+
TDF_ListIteratorOfLabelList itr(args);
for (; itr.More(); itr.Next())
{
- if (log.IsModified(itr.Value()))
+ if (log->IsModified(itr.Value()))
return Standard_True;
}
return Standard_False;
//! method even if the function is not executed.
//! 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.
//! Returns true if attributes have been modified.
//! 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
//! puts the impacted labels in the logbook log.
//! 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,
//! where the arguments of the function are located.
//purpose : Returns the Logbook.
//=======================================================================
-TFunction_Logbook& TFunction_IFunction::GetLogbook() const
+Handle(TFunction_Logbook) TFunction_IFunction::GetLogbook() const
{
return TFunction_Scope::Set(myLabel)->GetLogbook();
}
Standard_EXPORT const TFunction_DoubleMapOfIntegerLabel& GetAllFunctions() const;
//! 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.
Standard_EXPORT Handle(TFunction_Driver) GetDriver (const Standard_Integer thread = 0) const;
#include <TDF_Label.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
+#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.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
void TFunction_Logbook::Clear()
{
- myTouched.Clear();
- myImpacted.Clear();
- myValid.Clear();
+ if (!IsEmpty())
+ {
+ Backup();
+ myTouched.Clear();
+ myImpacted.Clear();
+ myValid.Clear();
+ }
}
//=======================================================================
//=======================================================================
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 (myImpacted.Contains(L)) return Standard_True;
- if (WithChildren) {
+ if (myTouched.Contains(L))
+ return Standard_True;
+ if (myImpacted.Contains(L))
+ return Standard_True;
+ if (WithChildren)
+ {
TDF_ChildIterator itr(L);
for (; itr.More(); itr.Next())
+ {
if (IsModified(itr.Value(), Standard_True))
- return Standard_True;
+ {
+ return Standard_True;
+ }
+ }
}
return Standard_False;
}
//=======================================================================
void TFunction_Logbook::SetValid(const TDF_Label& L,
- const Standard_Boolean WithChildren)
+ const Standard_Boolean WithChildren)
{
+ Backup();
myValid.Add(L);
- if (WithChildren) {
+ if (WithChildren)
+ {
TDF_ChildIterator itr(L, Standard_True);
- for (; itr.More(); itr.Next()) {
+ for (; itr.More(); itr.Next())
+ {
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
//purpose :
//=======================================================================
void TFunction_Logbook::SetImpacted(const TDF_Label& L,
- const Standard_Boolean WithChildren)
+ const Standard_Boolean WithChildren)
{
+ Backup();
myImpacted.Add(L);
- if (WithChildren) {
+ if (WithChildren)
+ {
TDF_ChildIterator itr(L, Standard_True);
- for (; itr.More(); itr.Next()) {
+ for (; itr.More(); itr.Next())
+ {
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
//purpose : Dump of modifications
stream<<"Done = "<<isDone<<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);
stream<<as<<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);
stream<<as<<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);
stream<<as<<endl;
}
#include <Standard_Handle.hxx>
#include <TDF_LabelMap.hxx>
+#include <TDF_Attribute.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
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
//! read during the solving process. Information is divided
//! * Touched Labels (modified by the end user),
//! * Impacted Labels (modified during execution of the function),
//! * Valid Labels (within the valid label scope).
-class TFunction_Logbook
+class TFunction_Logbook : public TDF_Attribute
{
public:
+
+ //! 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();
+
- DEFINE_STANDARD_ALLOC
+ //! The methods manipulating the data
+ //! (touched, impacted and valid labels)
+ // ====================================
-
- //! next methods are solving declaration
- //! ===================================
+ //! Constructor (empty).
Standard_EXPORT TFunction_Logbook();
//! Clears this logbook to its default, empty state.
Standard_EXPORT void Clear();
-
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! 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.
- 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.
//! This method is called by execution of the function driver.
//! 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);
-
- TDF_LabelMap& ChangeValid();
+ Standard_EXPORT void SetValid (const TDF_LabelMap& Ls);
//! Returns True if the label L is touched or impacted. This method
//! is called by <TFunction_FunctionDriver::MustExecute>.
//! If <WithChildren> is set to true, the method checks
//! 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;
-
//! Returns the map of touched labels in this logbook.
//! 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.
- const TDF_LabelMap& GetImpacted() const;
+ Standard_EXPORT const TDF_LabelMap& GetImpacted() const;
//! Returns the map of valid labels in this logbook.
- const TDF_LabelMap& GetValid() const;
-
- //! Sets if the execution failed
- void Done (const Standard_Boolean status);
+ Standard_EXPORT const TDF_LabelMap& GetValid() const;
+ Standard_EXPORT void GetValid(TDF_LabelMap& Ls) const;
- Standard_Boolean IsDone() const;
+ //! Sets status of execution.
+ Standard_EXPORT void Done (const Standard_Boolean status);
- Standard_EXPORT Standard_OStream& Dump (Standard_OStream& stream) const;
-
-
-
-
-protected:
+ //! 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;
+
+ //! 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;
+
+ //! 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:
-
-
TDF_LabelMap myTouched;
TDF_LabelMap myImpacted;
TDF_LabelMap myValid;
Standard_Boolean isDone;
-
-
};
-
#include <TFunction_Logbook.lxx>
-
-
-
-
#endif // _TFunction_Logbook_HeaderFile
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
return myImpacted;
}
-inline TDF_LabelMap& TFunction_Logbook::ChangeValid()
-{
- return myValid;
-}
-
inline const TDF_LabelMap& TFunction_Logbook::GetValid() const
{
return myValid;
inline void TFunction_Logbook::Done(const Standard_Boolean status)
{
- isDone = status;
+ if (isDone != status)
+ {
+ Backup();
+ isDone = status;
+ }
}
inline Standard_Boolean TFunction_Logbook::IsDone() const
#include <TDF_Label.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_RelocationTable.hxx>
-#include <TFunction_Logbook.hxx>
#include <TFunction_Scope.hxx>
//=======================================================================
//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;
}
//=======================================================================
// Functions
myFunctions = S->myFunctions; // copying...
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());
}
//=======================================================================
//! Returns the Logbook used in TFunction_Driver 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;
TFunction_DoubleMapOfIntegerLabel myFunctions;
- TFunction_Logbook myLogbook;
Standard_Integer myFreeID;