#include <source/patchdata/array/array_access/MDA_Access.h>
Inheritance diagram for MDA_IndexRange< MDA_DIM >:
std::ostream & | streamPut (std::ostream &os) const |
Output to ostream. | |
std::istream & | streamGet (std::istream &is) |
Input from istream. | |
std::ostream & | operator<< (std::ostream &os, const MDA_IndexRange< MDA_DIM > &r) |
std::istream & | operator>> (std::istream &is, MDA_IndexRange< MDA_DIM > &r) |
Public Types | |
typedef short | dim_t |
Type for the dimension counter. | |
typedef int | index_t |
Type for the index. | |
Public Member Functions | |
MDA_IndexRange (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0)) | |
Constructor for setting index data using size and starting points. | |
MDA_IndexRange (const index_t *si, const index_t *sf) | |
Constructor for setting index data to a range. | |
virtual | ~MDA_IndexRange () |
Virtual destructor to support inheritance. | |
void | setSizeAndStart (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0)) |
void | setInclusiveRange (const index_t first[MDA_DIM], const index_t final[MDA_DIM]) |
const MDA_IndexRange & | adjustDim (dim_t d, index_t first, index_t final) |
Adjust the dimensions. | |
bool | operator== (const MDA_IndexRange &r) const |
Equivalence comparison. | |
bool | operator!= (const MDA_IndexRange &r) const |
Inequivalence comparison. | |
const index_t & | beg (size_t i) const |
Give starting index of a given dimension. | |
const index_t & | end (size_t i) const |
Give ending index (one more than the last valid index) of a given dimension. | |
const size_t & | size (size_t i) const |
Give size along a given dimension. | |
size_t | totalSize () const |
Give size for all dimensions. | |
bool | has (index_t i0) const |
Check if indices are in range. | |
bool | has (index_t i0, index_t i1) const |
Check if indices are in range. | |
bool | has (index_t i0, index_t i1, index_t i2) const |
Check if indices are in range. | |
bool | has (index_t i0, index_t i1, index_t i2, index_t i3) const |
Check if indices are in range. | |
Protected Types | |
enum | { D0 = 0, D1 = (MDA_DIM > 1 ? 1 : 0), D2 = (MDA_DIM > 2 ? 2 : 0), D3 = (MDA_DIM > 3 ? 3 : 0), D4 = (MDA_DIM > 4 ? 4 : 0) } |
Dimension number (to avoid compiler warnings, set to zero when unused). More... | |
Protected Attributes | |
index_t | d_start [MDA_DIM >0?MDA_DIM:1] |
Array of starting indices. | |
index_t | d_stop [MDA_DIM >0?MDA_DIM:1] |
Array of stopping indices. | |
size_t | d_size [MDA_DIM >0?MDA_DIM:1] |
Array of sizes. |
Defines the abstract index range and methods for setting and accessing it.
Nothing is known about the ordering of the array.
typedef short MDA_IndexRange< MDA_DIM >::dim_t |
Type for the dimension counter.
Type dim_t could be "unsigned short" instead of "short", but using short causes the GNU compiler to issue unneeded warnings about certain comparisons always being false (when instantiating with MDA_DIM of 1).
Reimplemented in MDA_OrderRowMajor< MDA_DIM >, and MDA_OrderColMajor< MDA_DIM >.
typedef int MDA_IndexRange< MDA_DIM >::index_t |
Type for the index.
Reimplemented in MDA_OrderRowMajor< MDA_DIM >, and MDA_OrderColMajor< MDA_DIM >.
anonymous enum [protected] |
MDA_IndexRange< MDA_DIM >::MDA_IndexRange | ( | const size_t * | sz = ((size_t*)0) , |
|
const index_t * | st = ((index_t*)0) | |||
) | [inline] |
Constructor for setting index data using size and starting points.
Any pointers that are NULL are not used. The resulting default settings are:
There is another constructor which accepts the first and final indices instead of the sizes and first indices. NOTE: the place of the starting points is different than it is for the constructor taking final indices instead of sizes.
sz | Array sizes |
st | Array starting indices |
MDA_IndexRange< MDA_DIM >::MDA_IndexRange | ( | const index_t * | si, | |
const index_t * | sf | |||
) | [inline] |
Constructor for setting index data to a range.
This version takes two index_t*
arguments, for the initial and final indices. It does not support default arguments until after the indices argument. NOTE: the place of the initial indices is different than it is for the constructor taking sizes instead of final indices.
If si
is NULL
, starting indices are set to 0. If sf
is NULL
, sizes are set to zero.
si | Array of initial indices |
sf | Array of final indices |
virtual MDA_IndexRange< MDA_DIM >::~MDA_IndexRange | ( | ) | [inline, virtual] |
Virtual destructor to support inheritance.
void MDA_IndexRange< MDA_DIM >::setSizeAndStart | ( | const size_t * | sz = ((size_t*)0) , |
|
const index_t * | st = ((index_t*)0) | |||
) | [inline] |
Set size and starting indices.
sz | Array sizes (NULL for no change) |
st | Starting indices (NULL for no change) |
Reimplemented in MDA_OrderRowMajor< MDA_DIM >, and MDA_OrderColMajor< MDA_DIM >.
void MDA_IndexRange< MDA_DIM >::setInclusiveRange | ( | const index_t | first[MDA_DIM], | |
const index_t | final[MDA_DIM] | |||
) | [inline] |
Set first and final indices (inclusive).
first | First valid indices (NULL for no change) |
final | Final valid indices (NULL for no change) |
Reimplemented in MDA_OrderRowMajor< MDA_DIM >, and MDA_OrderColMajor< MDA_DIM >.
const MDA_IndexRange& MDA_IndexRange< MDA_DIM >::adjustDim | ( | dim_t | d, | |
index_t | first, | |||
index_t | final | |||
) | [inline] |
Adjust the dimensions.
Adjust the first and final indices. Set the dimension to adjust to >= MDA_DIM to adjust all dimensions. Note: The third argument is the increment to the final index and not the size.
Note: No error checking is done, for example, to make sure that the resulting size is non-negative.
d | Dimension to adjust |
first | Increment to first index |
final | Increment to final index |
bool MDA_IndexRange< MDA_DIM >::operator== | ( | const MDA_IndexRange< MDA_DIM > & | r | ) | const [inline] |
Equivalence comparison.
bool MDA_IndexRange< MDA_DIM >::operator!= | ( | const MDA_IndexRange< MDA_DIM > & | r | ) | const [inline] |
Inequivalence comparison.
std::ostream& MDA_IndexRange< MDA_DIM >::streamPut | ( | std::ostream & | os | ) | const [inline] |
Output to ostream.
std::istream& MDA_IndexRange< MDA_DIM >::streamGet | ( | std::istream & | is | ) | [inline] |
Input from istream.
const index_t& MDA_IndexRange< MDA_DIM >::beg | ( | size_t | i | ) | const [inline] |
Give starting index of a given dimension.
i | index of dimension |
const index_t& MDA_IndexRange< MDA_DIM >::end | ( | size_t | i | ) | const [inline] |
Give ending index (one more than the last valid index) of a given dimension.
i | index of dimension |
const size_t& MDA_IndexRange< MDA_DIM >::size | ( | size_t | i | ) | const [inline] |
Give size along a given dimension.
i | index of dimension |
size_t MDA_IndexRange< MDA_DIM >::totalSize | ( | ) | const [inline] |
Give size for all dimensions.
bool MDA_IndexRange< MDA_DIM >::has | ( | index_t | i0 | ) | const [inline] |
Check if indices are in range.
bool MDA_IndexRange< MDA_DIM >::has | ( | index_t | i0, | |
index_t | i1 | |||
) | const [inline] |
Check if indices are in range.
bool MDA_IndexRange< MDA_DIM >::has | ( | index_t | i0, | |
index_t | i1, | |||
index_t | i2 | |||
) | const [inline] |
Check if indices are in range.
bool MDA_IndexRange< MDA_DIM >::has | ( | index_t | i0, | |
index_t | i1, | |||
index_t | i2, | |||
index_t | i3 | |||
) | const [inline] |
Check if indices are in range.
std::ostream& operator<< | ( | std::ostream & | os, | |
const MDA_IndexRange< MDA_DIM > & | r | |||
) | [friend] |
std::istream& operator>> | ( | std::istream & | is, | |
MDA_IndexRange< MDA_DIM > & | r | |||
) | [friend] |
index_t MDA_IndexRange< MDA_DIM >::d_start[MDA_DIM >0?MDA_DIM:1] [protected] |
Array of starting indices.
index_t MDA_IndexRange< MDA_DIM >::d_stop[MDA_DIM >0?MDA_DIM:1] [protected] |
Array of stopping indices.
size_t MDA_IndexRange< MDA_DIM >::d_size[MDA_DIM >0?MDA_DIM:1] [protected] |
Array of sizes.