1 // BaseDriver.cpp: implementation of the BaseDriver class.
3 //////////////////////////////////////////////////////////////////////
5 #include "BaseDriver.h"
7 #include <TDF_Reference.hxx>
8 #include <TDF_ChildIterator.hxx>
12 #include <OSD_Timer.hxx>
13 #include <BRepPrimAPI_MakeSphere.hxx>
14 #include <BRepAlgoAPI_Fuse.hxx>
17 IMPLEMENT_STANDARD_HANDLE(BaseDriver,TFunction_Driver)
18 IMPLEMENT_STANDARD_RTTIEXT(BaseDriver,TFunction_Driver)
21 BaseDriver::BaseDriver()
26 // Returns the arguments of the function
27 void BaseDriver::Arguments(TDF_LabelList& args) const
29 // Append all arguments.
30 TDF_ChildIterator itr(Label().FindChild(1), false);
31 for (; itr.More(); itr.Next())
33 Handle(TDF_Reference) ref;
34 if (itr.Value().FindAttribute(TDF_Reference::GetID(), ref))
35 args.Append(ref->Get());
40 // Returns the results of the function
41 void BaseDriver::Results(TDF_LabelList& res) const
44 TDF_ChildIterator itr(Label().FindChild(2), false);
45 for (; itr.More(); itr.Next())
47 Handle(TDF_Reference) ref;
48 if (itr.Value().FindAttribute(TDF_Reference::GetID(), ref))
49 res.Append(ref->Get());
54 Standard_Integer BaseDriver::Execute(Handle(TFunction_Logbook)& log) const
57 // Make a boolean operation to slow down the function
58 TopoDS_Shape S1 = BRepPrimAPI_MakeSphere(100.0, 2.0 * M_PI / 3.0);
59 TopoDS_Shape S2 = BRepPrimAPI_MakeSphere(gp_Pnt(10, 10, 10), 100.0, 2.0 * M_PI / 3.0);
60 BRepAlgoAPI_Fuse fuser(S1, S2);
64 // Empty... should be implemented in descendent classes