casa
5.7.0-16
|
A base class for Lattice iterators. More...
#include <SubImage.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... | |
LatticeIterInterface & | operator= (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 | |
LatticeNavigator * | itsNavPtr |
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 > |
A base class for Lattice iterators.
Internal
The LatticeIterInterface class name reflects its role as the abstract base class for concrete read-write LatticeIterators
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:
For an example see LatticeIterator.
The is class provides a tidy base for letter/envelope techniques of iteration.
Definition at line 46 of file SubImage.h.
casacore::LatticeIterInterface< T >::LatticeIterInterface | ( | const Lattice< T > & | lattice, |
const LatticeNavigator & | navigator, | ||
Bool | useRef | ||
) |
Construct with the given navigator.
|
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.
|
protected |
Default constructor (for derived classes).
|
protected |
Copy constructor (copy semantics).
|
protected |
Allocate the internal buffer.
|
protected |
Allocate the nondegenerate array with the correct type.
|
inlineprotected |
Function which returns "True" if the cursor has been incremented to the end of the lattice, otherwise, returns "False".
Definition at line 293 of file LatticeIterInterface.h.
|
inlineprotected |
Function which returns a value of "True" if the cursor is at the beginning of the Lattice, otherwise, returns "False".
Definition at line 287 of file LatticeIterInterface.h.
|
protectedvirtual |
Clone the object.
Reimplemented in casacore::HDF5LattIter< T >, and casacore::PagedArrIter< T >.
|
protected |
Copy the base data of the other object.
|
protectedvirtual |
|
protectedvirtual |
|
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 323 of file LatticeIterInterface.h.
|
protectedvirtual |
Update the cursor for the next chunk of data (resize if needed).
|
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 311 of file LatticeIterInterface.h.
|
inlineprotected |
Return the underlying lattice.
Definition at line 147 of file LatticeIterInterface.h.
References casacore::LatticeIterInterface< T >::itsLattPtr.
|
inlineprotected |
|
protectedvirtual |
|
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 299 of file LatticeIterInterface.h.
|
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.
|
inlineprotected |
Increment operator - increment the cursor to the next position.
The implementation of the prefix operator calls the postfix one.
Definition at line 277 of file LatticeIterInterface.h.
|
protected |
|
inlineprotected |
Decrement operator - decrement the cursor to the previous position.
The implementation of the prefix operator calls the postfix one.
Definition at line 282 of file LatticeIterInterface.h.
|
protected |
|
protected |
Assignment (copy semantics).
|
inlineprotected |
|
protectedvirtual |
Do the actual read of the data.
|
protected |
|
protectedvirtual |
Rewrite the cursor data and clear the rewrite flag.
|
protected |
Synchronise the storage of itsCurPtr with itsCursor.
|
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).
|
friend |
Definition at line 118 of file LatticeIterInterface.h.
|
friend |
Definition at line 119 of file LatticeIterInterface.h.
|
friend |
Definition at line 120 of file LatticeIterInterface.h.
|
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 255 of file LatticeIterInterface.h.
|
protected |
Polymorphic pointer to the data in itsCursor.
Definition at line 257 of file LatticeIterInterface.h.
|
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 261 of file LatticeIterInterface.h.
|
protected |
The axes forming the cursor.
Definition at line 271 of file LatticeIterInterface.h.
|
protected |
Have the data been read after a cursor update? (False=not read)
Definition at line 267 of file LatticeIterInterface.h.
|
protected |
Is the cursor a reference to the lattice?
Definition at line 265 of file LatticeIterInterface.h.
|
protected |
Pointer to the Lattice.
Definition at line 251 of file LatticeIterInterface.h.
Referenced by casacore::LatticeIterInterface< T >::lattice().
|
protected |
Pointer to the method of Lattice transversal.
Definition at line 249 of file LatticeIterInterface.h.
|
protected |
Rewrite the cursor data before moving or destructing?
Definition at line 269 of file LatticeIterInterface.h.
|
protected |
Keep a reference to the data (if possible).
Definition at line 263 of file LatticeIterInterface.h.