Loading...
Searching...
No Matches
casacore::ReadOnlyArrayIterator< T > Class Template Reference
casa package (libcasa_casa) » Arrays_module

Iterate a const Array cursor through a const Array. More...

`#include <ArrayIter.h>`

## Public Member Functions

| ReadOnlyArrayIterator (const Array< T > &arr, size_t byDim=1)
| Step through array "arr" using a cursor of dimensionality "byDim".
| ReadOnlyArrayIterator (const Array< T > &arr, const IPosition &axes, bool axesAreCursor=true)
| Step through an array for the given iteration axes.
void | next ()
| Move the cursor to the next position.
void | set (const IPosition &cursorPos)
| Set the cursor to the given position.
void | reset ()
| Reset the cursor to the beginning.
void | origin ()
const Array< T > & | array ()
| Return the cursor.
bool | atStart () const
| The same as the functions in ArrayPositionIterator.
bool | pastEnd () const
const IPosition & | pos () const
IPosition | endPos () const
size_t | ndim () const

## Private Member Functions

| ReadOnlyArrayIterator (const ReadOnlyArrayIterator< T > &)
| Not implemented.
ReadOnlyArrayIterator< T > & | operator= (const ReadOnlyArrayIterator< T > &)

## Private Attributes

ArrayIterator< T > | ai

## Detailed Description

template<typename T>
class casacore::ReadOnlyArrayIterator< T >

Iterate a const Array cursor through a const Array.

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

This class behaves exactly like an ArrayIterator, only it iterates through const Arrays.

void CopyArray(Array<float> &to, const Array<float> &from)
{
//... check that they are conformant
ArrayIterator toiter(to,1);
ReadOnlyArrayIterator fromiter(from,1);
while (! toiter.pastEnd()) {
toiter.array() = fromiter.array(); // copy vector by vector
toiter.next(); fromiter.next();
}
}
casacore::ArrayIterator
Definition ArrayIter.h:70
casacore::Array
Definition Array.h:155
casacore::ReadOnlyArrayIterator::ReadOnlyArrayIterator
ReadOnlyArrayIterator(const Array< T > &arr, size_t byDim=1)
Step through array "arr" using a cursor of dimensionality "byDim".
Definition ArrayIter.h:173

Tip: This class is not derived from ArrayPositionIterator; For simplicity it merely contains an ArrayIterator to which it forwards requests and returns (const) results; The iterator classes should be rethought and reimplemented;

Definition at line 169 of file ArrayIter.h.

## Constructor & Destructor Documentation

## ReadOnlyArrayIterator() [1/3]

template<typename T>

casacore::ReadOnlyArrayIterator< T >::ReadOnlyArrayIterator | ( | const Array< T > & | arr,
|  | size_t | byDim = 1 )

inline explicit

Step through array "arr" using a cursor of dimensionality "byDim".

Definition at line 173 of file ArrayIter.h.

References ai.

Referenced by operator=(), and ReadOnlyArrayIterator().

## ReadOnlyArrayIterator() [2/3]

template<typename T>

casacore::ReadOnlyArrayIterator< T >::ReadOnlyArrayIterator | ( | const Array< T > & | arr,
|  | const IPosition & | axes,
|  | bool | axesAreCursor = true )

inline

Step through an array for the given iteration axes.

Definition at line 177 of file ArrayIter.h.

References ai.

## ReadOnlyArrayIterator() [3/3]

template<typename T>

casacore::ReadOnlyArrayIterator< T >::ReadOnlyArrayIterator | ( | const ReadOnlyArrayIterator< T > & |  | ) |

private

Not implemented.

References ReadOnlyArrayIterator().

## Member Function Documentation

## array()

template<typename T>

const Array< T > & casacore::ReadOnlyArrayIterator< 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 202 of file ArrayIter.h.

References ai.

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath().

## atStart()

template<typename T>

bool casacore::ReadOnlyArrayIterator< T >::atStart | ( |  | ) | const

inline

The same as the functions in ArrayPositionIterator.

Definition at line 206 of file ArrayIter.h.

References ai.

## endPos()

template<typename T>

IPosition casacore::ReadOnlyArrayIterator< T >::endPos | ( |  | ) | const

inline

Definition at line 209 of file ArrayIter.h.

References ai.

## ndim()

template<typename T>

size_t casacore::ReadOnlyArrayIterator< T >::ndim | ( |  | ) | const

inline

Definition at line 210 of file ArrayIter.h.

References ai.

## next()

template<typename T>

void casacore::ReadOnlyArrayIterator< T >::next | ( |  | ) |

inline

Move the cursor to the next position.

Definition at line 182 of file ArrayIter.h.

References ai.

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath().

## operator=()

template<typename T>

ReadOnlyArrayIterator< T > & casacore::ReadOnlyArrayIterator< T >::operator= | ( | const ReadOnlyArrayIterator< T > & |  | ) |

private

References ReadOnlyArrayIterator().

## origin()

template<typename T>

void casacore::ReadOnlyArrayIterator< T >::origin | ( |  | ) |

inline

Definition at line 197 of file ArrayIter.h.

References ai.

## pastEnd()

template<typename T>

bool casacore::ReadOnlyArrayIterator< T >::pastEnd | ( |  | ) | const

inline

Definition at line 207 of file ArrayIter.h.

References ai.

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath().

## pos()

template<typename T>

const IPosition & casacore::ReadOnlyArrayIterator< T >::pos | ( |  | ) | const

inline

Definition at line 208 of file ArrayIter.h.

References ai.

## reset()

template<typename T>

void casacore::ReadOnlyArrayIterator< T >::reset | ( |  | ) |

inline

Reset the cursor to the beginning.

Definition at line 196 of file ArrayIter.h.

References ai.

## set()

template<typename T>

void casacore::ReadOnlyArrayIterator< T >::set | ( | const IPosition & | cursorPos | ) |

inline

Set the cursor to the given position.

The position can only contain the iteration axes or it can be the full position.
In the first case the position must to be given in the order of the iteration axes as given in the constructor. In the latter case the position must be given in natural order (as given by function pos and only the cursor axes are taken into account.

Definition at line 192 of file ArrayIter.h.

References ai.

## Member Data Documentation

## ai

template<typename T>

ArrayIterator<T> casacore::ReadOnlyArrayIterator< T >::ai

private

Definition at line 219 of file ArrayIter.h.

Referenced by array(), atStart(), endPos(), ndim(), next(), origin(), pastEnd(), pos(), ReadOnlyArrayIterator(), ReadOnlyArrayIterator(), reset(), and set().

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

- casa/Arrays/ArrayIter.h