26#ifndef LATTICES_LATTICEITERINTERFACE_H
27#define LATTICES_LATTICEITERINTERFACE_H
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/IPosition.h>
33#include <casacore/casa/Arrays/Array.h>
34#include <casacore/lattices/Lattices/LatticeNavigator.h>
39template <
class T>
class Lattice;
40template <
class T>
class LatticeIterator;
41template <
class T>
class RO_LatticeIterator;
273 return operator++ (0);
278 return operator-- (0);
284 return itsNavPtr->atStart();
290 return itsNavPtr->atEnd();
296 return itsNavPtr->nsteps();
302 return itsNavPtr->position();
308 return itsNavPtr->endPosition();
314 return itsNavPtr->latticeShape();
320 return itsNavPtr->cursorShape();
329#ifndef CASACORE_NO_AUTO_TEMPLATES
330#include <casacore/lattices/Lattices/LatticeIterInterface.tcc>
Bool atEnd() const
Function which returns "True" if the cursor has been incremented to the end of the lattice,...
LatticeIterInterface()
Default constructor (for derived classes).
virtual LatticeIterInterface< T > * clone() const
Clone the object.
Bool itsRewrite
Rewrite the cursor data before moving or destructing?
void setCurPtr2Cursor()
Synchronise the storage of itsCurPtr with itsCursor.
uInt nsteps() const
Function to return the number of steps (increments or decrements) taken since construction (or since ...
IPosition endPosition() const
Function which returns the current position of the end of the cursor.
LatticeIterInterface & operator=(const LatticeIterInterface< T > &other)
Assignment (copy semantics).
LatticeNavigator * itsNavPtr
Pointer to the method of Lattice transversal.
virtual void cursorUpdate()
Update the cursor for the next chunk of data (resize if needed).
Bool itsIsRef
Is the cursor a reference to the lattice?
Array< T > itsCursor
An Array which references the same data as the itsCurPtr, but has all the degenerate axes.
void allocateCurPtr()
Allocate the nondegenerate array with the correct type.
void allocateBuffer()
Allocate the internal buffer.
IPosition latticeShape() const
Function which returns the shape of the Lattice being iterated through.
Lattice< T > & lattice()
Return the underlying lattice.
virtual Matrix< T > & matrixCursor(Bool doRead, Bool autoRewrite)
virtual void rewriteData()
Rewrite the cursor data and clear the rewrite flag.
Bool operator--()
Decrement operator - decrement the cursor to the previous position.
Bool atStart() const
Function which returns a value of "True" if the cursor is at the beginning of the Lattice,...
virtual Vector< T > & vectorCursor(Bool doRead, Bool autoRewrite)
Functions which returns a window to the data in the Lattice.
Bool itsUseRef
Keep a reference to the data (if possible).
Bool itsHaveRead
Have the data been read after a cursor update? (False=not read)
Bool operator++()
Increment operator - increment the cursor to the next position.
LatticeIterInterface(const LatticeIterInterface< T > &other)
Copy constructor (copy semantics).
virtual Array< T > & cursor(Bool doRead, Bool autoRewrite)
void reset()
Function which resets the cursor to the beginning of the Lattice and resets the number of steps taken...
Array< T > itsBuffer
A buffer to hold the data.
Bool ok() const
Function which checks the internals of the class for consistency.
Lattice< T > * itsLattPtr
Pointer to the Lattice.
Array< T > * itsCurPtr
Polymorphic pointer to the data in itsCursor.
LatticeIterInterface(const Lattice< T > &lattice, const LatticeNavigator &navigator, Bool useRef)
Construct with the given navigator.
IPosition cursorShape() const
Function which returns the shape of the cursor which is iterating through the Lattice.
void copyBase(const LatticeIterInterface< T > &other)
Copy the base data of the other object.
IPosition itsCursorAxes
The axes forming the cursor.
IPosition position() const
Function which returns the current position of the beginning of the cursor within the Lattice.
virtual Cube< T > & cubeCursor(Bool doRead, Bool autoRewrite)
virtual ~LatticeIterInterface()
A virtual destructor.
virtual void readData(Bool doRead)
Do the actual read of the data.
A read/write lattice iterator.
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.