casacore
Public Member Functions | Private Attributes | List of all members
casacore::LELFunctionND< T > Class Template Reference

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. More...
 
 ~LELFunctionND ()
 Destructor
More...
 
virtual void eval (LELArray< T > &result, const Slicer &section) const
 Recursively evaluate the expression
More...
 
virtual LELScalar< T > getScalar () const
 Recursively evaluate the scalar expression
More...
 
virtual Bool prepareScalarExpr ()
 Do further preparations (e.g. More...
 
virtual String className () const
 Get class name. More...
 
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 Handle locking/syncing of a lattice in a lattice expression. More...
 
virtual void unlock ()
 
virtual Bool hasLock (FileLocker::LockType) const
 
virtual void resync ()
 
- Public Member Functions inherited from casacore::LELInterface< T >
virtual ~LELInterface ()
 Virtual destructor. More...
 
virtual void evalRef (LELArrayRef< T > &result, const Slicer &section) const
 
LELArray< T > getArray () const
 Get the result of an array subexpression. More...
 
Bool isScalar () const
 Is the result of evaluating this expression a scalar ? More...
 
const IPositionshape () const
 Get the shape of the expression result. More...
 
const LELAttributegetAttribute () const
 Get expression attribute. More...
 

Private Attributes

LELFunctionEnums::Function function_p
 
Block< LatticeExprNodearg_p
 

Additional Inherited Members

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

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

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));
const IPosition & shape() const
Get the shape of the expression result.
Definition: LELInterface.h:182
LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.

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 311 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 348 of file LELFunction.h.

◆ function_p

template<class T >
LELFunctionEnums::Function casacore::LELFunctionND< T >::function_p
private

Definition at line 347 of file LELFunction.h.


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