casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Attributes
casa::FunctionWrapper< T > Class Template Reference

Construct nD function objects from C++ functions. More...

#include <FunctionWrapper.h>

Inheritance diagram for casa::FunctionWrapper< T >:
casa::WrapperParam< T > casa::Function< T > casa::Functional< FunctionTraits< T >::ArgType, T > casa::Functional< Vector< FunctionTraits< T >::ArgType >, T >

List of all members.

Public Member Functions

 FunctionWrapper ()
 Default constructor, to enable arrays.
 FunctionWrapper (T(*f)())
 A function with no parameters and no arguments.
 FunctionWrapper (T(*f)(const T &), const Bool isPar)
 A function with parameter and no arguments (Note value of isPar irrelevant)
 FunctionWrapper (T(*f)(const Vector< T > &), const Bool isPar)
 A function with parameters and no arguments.
 FunctionWrapper (T(*f)(const T &))
 Construct a 1-dimensional function with no parameters.
 FunctionWrapper (T(*f)(const T &, const T &), const T &par)
 Construct a 1-dimensional function with parameter.
 FunctionWrapper (T(*f)(const T &, const Vector< T > &), const Vector< T > &par)
 Construct a 1-dimensional function with parameters.
 FunctionWrapper (T(*f)(const Vector< T > &), const Int dim=1)
 Construct an n-dimensional function with no parameters.
 FunctionWrapper (T(*f)(const Vector< T > &, const T &), const T &par, const uInt dim=1)
 Construct an n-dimensional function with parameter.
 FunctionWrapper (T(*f)(const Vector< T > &, const Vector< T > &), const Vector< T > &par, const uInt dim=1)
 Construct an n-dimensional function with parameters.
 FunctionWrapper (const FunctionWrapper< T > &other)
 Copy constructor (deep copy)
FunctionWrapper< T > & operator= (const FunctionWrapper< T > &other)
 Copy assignment (deep copy)
virtual ~FunctionWrapper ()
 Destructor.
virtual T eval (typename Function< T >::FunctionArg x) const
 Evaluate the function at x.
virtual uInt ndim () const
 Get the dimensionality.
virtual Function< T > * clone () const
 Return a copy of this object from the heap.

Protected Attributes

WrapperBase< T > * doit_p
 
   


Detailed Description

template<class T>
class casa::FunctionWrapper< T >

Construct nD function objects from C++ functions.

Intended use:

Public interface

Review Status

Date Reviewed:
1996/02/22

Prerequisite

Synopsis

This class is provided so that user can quickly construct a function object from a C++ function pointer without having to write a function class. The constructor constructs a function object from a function pointer, and an optional parameter list. Parameters are necessary if the function has to be used in a functional fitting process (see GenericL2Fit ).

The general function signature is f(x;p), where x represents the arguments, and p the parameters. The allowed signatures of the function include all combinations of arguments and parameters, and are:

Example

    Float func(const Vector<Float>& x) {return x(0)*x(1);}        // x*y
    // Convert C++ functions to Functionals
    FunctionWrapper<Float> Func(func,2);

Definition at line 84 of file FunctionWrapper.h.


Constructor & Destructor Documentation

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( )

Default constructor, to enable arrays.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)()  f)

A function with no parameters and no arguments.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const T &)  f,
const Bool  isPar 
)

A function with parameter and no arguments (Note value of isPar irrelevant)

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const Vector< T > &)  f,
const Bool  isPar 
)

A function with parameters and no arguments.

(Note value of isPar irrelevant)

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const T &)  f)

Construct a 1-dimensional function with no parameters.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const T &, const T &)  f,
const T &  par 
)

Construct a 1-dimensional function with parameter.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const T &, const Vector< T > &)  f,
const Vector< T > &  par 
)

Construct a 1-dimensional function with parameters.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const Vector< T > &)  f,
const Int  dim = 1 
)

Construct an n-dimensional function with no parameters.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const Vector< T > &, const T &)  f,
const T &  par,
const uInt  dim = 1 
)

Construct an n-dimensional function with parameter.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( T(*)(const Vector< T > &, const Vector< T > &)  f,
const Vector< T > &  par,
const uInt  dim = 1 
)

Construct an n-dimensional function with parameters.

template<class T>
casa::FunctionWrapper< T >::FunctionWrapper ( const FunctionWrapper< T > &  other)

Copy constructor (deep copy)

template<class T>
virtual casa::FunctionWrapper< T >::~FunctionWrapper ( ) [inline, virtual]

Destructor.

Definition at line 121 of file FunctionWrapper.h.


Member Function Documentation

template<class T>
virtual Function<T>* casa::FunctionWrapper< T >::clone ( ) const [inline, virtual]

Return a copy of this object from the heap.

The caller is responsible for deleting this pointer.

Implements casa::Function< T >.

Definition at line 135 of file FunctionWrapper.h.

template<class T>
virtual T casa::FunctionWrapper< T >::eval ( typename Function< T >::FunctionArg  x) const [virtual]

Evaluate the function at x.

template<class T>
virtual uInt casa::FunctionWrapper< T >::ndim ( ) const [virtual]

Get the dimensionality.

Implements casa::Function< T >.

template<class T>
FunctionWrapper<T>& casa::FunctionWrapper< T >::operator= ( const FunctionWrapper< T > &  other)

Copy assignment (deep copy)


Member Data Documentation

template<class T>
WrapperBase<T>* casa::FunctionWrapper< T >::doit_p [protected]

   

The function aid object

Definition at line 142 of file FunctionWrapper.h.


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