casa
5.7.0-16
|
A holder for Functions to enable record conversions. More...
#include <FunctionHolder.h>
Classes | |
struct | FuncStat |
Structure to hold functional status. More... | |
Public Types | |
enum | Types { GAUSSIAN1D, GAUSSIAN2D, GAUSSIAN3D, GAUSSIANND, HYPERPLANE, POLYNOMIAL, EVENPOLYNOMIAL, ODDPOLYNOMIAL, SINUSOID1D, CHEBYSHEV, BUTTERWORTH, COMBINE, COMPOUND, COMPILED, N_Types } |
Types of functions. More... | |
Public Member Functions | |
FunctionHolder () | |
Creates an empty holder. More... | |
FunctionHolder (const Function< T > &in) | |
Create from a Function (copy made) More... | |
FunctionHolder (const FunctionHolder< T > &other) | |
Copy a holder (copy semantics) More... | |
~FunctionHolder () | |
FunctionHolder & | operator= (const FunctionHolder< T > &other) |
Assignment (copy semantics) More... | |
Bool | isEmpty () const |
Check the the FunctionHolder holds the specified type. More... | |
const Vector< String > & | names () const |
Get the known names. More... | |
const Function< T > & | asFunction () const |
Get a specific Function from the holder (with lifetime as long as holder exists). More... | |
Bool | addFunction (const Function< T > &fnc) |
Add a function. More... | |
Types | type () const |
Get the type of currently filled holder. More... | |
virtual Bool | fromRecord (String &error, const RecordInterface &in) |
Create a Function from a record. More... | |
virtual Bool | fromString (String &error, const String &in) |
Initialise the class from a String representation. More... | |
template<class U > | |
Bool | getRecord (String &error, Function< U > *&fn, const RecordInterface &in) |
virtual Bool | toRecord (String &error, RecordInterface &out) const |
Create a record from a Function. More... | |
virtual const String & | ident () const |
Get identification of record. More... | |
Public Member Functions inherited from casacore::RecordTransformable | |
virtual | ~RecordTransformable () |
The destructor must be virtual so that the destructor of derived classes is actually used. More... | |
Private Member Functions | |
void | init () const |
Initialise and check the name list. More... | |
Bool | putType (String &error, RecordInterface &out) const |
Aid for to/from Record, String. More... | |
template<class U > | |
Bool | getType (String &error, Function< U > *&fn, const RecordInterface &in) |
template<class U > | |
Bool | getType (String &error, Function< U > *&fn) |
void | setParameters (Function< T > *&fn, const Vector< T > ¶ms) |
void | setParameters (Function< AutoDiff< T > > *&fn, const Vector< T > ¶ms) |
Private Attributes | |
PtrHolder< Function< T > > | hold_p |
Pointer to a Function. More... | |
Types | nf_p |
Aids (only filled after a succesful to/fromRecord. More... | |
Int | order_p |
String | text_p |
PtrHolder< RecordInterface > | mode_p |
Vector< String > | nam_p |
List of known names. More... | |
Bool | isFilled |
Filled list? More... | |
A holder for Functions to enable record conversions.
Public interface
A Holder of general Measures
This class can be used to handle heterogeneous collections of Functions, e.g. as a Vector<FunctionHolder>
. With the aid of the toRecord() and fromRecord() functions it can be used to convert a Function object into or from a record. A FunctionHolder is created from a Function, or can be empty.
To make general conversions between Functions and records, without knowing the actual Function being converted.
Definition at line 91 of file FunctionHolder.h.
enum casacore::FunctionHolder::Types |
Types of functions.
Enumerator | |
---|---|
GAUSSIAN1D | |
GAUSSIAN2D | |
GAUSSIAN3D | |
GAUSSIANND | |
HYPERPLANE | |
POLYNOMIAL | |
EVENPOLYNOMIAL | |
ODDPOLYNOMIAL | |
SINUSOID1D | |
CHEBYSHEV | |
BUTTERWORTH | |
COMBINE | |
COMPOUND | |
COMPILED | |
N_Types |
Definition at line 95 of file FunctionHolder.h.
casacore::FunctionHolder< T >::FunctionHolder | ( | ) |
Creates an empty holder.
casacore::FunctionHolder< T >::FunctionHolder | ( | const Function< T > & | in | ) |
Create from a Function (copy made)
casacore::FunctionHolder< T >::FunctionHolder | ( | const FunctionHolder< T > & | other | ) |
Copy a holder (copy semantics)
casacore::FunctionHolder< T >::~FunctionHolder | ( | ) |
Bool casacore::FunctionHolder< T >::addFunction | ( | const Function< T > & | fnc | ) |
Add a function.
const Function<T>& casacore::FunctionHolder< T >::asFunction | ( | ) | const |
|
virtual |
Create a Function from a record.
An error message is generated, and False returned if an invalid record is given. A valid record will return True. A valid record contains at least the following fields (any additional fields are ignored):
A Function can be created from a string. In that case the string will only indicate the type of function (like polynomial), and will create a default polynomial of that given type. Error messages are postfixed to error.
Implements casacore::RecordTransformable.
|
virtual |
Initialise the class from a String representation.
A string cannot contain enough information for many objects. Hence the default implementation of this class returns False, indicating that the class could not be initialised and an error message is appended to the supplied string. If the class can be initialised from a string then this function should be overridden.
Reimplemented from casacore::RecordTransformable.
Bool casacore::FunctionHolder< T >::getRecord | ( | String & | error, |
Function< U > *& | fn, | ||
const RecordInterface & | in | ||
) |
|
private |
|
private |
|
virtual |
Get identification of record.
Reimplemented from casacore::RecordTransformable.
|
private |
Initialise and check the name list.
Bool casacore::FunctionHolder< T >::isEmpty | ( | ) | const |
Check the the FunctionHolder holds the specified type.
Return True if if does and False otherwise.
const Vector<String>& casacore::FunctionHolder< T >::names | ( | ) | const |
Get the known names.
FunctionHolder& casacore::FunctionHolder< T >::operator= | ( | const FunctionHolder< T > & | other | ) |
Assignment (copy semantics)
|
private |
|
private |
|
private |
|
virtual |
Create a record from a Function.
The return will be False and an error message generated only if the FunctionHolder does not contain a Function. Error messages are postfixed to error.
Implements casacore::RecordTransformable.
Types casacore::FunctionHolder< T >::type | ( | ) | const |
Get the type of currently filled holder.
|
private |
Pointer to a Function.
Definition at line 191 of file FunctionHolder.h.
|
mutableprivate |
Filled list?
Definition at line 202 of file FunctionHolder.h.
|
mutableprivate |
Definition at line 197 of file FunctionHolder.h.
|
mutableprivate |
List of known names.
Definition at line 200 of file FunctionHolder.h.
|
mutableprivate |
Aids (only filled after a succesful to/fromRecord.
Definition at line 194 of file FunctionHolder.h.
|
mutableprivate |
Definition at line 195 of file FunctionHolder.h.
|
mutableprivate |
Definition at line 196 of file FunctionHolder.h.