#include <ArrayIter.h>
Inheritance diagram for casa::ArrayIterator< T >:


ArrayIterator steps an array section (the "cursor") through an array. The cursor "refers" to storage in the array, so that changing the values in the cursor changes values in the original array. Like with ArrayPositionIterator, the cursor presently only moves through the array from bottom to top in the obvious way; however one may of course iterate through a slice ("array section"). This class is derived from ArrayPositionIterator since it also has a position (the blc of the cursor) which moves through the array volume.
Tip: The origin of the cursor, i.e. the subarray that moves through the larger array, is always zero.
Array<Float> to, from;
//.\.. set to and from, check that they are conformant
ArrayIterator toiter(to,1);
ArrayIterator fromiter(from,1);
while (! toiter.pastEnd() ) {
toiter.array() = fromiter.array(); // copy vector by vector
toiter.next(); fromiter.next();
}
<linkfrom anchor="ArrayIterator" classes="Array Vector Matrix Cube"> <here>ArrayIterator</here> -- Iterate an Array cursor through another Array. </linkfrom>
Definition at line 72 of file ArrayIter.h.
Public Member Functions | |
| ArrayIterator (Array< T > &arr, uInt byDim=1) | |
| Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim"). | |
| ArrayIterator (Array< T > &arr, const IPosition &axes, Bool axesAreCursor=True) | |
| Step through an array using the given axes. | |
| virtual | ~ArrayIterator () |
| virtual void | next () |
| Move the cursor to the next position. | |
| Array< T > & | array () |
| Return the cursor. | |
| virtual void | reset () |
| Reset the cursor to the beginning. | |
Protected Attributes | |
| Array< T > * | ap_p |
| A pointer to the cursor. | |
Private Member Functions | |
| void | init (Array< T > &) |
| helper function to centralize construction work | |
| void | apSetPointer (Int stepDim) |
| helper function to set the pointer to the new data position in ap after a step in the given dimension. | |
| ArrayIterator (const ArrayIterator< T > &) | |
| ArrayIterator< T > & | operator= (const ArrayIterator< T > &) |
Private Attributes | |
| Array< T > * | pOriginalArray_p |
| Bool | readOnly_p |
| IPosition | offset_p |
| T * | dataPtr_p |
| casa::ArrayIterator< T >::ArrayIterator | ( | Array< T > & | arr, | |
| uInt | byDim = 1 | |||
| ) | [explicit] |
Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim").
| casa::ArrayIterator< T >::ArrayIterator | ( | Array< T > & | arr, | |
| const IPosition & | axes, | |||
| Bool | axesAreCursor = True | |||
| ) |
Step through an array using the given axes.
The axes can be given in two ways:
| virtual casa::ArrayIterator< T >::~ArrayIterator | ( | ) | [virtual] |
| casa::ArrayIterator< T >::ArrayIterator | ( | const ArrayIterator< T > & | ) | [private] |
| virtual void casa::ArrayIterator< T >::next | ( | ) | [virtual] |
| virtual void casa::ArrayIterator< T >::reset | ( | ) | [virtual] |
| Array<T>& casa::ArrayIterator< T >::array | ( | ) | [inline] |
Return the cursor.
(Perhaps we should have a fn() that returns a reference to the original array as well?)
Definition at line 107 of file ArrayIter.h.
References casa::ArrayIterator< T >::ap_p.
| void casa::ArrayIterator< T >::init | ( | Array< T > & | ) | [private] |
helper function to centralize construction work
| void casa::ArrayIterator< T >::apSetPointer | ( | Int | stepDim | ) | [private] |
helper function to set the pointer to the new data position in ap after a step in the given dimension.
-1 resets it to the beginning.
| ArrayIterator<T>& casa::ArrayIterator< T >::operator= | ( | const ArrayIterator< T > & | ) | [private] |
Array<T>* casa::ArrayIterator< T >::ap_p [protected] |
A pointer to the cursor.
Definition at line 111 of file ArrayIter.h.
Referenced by casa::ArrayIterator< T >::array().
Array<T>* casa::ArrayIterator< T >::pOriginalArray_p [private] |
Definition at line 120 of file ArrayIter.h.
Bool casa::ArrayIterator< T >::readOnly_p [private] |
Definition at line 121 of file ArrayIter.h.
IPosition casa::ArrayIterator< T >::offset_p [private] |
Definition at line 122 of file ArrayIter.h.
T* casa::ArrayIterator< T >::dataPtr_p [private] |
Definition at line 123 of file ArrayIter.h.
1.5.1