LELConvert.h

Classes

LELConvert -- Class to convert a LEL node from one numerical type to another (full description)

template <class T, class F> class LELConvert : public LELInterface<T>

Interface

Public Members
LELConvert (const CountedPtr<LELInterface<F> >& expr)
~LELConvert()
virtual void eval (LELArray<T>& result, const Slicer& section) const
virtual LELScalar<T> getScalar() const
virtual Bool prepareScalarExpr()
virtual String className() const
virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This derived LEL letter class handles numerical type conversions

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that know how to convert between numerical types, such as Double to Float. They operate on numerical Lattices and return a numerical Lattice. The LELConvert object is embedded in the tree, and the conversion actually happens at tree evaluation time.

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. An example of how the user would indirectly use this class (through the envelope) is:
    IPosition shape(2,5,10);
    ArrayLattice<Float> x(shape); x.set(1.0);
    ArrayLattice<Double> y(shape); 
    y.copyData(x);                 // y = x;
    
The LELConvert class is embedded in the tree at construction time so as to handle the conversion from Float to Double at evaluation time

Motivation

We needed to be able to handle mixed types in the LEL classes

Member Description

LELConvert (const CountedPtr<LELInterface<F> >& expr)

Constructor. <F> is the type we are coinverting from. <T> is the type we are converting to.

~LELConvert()

Destructor does nothing

virtual void eval (LELArray<T>& result, const Slicer& section) const

Recursively evaluate the expression.

virtual LELScalar<T> getScalar() const

Recursively evaluate the scalar

virtual Bool prepareScalarExpr()

Do further preparations (e.g. optimization) on the expression.

virtual String className() const

Get class name

virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

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