ROOTR_EXPOSED_CLASS(MyFunctor) R %%cpp -d #include #include typedef Double_t (*Function)(Double_t); //Functor class with the function inside class MyFunctor{ public: MyFunctor() { status=false; f=TMath::BesselY1; } void setFunction(Function fun) { f=fun; status=true; } Bool_t getStatus(){return status;} Double_t doEval(Double_t x) { return f(x); } private: Function f; Bool_t status; }; %%cpp -d OOTR_MODULE(MyFunctorModule) { ROOT::R::class_( "MyFunctor" ) //creating a default constructor .constructor() //adding the method doEval to evaluate the internal function .method( "doEval", &MyFunctor::doEval ) .method( "getStatus", &MyFunctor::getStatus) ; } ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); r["MyFunctorModule"]<