Loading...
Searching...
No Matches
casacore::LELFunctionND< T > Class Template Reference
lattices package (libcasa_lattices) » LEL_module » LEL_module_internal_classes

This LEL class handles functions with a variable number of arguments. More...

`#include <LELFunction.h>`

## Public Member Functions

| LELFunctionND (const LELFunctionEnums::Function function, const Block< LatticeExprNode > &expr)
| Constructor takes operation and expressions to be operated upon.
| ~LELFunctionND ()
| Destructor.
virtual void | eval (LELArray< T > &result, const Slicer &section) const
| Recursively evaluate the expression.
virtual LELScalar< T > | getScalar () const
| Recursively evaluate the scalar expression.
virtual Bool | prepareScalarExpr ()
| Do further preparations (e.g.
virtual String | className () const
| Get class name.
virtual Bool | lock (FileLocker::LockType, uInt nattempts)
| Handle locking/syncing of a lattice in a lattice expression.
virtual void | unlock ()
virtual Bool | hasLock (FileLocker::LockType) const
virtual void | resync ()
Public Member Functions inherited from casacore::LELInterface< T >
virtual | ~LELInterface ()
| Virtual destructor.
virtual void | evalRef (LELArrayRef< T > &result, const Slicer &section) const
LELArray< T > | getArray () const
| Get the result of an array subexpression.
Bool | isScalar () const
| Is the result of evaluating this expression a scalar ?
const IPosition & | shape () const
| Get the shape of the expression result.
const LELAttribute & | getAttribute () const
| Get expression attribute.

## Private Attributes

LELFunctionEnums::Function | function_p
Block< LatticeExprNode > | arg_p

## Additional Inherited Members

Static Public Member Functions inherited from casacore::LELInterface< T >
static Bool | replaceScalarExpr (std::shared_ptr< LELInterface< T > > &expr)
| If the given expression is a valid scalar, replace it by its result.
Protected Member Functions inherited from casacore::LELInterface< T >
void | setAttr (const LELAttribute &attrib)
| Set the expression attributes of this object.

## Detailed Description

template<class T>
class casacore::LELFunctionND< T >

This LEL class handles functions with a variable number of arguments.

### Intended use:

Internal

### Review Status

Date Reviewed:
  yyyy/mm/dd

### Prerequisite

- Lattice
- LatticeExpr
- LatticeExprNode
- LELInterface
- LELFunctionEnums

### Etymology

This derived LEL letter class handles numerical functions (arbitrary number of arguments) which return any data type

### Synopsis

This templated LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply functions of arbitrary number of arguments to Lattice expressions. They operate lattices with any type and return the same type. The available C++ function is iif with equivalents in the enum of IIF.

A description of the implementation details of the LEL classes can be found in Note 216

### Example

Examples are not very useful as the user would never use these classes directly. Look in LatticeExprNode.cc to see how it invokes these classes. Examples of how the user would indirectly use this class (through the envelope) are:

IPosition shape(2,5,10);
ArrayLattice<Complex> w(shape); w.set(Complex(2.0,3.0));
ArrayLattice<Float> x(shape); x.set(0.05);
ArrayLattice<Float> y(shape); y.set(2.0);
ArrayLattice<Float> z(shape); y.set(2.0);
z.copyData(iif(x==0, y, x));
casacore::ArrayLattice
Definition ArrayLattice.h:144
casacore::IPosition
Definition IPosition.h:117
casacore::LELInterface::shape
const IPosition & shape() const
Get the shape of the expression result.
Definition LELInterface.h:180
casacore::iif
LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?

Copy x to z, but where x==0, take the correpsonding element from y. b

### Motivation

An "if-then-else" like construction is very useful.

Definition at line 309 of file LELFunction.h.

## Constructor & Destructor Documentation

## LELFunctionND()

template<class T>

casacore::LELFunctionND< T >::LELFunctionND | ( | const LELFunctionEnums::Function | function,
|  | const Block< LatticeExprNode > & | expr )

Constructor takes operation and expressions to be operated upon.

## ~LELFunctionND()

template<class T>

casacore::LELFunctionND< T >::~LELFunctionND | ( |  | ) |

Destructor.

## Member Function Documentation

## className()

template<class T>

virtual String casacore::LELFunctionND< T >::className | ( |  | ) | const

virtual

Get class name.

Implements casacore::LELInterface< T >.

## eval()

template<class T>

virtual void casacore::LELFunctionND< T >::eval | ( | LELArray< T > & | result,
|  | const Slicer & | section ) const

virtual

Recursively evaluate the expression.

Implements casacore::LELInterface< T >.

## getScalar()

template<class T>

virtual LELScalar< T > casacore::LELFunctionND< T >::getScalar | ( |  | ) | const

virtual

Recursively evaluate the scalar expression.

Implements casacore::LELInterface< T >.

## hasLock()

template<class T>

virtual Bool casacore::LELFunctionND< T >::hasLock | ( | FileLocker::LockType |  | ) | const

virtual

Reimplemented from casacore::LELInterface< T >.

## lock()

template<class T>

virtual Bool casacore::LELFunctionND< T >::lock | ( | FileLocker::LockType | ,
|  | uInt | nattempts )

virtual

Handle locking/syncing of a lattice in a lattice expression.

Reimplemented from casacore::LELInterface< T >.

## prepareScalarExpr()

template<class T>

virtual Bool casacore::LELFunctionND< T >::prepareScalarExpr | ( |  | ) |

virtual

Do further preparations (e.g.

optimization) on the expression.

Implements casacore::LELInterface< T >.

## resync()

template<class T>

virtual void casacore::LELFunctionND< T >::resync | ( |  | ) |

virtual

Reimplemented from casacore::LELInterface< T >.

## unlock()

template<class T>

virtual void casacore::LELFunctionND< T >::unlock | ( |  | ) |

virtual

Reimplemented from casacore::LELInterface< T >.

## Member Data Documentation

## arg_p

template<class T>

Block<LatticeExprNode> casacore::LELFunctionND< T >::arg_p

private

Definition at line 346 of file LELFunction.h.

## function_p

template<class T>

LELFunctionEnums::Function casacore::LELFunctionND< T >::function_p

private

Definition at line 345 of file LELFunction.h.

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

- lattices/LEL/LELFunction.h