14#ifndef ROOT_Math_ParamFunctor
15#define ROOT_Math_ParamFunctor
66template<
class ParentFunctor,
class Func >
69 typedef typename ParentFunctor::EvalType
EvalType;
70 typedef typename ParentFunctor::Impl
Base;
112 inline static T
Eval(
F &
f, T *
x,
double * p) {
117 return f((T*)
x, (
double*)p);
122 inline static T
Eval(
F *
f, T *
x,
double * p) {
127 return (*
f)((T*)
x, (
double*)p);
133 inline static T
Eval(
const F *
f, T *
x,
double * p) {
137 inline static T
EvalConst(
const F *
f,
const T *
x,
const double * p) {
138 return (*
f)((T*)
x, (
double*)p);
146#if defined(__ROOTCLING__) || defined(G__DICTIONARY)
149template<
class ParentFunctor>
150class ParamFunctorHandler<ParentFunctor,
TRootIOCtor *> :
public ParentFunctor::Impl
156 double operator() (
double *,
double * ) {
return 0; }
158 double operator() (
const double *,
const double * ) {
return 0; }
173template <
class ParentFunctor,
typename PointerToObj,
174 typename PointerToMemFn>
177 typedef typename ParentFunctor::Impl
Base;
205 inline double operator() (
const double *
x,
const double * p)
override {
218 inline static T
Eval(PObj & pobj,
F &
f, T *
x,
double * p) {
219 return ((*pobj).*
f)(
x, p);
222 inline static T
EvalConst(PObj & pobj,
F &
f,
const T *
x,
const double * p) {
223 return ((*pobj).*
f)((T*)
x, (
double*)p);
293 template <
class PtrObj,
typename MemFn>
303 template <
typename Func>
Basic types used by ROOT and required by TInterpreter.
double Double_t
Double 8 bytes.
TRObject operator()(const T1 &t1) const
class defining the signature for multi-dim parametric functions
virtual T operator()(const T *x, const double *p)=0
virtual ~ParamFunctionBase()
virtual ParamFunctionBase * Clone() const =0
ParamFunctor Handler class is responsible for wrapping any other functor and pointer to free C functi...
ParamFunctorHandler * Clone() const override
EvalType operator()(EvalType x, double *p)
ParentFunctor::EvalType EvalType
virtual ~ParamFunctorHandler()
ParamFunctorHandler(const Func &fun)
Param Functor class for Multidimensional functions.
ParamFunctorTempl(const ParamFunctorTempl &rhs)
Copy constructor.
ParamFunctorTempl(const Func &f)
construct from another generic Functor of multi-dimension
void SetFunction(Impl *f)
ParamFunctorTempl()
Default constructor.
ParamFunctorTempl(const PtrObj &p, MemFn memFn)
construct from a pointer to member function (multi-dim type)
ParamFunctorTempl(FreeFunc f)
ParamFunctorTempl(const std::function< T(const T *f, const Double_t *param)> &func)
T operator()(T *x, double *p)
virtual ~ParamFunctorTempl()
Destructor (no operations).
T(* FreeFunc)(T *, double *)
ParamFunctionBase< T > Impl
ParamFunctorTempl & operator=(const ParamFunctorTempl &rhs)
Assignment operator.
ParamFunctor Handler to Wrap pointers to member functions.
ParamMemFunHandler(const ParamMemFunHandler &)=delete
ParamMemFunHandler & operator=(const ParamMemFunHandler &)=delete
double operator()(double x, double *p)
virtual ~ParamMemFunHandler()
ParamMemFunHandler(const PointerToObj &pObj, PointerToMemFn pMemFn)
constructor from a pointer to the class and a pointer to the function
ParamMemFunHandler * Clone() const override
ParamFunctorTempl< double > ParamFunctor
static T EvalConst(F *f, const T *x, const double *p)
static T Eval(F *f, T *x, double *p)
static T EvalConst(const F *f, const T *x, const double *p)
static T Eval(const F *f, T *x, double *p)
static T EvalConst(F &f, const T *x, const double *p)
static T Eval(F &f, T *x, double *p)
static T EvalConst(PObj &pobj, F &f, const T *x, const double *p)
static T Eval(PObj &pobj, F &f, T *x, double *p)