28 #ifndef CASA_ARRAYITER2_H
29 #define CASA_ARRAYITER2_H
71 template<
typename T,
typename Alloc>
class ArrayIterator :
public ArrayPositionIterator
76 explicit ArrayIterator(
const Array<T, Alloc> &arr,
size_t byDim=1);
91 ArrayIterator(
const Array<T, Alloc> &arr,
const IPosition &axes,
92 bool axesAreCursor =
true);
95 virtual void next()
override;
105 virtual void set (
const IPosition& cursorPos)
override;
109 virtual void reset()
override;
122 std::unique_ptr<Array<T, Alloc>>
ap_p;
176 :
ai(const_cast<
Array<T, Alloc>&>(arr),byDim) {}
180 bool axesAreCursor =
true)
181 :
ai(const_cast<
Array<T, Alloc>&>(arr),axes,axesAreCursor) {}
228 #include "ArrayIter.tcc"
A Vector of integers, for indexing into Array<T> objects.
const IPosition & pos() const
Non-templated base class for templated Array class.
ReadOnlyArrayIterator< T, Alloc > & operator=(const ReadOnlyArrayIterator< T, Alloc > &)
bool atStart() const
The same as the functions in ArrayPositionIterator.
ArrayIterator(const Array< T, Alloc > &arr, size_t byDim=1)
Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim")...
virtual void reset() override
Reset the cursor to the beginning.
const Array< T, Alloc > & array()
Return the cursor.
void apSetPointer(int stepDim)
helper function to set the pointer to the new data position in ap after a step in the given dimension...
void reset()
Reset the cursor to the beginning.
virtual ArrayBase & getArray() override
Get the array in the cursor.
Iterate an Array cursor through another Array.
void next()
Move the cursor to the next position.
virtual void next() override
Move the cursor to the next position.
void init(const Array< T, Alloc > &)
helper function to centralize construction work
virtual void set(const IPosition &cursorPos) override
Set the cursor to the given position.
ArrayIterator< T, Alloc > ai
std::unique_ptr< Array< T, Alloc > > ap_p
The cursor.
ReadOnlyArrayIterator(const Array< T, Alloc > &arr, size_t byDim=1)
Step through array "arr" using a cursor of dimensionality "byDim".
Iterate a const Array cursor through a const Array.
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
Array< T, Alloc > pOriginalArray_p
ArrayIterator< T, Alloc > & operator=(const ArrayIterator< T, Alloc > &)
void set(const IPosition &cursorPos)
Set the cursor to the given position.
Array< T, Alloc > & array()
Return the cursor.
ReadOnlyArrayIterator(const Array< T, Alloc > &arr, const IPosition &axes, bool axesAreCursor=true)
Step through an array for the given iteration axes.