BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::WrappedFunction< Func > Class Template Reference

Description

template<typename Func = FreeFunctionPtr>
class ROOT::Math::WrappedFunction< Func >

Template class to wrap any C++ callable object which takes one argument i.e. implementing operator() (double x) in a One-dimensional function interface. It provides a ROOT::Math::IGenFunction-like signature

Note: If you want to wrap just the reference (to avoid copying) you need to use Func& or const Func & as template parameter. The former should be used when the operator() is not a const method of Func

Definition at line 56 of file WrappedFunction.h.

Inheritance diagram for ROOT::Math::WrappedFunction< Func >:
[legend]
Collaboration diagram for ROOT::Math::WrappedFunction< Func >:
[legend]

Public Types

typedef IBaseFunctionOneDim BaseFunc
 

Public Member Functions

 WrappedFunction (Func f)
 
WrappedFunctionClone () const
 clone (required by the interface) More...
 
double operator() (const double *x) const
 
double operator() (double x) const
 

Private Member Functions

virtual double DoEval (double x) const
 implementation of the evaluation function. Must be implemented by derived classes More...
 

Private Attributes

Func fFunc
 

Member Typedef Documentation

◆ BaseFunc

Definition at line 139 of file IFunction.h.

Constructor & Destructor Documentation

◆ WrappedFunction()

template<typename Func = FreeFunctionPtr>
ROOT::Math::WrappedFunction< Func >::WrappedFunction ( Func  f)
inline

construct from the pointer to the object and the member function

Definition at line 64 of file WrappedFunction.h.

64  :
65  fFunc( f )
66  { /* no op */ }

Referenced by ROOT::Math::WrappedFunction< Func >::Clone().

Member Function Documentation

◆ Clone()

template<typename Func = FreeFunctionPtr>
WrappedFunction* ROOT::Math::WrappedFunction< Func >::Clone ( ) const
inlinevirtual

clone (required by the interface)

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 71 of file WrappedFunction.h.

71  {
72  return new WrappedFunction(fFunc);
73  }

References ROOT::Math::WrappedFunction< Func >::WrappedFunction(), and ROOT::Math::WrappedFunction< Func >::fFunc.

Here is the call graph for this function:

◆ DoEval()

template<typename Func = FreeFunctionPtr>
virtual double ROOT::Math::WrappedFunction< Func >::DoEval ( double  x) const
inlineprivatevirtual

implementation of the evaluation function. Must be implemented by derived classes

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 79 of file WrappedFunction.h.

79  {
80  return fFunc( x );
81  }

References ROOT::Math::WrappedFunction< Func >::fFunc.

◆ operator()() [1/2]

double ROOT::Math::IBaseFunctionOneDim::operator() ( const double *  x) const
inlineinherited

Evaluate the function at a point x[]. Compatible method with multi-dimensional functions

Definition at line 167 of file IFunction.h.

168  {
169  return DoEval(*x);
170  }
virtual double DoEval(double x) const =0
implementation of the evaluation function. Must be implemented by derived classes

References ROOT::Math::IBaseFunctionOneDim::DoEval().

Here is the call graph for this function:

◆ operator()() [2/2]

double ROOT::Math::IBaseFunctionOneDim::operator() ( double  x) const
inlineinherited

Evaluate the function at a point x Use the a pure virtual private method DoEval which must be implemented by sub-classes

Definition at line 158 of file IFunction.h.

159  {
160  return DoEval(x);
161  }

References ROOT::Math::IBaseFunctionOneDim::DoEval().

Referenced by ROOT::Math::IGradientFunctionOneDim::FdF().

Here is the call graph for this function:

Member Data Documentation

◆ fFunc

template<typename Func = FreeFunctionPtr>
Func ROOT::Math::WrappedFunction< Func >::fFunc
private

The documentation for this class was generated from the following file: