Alexandria  2.14.1
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
Euclid::MathUtils::FunctionAdapter Class Reference

Adapt a std::function<double(double)> to the Function Interface. More...

#include <FunctionAdapter.h>

Inheritance diagram for Euclid::MathUtils::FunctionAdapter:
[legend]
Collaboration diagram for Euclid::MathUtils::FunctionAdapter:
[legend]

Public Member Functions

 FunctionAdapter (std::function< double(double)> function)
 Constructor. More...
 
virtual ~FunctionAdapter ()=default
 Default destructor. More...
 
double operator() (const double x) const override
 
std::unique_ptr< Functionclone () const override
 
- Public Member Functions inherited from Euclid::MathUtils::Function
virtual ~Function ()=default
 Default destructor. More...
 

Private Attributes

std::function< double(double)> m_function
 

Detailed Description

Adapt a std::function<double(double)> to the Function Interface.

In some case one need to wrap a std::function into the Function Interface. This class provide this functionality. In particular it allows to build a Function out of a Lamda expression.

Definition at line 44 of file FunctionAdapter.h.

Constructor & Destructor Documentation

Euclid::MathUtils::FunctionAdapter::FunctionAdapter ( std::function< double(double)>  function)

Constructor.

Parameters
functionA std::function<double(double)> to be adapted as a Function.

Definition at line 32 of file FunctionAdapter.cpp.

Referenced by clone().

virtual Euclid::MathUtils::FunctionAdapter::~FunctionAdapter ( )
virtualdefault

Default destructor.

Member Function Documentation

std::unique_ptr< Function > Euclid::MathUtils::FunctionAdapter::clone ( ) const
overridevirtual

Creates a clone of the function adapter object.

Returns
A copy of the FunctionAdapter object

Implements Euclid::MathUtils::Function.

Definition at line 40 of file FunctionAdapter.cpp.

References FunctionAdapter(), and m_function.

Here is the call graph for this function:

double Euclid::MathUtils::FunctionAdapter::operator() ( const double  x) const
overridevirtual

Converts the value x from the input domain to the output domain by calling the internal std::function<double(double)>.

Parameters
xThe value to convert
Returns
The value of the output domain

Implements Euclid::MathUtils::Function.

Definition at line 36 of file FunctionAdapter.cpp.

References m_function.

Member Data Documentation

std::function<double(double)> Euclid::MathUtils::FunctionAdapter::m_function
private

Definition at line 72 of file FunctionAdapter.h.

Referenced by clone(), and operator()().


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