casa
5.7.0-16
|
Expanded IPosition for shapes. More...
#include <TSMShape.h>
Public Member Functions | |
TSMShape () | |
A zero-length TSMShape. More... | |
TSMShape (const IPosition &shape) | |
Construct from a shape and precalculate some values. More... | |
TSMShape (const TSMShape &that) | |
Copy constructor (copy semantics). More... | |
TSMShape & | operator= (const TSMShape &that) |
Assignment (copy semantics). More... | |
~TSMShape () | |
Int | operator() (uInt index) const |
Index into the TSMShape. More... | |
uInt | nelements () const |
The number of elements in this TSMShape. More... | |
Bool | conform (const TSMShape &other) const |
conform returns true if nelements() == other.nelements(). More... | |
size_t | offset (const IPosition &position) const |
Calculate the offset for a given position. More... | |
size_t | offset (const IPosition &position, const IPosition &origin) const |
IPosition | position (size_t offset) const |
Calculate the position for a given offset. More... | |
IPosition | position (size_t offset, const IPosition &origin) const |
IPosition | offsetIncrement (const IPosition &subShape) const |
Calculate the increments when stepping through an array in a linear way. More... | |
IPosition | offsetIncrement (const IPosition &subShape, const IPosition &stride) const |
Private Attributes | |
IPosition | data_p |
uInt | size_p |
Expanded IPosition for shapes.
Internal
TSMShape handles the shapes for the Tiled Storage Manager.
TSMShape is an extension of class IPosition to handle shapes. It contains some precalculated values to speed up the calculation of an array offset from an array index (and vice-versa).
The Tiled Hypercube Storage Manager is heavily using array shapes and determining offsets from array indices. This class makes these calculations more efficient.
Definition at line 77 of file TSMShape.h.
casacore::TSMShape::TSMShape | ( | ) |
A zero-length TSMShape.
casacore::TSMShape::TSMShape | ( | const IPosition & | shape | ) |
Construct from a shape and precalculate some values.
casacore::TSMShape::TSMShape | ( | const TSMShape & | that | ) |
Copy constructor (copy semantics).
casacore::TSMShape::~TSMShape | ( | ) |
conform returns true if nelements() == other.nelements().
Definition at line 174 of file TSMShape.h.
References casacore::IPosition::conform(), and data_p.
|
inline |
The number of elements in this TSMShape.
Since TSMShape objects use zero-based indexing, the maximum available index is nelements() - 1.
Definition at line 164 of file TSMShape.h.
References size_p.
size_t casacore::TSMShape::offset | ( | const IPosition & | position | ) | const |
Calculate the offset for a given position.
Calculate the increments when stepping through an array in a linear way.
This can be used to update the array offset without recalculating it after each step. For example:
IPosition casacore::TSMShape::offsetIncrement | ( | const IPosition & | subShape, |
const IPosition & | stride | ||
) | const |
Index into the TSMShape.
Indices are zero-based. If the preprocessor symbol AIPS_ARRAY_INDEX_CHECK is defined, "index" will be checked to ensure it is not out of bounds. If this check fails, an AipsError will be thrown.
Definition at line 169 of file TSMShape.h.
References data_p.
Assignment (copy semantics).
"this" and "that" must either be conformant (same size) or "this" must be 0-length, in which case it will resize itself to be the same length as "that".
IPosition casacore::TSMShape::position | ( | size_t | offset | ) | const |
Calculate the position for a given offset.
|
private |
Definition at line 159 of file TSMShape.h.
Referenced by conform(), and operator()().
|
private |
Definition at line 160 of file TSMShape.h.
Referenced by nelements().