Example to create class Functor
class MyFunctor{
public:
MyFunctor() {
status=false;
}
f=fun;
status=true;
}
Bool_t getStatus(){
return status;}
}
private:
};
.constructor()
.method( "doEval", &MyFunctor::doEval )
.method( "getStatus", &MyFunctor::getStatus)
;
}
{
r<<"MyFunctor <- MyFunctorModule$MyFunctor";
r<<"u <- new(MyFunctor)";
r<<"print(u$getStatus())";
r<<"print(sprintf('value in R = %f',u$doEval( 1 )))";
MyFunctor functor;
r["functor"]<<functor;
r<<"print(functor$getStatus())";
r<<"print(sprintf('value in R = %f',functor$doEval( 1 )))";
std::cout<<
"value in ROOT = "<<
TMath::Erf(1)<<std::endl;
}
- Author
- Omar Zapata
Definition in file Functor.C.