casacore
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
casacore::LatticeIterInterface< T > Class Template Reference

More...

#include <LatticeIterInterface.h>

Public Member Functions

 LatticeIterInterface (const Lattice< T > &lattice, const LatticeNavigator &navigator, Bool useRef)
 Construct with the given navigator. More...
 
virtual ~LatticeIterInterface ()
 A virtual destructor. More...
 

Protected Member Functions

 LatticeIterInterface ()
 Default constructor (for derived classes). More...
 
 LatticeIterInterface (const LatticeIterInterface< T > &other)
 Copy constructor (copy semantics). More...
 
LatticeIterInterfaceoperator= (const LatticeIterInterface< T > &other)
 Assignment (copy semantics). More...
 
virtual LatticeIterInterface< T > * clone () const
 Clone the object. More...
 
Lattice< T > & lattice ()
 Return the underlying lattice. More...
 
Bool operator++ ()
 Increment operator - increment the cursor to the next position. More...
 
Bool operator++ (int)
 
Bool operator-- ()
 Decrement operator - decrement the cursor to the previous position. More...
 
Bool operator-- (int)
 
void reset ()
 Function which resets the cursor to the beginning of the Lattice and resets the number of steps taken to zero. More...
 
Bool atStart () const
 Function which returns a value of "True" if the cursor is at the beginning of the Lattice, otherwise, returns "False". More...
 
Bool atEnd () const
 Function which returns "True" if the cursor has been incremented to the end of the lattice, otherwise, returns "False". More...
 
uInt nsteps () const
 Function to return the number of steps (increments or decrements) taken since construction (or since last reset). More...
 
IPosition position () const
 Function which returns the current position of the beginning of the cursor within the Lattice. More...
 
IPosition endPosition () const
 Function which returns the current position of the end of the cursor. More...
 
IPosition latticeShape () const
 Function which returns the shape of the Lattice being iterated through. More...
 
IPosition cursorShape () const
 Function which returns the shape of the cursor which is iterating through the Lattice. More...
 
virtual Vector< T > & vectorCursor (Bool doRead, Bool autoRewrite)
 Functions which returns a window to the data in the Lattice. More...
 
virtual Matrix< T > & matrixCursor (Bool doRead, Bool autoRewrite)
 
virtual Cube< T > & cubeCursor (Bool doRead, Bool autoRewrite)
 
virtual Array< T > & cursor (Bool doRead, Bool autoRewrite)
 
Bool ok () const
 Function which checks the internals of the class for consistency. More...
 
virtual void readData (Bool doRead)
 Do the actual read of the data. More...
 
virtual void rewriteData ()
 Rewrite the cursor data and clear the rewrite flag. More...
 
virtual void cursorUpdate ()
 Update the cursor for the next chunk of data (resize if needed). More...
 
void allocateBuffer ()
 Allocate the internal buffer. More...
 
void allocateCurPtr ()
 Allocate the nondegenerate array with the correct type. More...
 
void setCurPtr2Cursor ()
 Synchronise the storage of itsCurPtr with itsCursor. More...
 
void copyBase (const LatticeIterInterface< T > &other)
 Copy the base data of the other object. More...
 

Protected Attributes

LatticeNavigatoritsNavPtr
 Pointer to the method of Lattice transversal. More...
 
Lattice< T > * itsLattPtr
 Pointer to the Lattice. More...
 
Array< T > itsBuffer
 A buffer to hold the data. More...
 
Array< T > * itsCurPtr
 Polymorphic pointer to the data in itsCursor. More...
 
Array< T > itsCursor
 An Array which references the same data as the itsCurPtr, but has all the degenerate axes. More...
 
Bool itsUseRef
 Keep a reference to the data (if possible). More...
 
Bool itsIsRef
 Is the cursor a reference to the lattice? More...
 
Bool itsHaveRead
 Have the data been read after a cursor update? (False=not read) More...
 
Bool itsRewrite
 Rewrite the cursor data before moving or destructing? More...
 
IPosition itsCursorAxes
 The axes forming the cursor. More...
 

Friends

class Lattice< T >
 
class LatticeIterator< T >
 
class RO_LatticeIterator< T >
 

Detailed Description

template<class T>
class casacore::LatticeIterInterface< T >

A base class for Lattice iterators

Intended use:

Internal

Review Status

Reviewed By:
Peter Barnes
Date Reviewed:
1999/10/30
Test programs:
tLatticeIterator

Prerequisite

Etymology

The LatticeIterInterface class name reflects its role as the abstract base class for concrete read-write LatticeIterators

Synopsis

This class is only for authors of Lattice letters for the LatticeIterator envelope. General users should see LatticeIterator.

The LatticeIterInterface class defines an abstract base for the standard methods of iteration required by Lattices. Declaring an Iterator that is derived from this class forces it to meet the virtual requirements.

The author of a Lattice derived class should consider the following:

Example

For an example see LatticeIterator.

Motivation

The is class provides a tidy base for letter/envelope techniques of iteration.

To Do

Definition at line 113 of file LatticeIterInterface.h.

Constructor & Destructor Documentation

◆ LatticeIterInterface() [1/3]

template<class T >
casacore::LatticeIterInterface< T >::LatticeIterInterface ( const Lattice< T > &  lattice,
const LatticeNavigator navigator,
Bool  useRef 
)

Construct with the given navigator.

◆ ~LatticeIterInterface()

template<class T >
virtual casacore::LatticeIterInterface< T >::~LatticeIterInterface ( )
virtual

A virtual destructor.

A virtual is needed to ensure that derived classes declared as pointers to a LatticeIterInterface will scope their destructor to the derived class destructor.

◆ LatticeIterInterface() [2/3]

template<class T >
casacore::LatticeIterInterface< T >::LatticeIterInterface ( )
protected

Default constructor (for derived classes).

◆ LatticeIterInterface() [3/3]

template<class T >
casacore::LatticeIterInterface< T >::LatticeIterInterface ( const LatticeIterInterface< T > &  other)
protected

Copy constructor (copy semantics).

Member Function Documentation

◆ allocateBuffer()

template<class T >
void casacore::LatticeIterInterface< T >::allocateBuffer ( )
protected

Allocate the internal buffer.

◆ allocateCurPtr()

template<class T >
void casacore::LatticeIterInterface< T >::allocateCurPtr ( )
protected

Allocate the nondegenerate array with the correct type.

◆ atEnd()

template<class T >
Bool casacore::LatticeIterInterface< T >::atEnd
inlineprotected

Function which returns "True" if the cursor has been incremented to the end of the lattice, otherwise, returns "False".

Definition at line 290 of file LatticeIterInterface.h.

◆ atStart()

template<class T >
Bool casacore::LatticeIterInterface< T >::atStart
inlineprotected

Function which returns a value of "True" if the cursor is at the beginning of the Lattice, otherwise, returns "False".

Definition at line 284 of file LatticeIterInterface.h.

◆ clone()

template<class T >
virtual LatticeIterInterface<T>* casacore::LatticeIterInterface< T >::clone ( ) const
protectedvirtual

Clone the object.

Reimplemented in casacore::PagedArrIter< T >, and casacore::HDF5LattIter< T >.

◆ copyBase()

template<class T >
void casacore::LatticeIterInterface< T >::copyBase ( const LatticeIterInterface< T > &  other)
protected

Copy the base data of the other object.

◆ cubeCursor()

template<class T >
virtual Cube<T>& casacore::LatticeIterInterface< T >::cubeCursor ( Bool  doRead,
Bool  autoRewrite 
)
protectedvirtual

◆ cursor()

template<class T >
virtual Array<T>& casacore::LatticeIterInterface< T >::cursor ( Bool  doRead,
Bool  autoRewrite 
)
protectedvirtual

◆ cursorShape()

template<class T >
IPosition casacore::LatticeIterInterface< T >::cursorShape
inlineprotected

Function which returns the shape of the cursor which is iterating through the Lattice.

The cursor will always have as many dimensions as the Lattice.

Definition at line 320 of file LatticeIterInterface.h.

◆ cursorUpdate()

template<class T >
virtual void casacore::LatticeIterInterface< T >::cursorUpdate ( )
protectedvirtual

Update the cursor for the next chunk of data (resize if needed).

◆ endPosition()

template<class T >
IPosition casacore::LatticeIterInterface< T >::endPosition
inlineprotected

Function which returns the current position of the end of the cursor.

The returned IPosition will have the same number of axes as the underlying Lattice.

Definition at line 308 of file LatticeIterInterface.h.

◆ lattice()

template<class T >
Lattice<T>& casacore::LatticeIterInterface< T >::lattice ( )
inlineprotected

Return the underlying lattice.

Definition at line 144 of file LatticeIterInterface.h.

References casacore::LatticeIterInterface< T >::itsLattPtr.

◆ latticeShape()

template<class T >
IPosition casacore::LatticeIterInterface< T >::latticeShape
inlineprotected

Function which returns the shape of the Lattice being iterated through.

The returned IPosition will always have the same number of axes as the underlying Lattice.

Definition at line 314 of file LatticeIterInterface.h.

◆ matrixCursor()

template<class T >
virtual Matrix<T>& casacore::LatticeIterInterface< T >::matrixCursor ( Bool  doRead,
Bool  autoRewrite 
)
protectedvirtual

◆ nsteps()

template<class T >
uInt casacore::LatticeIterInterface< T >::nsteps
inlineprotected

Function to return the number of steps (increments or decrements) taken since construction (or since last reset).

This is a running count of all cursor movement since doing N increments followed by N decrements does not necessarily put the cursor back at the origin of the Lattice.

Definition at line 296 of file LatticeIterInterface.h.

◆ ok()

template<class T >
Bool casacore::LatticeIterInterface< T >::ok ( ) const
protected

Function which checks the internals of the class for consistency.

Returns True if everything is fine otherwise returns False. The default implementation of this function always returns True.

◆ operator++() [1/2]

template<class T >
Bool casacore::LatticeIterInterface< T >::operator++
inlineprotected

Increment operator - increment the cursor to the next position.

The implementation of the prefix operator calls the postfix one.

Definition at line 274 of file LatticeIterInterface.h.

◆ operator++() [2/2]

template<class T >
Bool casacore::LatticeIterInterface< T >::operator++ ( int  )
protected

◆ operator--() [1/2]

template<class T >
Bool casacore::LatticeIterInterface< T >::operator--
inlineprotected

Decrement operator - decrement the cursor to the previous position.

The implementation of the prefix operator calls the postfix one.

Definition at line 279 of file LatticeIterInterface.h.

◆ operator--() [2/2]

template<class T >
Bool casacore::LatticeIterInterface< T >::operator-- ( int  )
protected

◆ operator=()

template<class T >
LatticeIterInterface& casacore::LatticeIterInterface< T >::operator= ( const LatticeIterInterface< T > &  other)
protected

Assignment (copy semantics).

◆ position()

template<class T >
IPosition casacore::LatticeIterInterface< T >::position
inlineprotected

Function which returns the current position of the beginning of the cursor within the Lattice.

The returned IPosition will have the same number of axes as the underlying Lattice.

Definition at line 302 of file LatticeIterInterface.h.

◆ readData()

template<class T >
virtual void casacore::LatticeIterInterface< T >::readData ( Bool  doRead)
protectedvirtual

Do the actual read of the data.

◆ reset()

template<class T >
void casacore::LatticeIterInterface< T >::reset ( )
protected

Function which resets the cursor to the beginning of the Lattice and resets the number of steps taken to zero.

◆ rewriteData()

template<class T >
virtual void casacore::LatticeIterInterface< T >::rewriteData ( )
protectedvirtual

Rewrite the cursor data and clear the rewrite flag.

◆ setCurPtr2Cursor()

template<class T >
void casacore::LatticeIterInterface< T >::setCurPtr2Cursor ( )
protected

Synchronise the storage of itsCurPtr with itsCursor.

◆ vectorCursor()

template<class T >
virtual Vector<T>& casacore::LatticeIterInterface< T >::vectorCursor ( Bool  doRead,
Bool  autoRewrite 
)
protectedvirtual

Functions which returns a window to the data in the Lattice.

These are used to read the data within the Lattice. Use the function that is appropriate to the current cursor dimension, AFTER REMOVING DEGENERATE AXES, or use the cursor function which works with any number of dimensions in the cursor. A call of the function whose return value is inappropriate with respect to the current cursor dimension will throw an exception (AipsError).
The doRead flag indicates if the data need to be read or if only a cursor with the correct shape has to be returned.
The autoRewrite flag indicates if the data has to be rewritten when the iterator state changes (e.g. moved, destructed).

Friends And Related Function Documentation

◆ Lattice< T >

template<class T >
friend class Lattice< T >
friend

Definition at line 326 of file LatticeIterInterface.h.

◆ LatticeIterator< T >

template<class T >
friend class LatticeIterator< T >
friend

Definition at line 326 of file LatticeIterInterface.h.

◆ RO_LatticeIterator< T >

template<class T >
friend class RO_LatticeIterator< T >
friend

Definition at line 326 of file LatticeIterInterface.h.

Member Data Documentation

◆ itsBuffer

template<class T >
Array<T> casacore::LatticeIterInterface< T >::itsBuffer
protected

A buffer to hold the data.

Usually itsCursor shares the data with this buffer, but for an ArrayLattice itsCursor might reference the lattice directly instead of making a copy in the buffer.

Definition at line 252 of file LatticeIterInterface.h.

◆ itsCurPtr

template<class T >
Array<T>* casacore::LatticeIterInterface< T >::itsCurPtr
protected

Polymorphic pointer to the data in itsCursor.

Definition at line 254 of file LatticeIterInterface.h.

◆ itsCursor

template<class T >
Array<T> casacore::LatticeIterInterface< T >::itsCursor
protected

An Array which references the same data as the itsCurPtr, but has all the degenerate axes.

This is an optimization to avoid the overhead of having to add the degenerate axes for each iteration.

Definition at line 258 of file LatticeIterInterface.h.

◆ itsCursorAxes

template<class T >
IPosition casacore::LatticeIterInterface< T >::itsCursorAxes
protected

The axes forming the cursor.

Definition at line 268 of file LatticeIterInterface.h.

◆ itsHaveRead

template<class T >
Bool casacore::LatticeIterInterface< T >::itsHaveRead
protected

Have the data been read after a cursor update? (False=not read)

Definition at line 264 of file LatticeIterInterface.h.

◆ itsIsRef

template<class T >
Bool casacore::LatticeIterInterface< T >::itsIsRef
protected

Is the cursor a reference to the lattice?

Definition at line 262 of file LatticeIterInterface.h.

◆ itsLattPtr

template<class T >
Lattice<T>* casacore::LatticeIterInterface< T >::itsLattPtr
protected

Pointer to the Lattice.

Definition at line 248 of file LatticeIterInterface.h.

Referenced by casacore::LatticeIterInterface< T >::lattice().

◆ itsNavPtr

template<class T >
LatticeNavigator* casacore::LatticeIterInterface< T >::itsNavPtr
protected

Pointer to the method of Lattice transversal.

Definition at line 246 of file LatticeIterInterface.h.

◆ itsRewrite

template<class T >
Bool casacore::LatticeIterInterface< T >::itsRewrite
protected

Rewrite the cursor data before moving or destructing?

Definition at line 266 of file LatticeIterInterface.h.

◆ itsUseRef

template<class T >
Bool casacore::LatticeIterInterface< T >::itsUseRef
protected

Keep a reference to the data (if possible).

Definition at line 260 of file LatticeIterInterface.h.


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