The indexing interface to 1-D arrays. Independent of the value type. More...
#include <ArrayIndexingBase1.h>
Public Types | |
typedef int | size_type |
The size type is a signed integer. | |
typedef FixedArray< 1, int > | index_type |
A multi-index for compatibility with higher dimensional arrays. | |
typedef IndexRange< 1, int > | range_type |
A range of indices. | |
Public Member Functions | |
Accessors | |
index_type | extents () const |
Return the extents of the array. | |
size_type | extent (const int) const |
Return the extent of the array. | |
const range_type & | ranges () const |
Return the index ranges of the array. | |
const index_type & | lbounds () const |
Return the index lower bounds. | |
const index_type & | ubounds () const |
Return the index upper bounds. | |
int | lbound (const int i) const |
Return the lower bound. | |
int | ubound (const int i) const |
Return the upper bound. | |
index_type | strides () const |
Return the strides between elements in each dimension. | |
Accessors, specialized for 1-D. | |
const range_type & | range () const |
Return the index range. | |
int | lbound () const |
Return the lower bound on the index range. | |
int | ubound () const |
Return the upper bound on the index range. | |
Accessors: Convert between a container index and a multi-index. | |
int | index (const index_type &mi) const |
Convert a multi-index to a container index. | |
int | index (const int i0) const |
Convert a multi-index to a container index. | |
void | index_to_indices (int index, int &i) const |
Convert a container index to a "multi-index" in a 1-D array. | |
void | index_to_indices (int index, ads::FixedArray< 1, int > &multi_index) const |
Convert a container index to a multi-index in a 1-D array. | |
File I/O | |
void | put (std::ostream &out) const |
Write the range to a file stream in ascii format. | |
void | write (std::ostream &out) const |
Write the range to a file stream in binary format. | |
Equality. | |
bool | operator== (const ArrayIndexingBase &x) const |
Return true if the ranges are the same. | |
Static Public Member Functions | |
Static members. | |
static int | rank () |
Return the rank (number of dimensions) of the array. | |
Protected Member Functions | |
Constructors etc. | |
ArrayIndexingBase () | |
Default constructor. Empty range. | |
ArrayIndexingBase (const ArrayIndexingBase &x) | |
Copy constructor. | |
ArrayIndexingBase & | operator= (const ArrayIndexingBase &x) |
Assignment operator. | |
ArrayIndexingBase (const index_type &extent) | |
Construct given the extent . | |
void | rebuild (const index_type &extent) |
Rebuild given the extent . | |
ArrayIndexingBase (const size_type size) | |
Construct given the size . | |
void | rebuild (const size_type size) |
Rebuild given the size . | |
ArrayIndexingBase (const range_type &range) | |
Construct given the index range. | |
void | rebuild (const range_type &range) |
Rebuild given the index range. | |
void | swap (ArrayIndexingBase &x) |
Swaps data with another ArrayIndexingBase. | |
~ArrayIndexingBase () | |
Destructor. |
The indexing interface to 1-D arrays. Independent of the value type.
typedef int ArrayIndexingBase< 1 >::size_type |
The size type is a signed integer.
Having std::size_t
(which is an unsigned integer) as the size type causes minor problems. Consult "Large Scale C++ Software Design" by John Lakos for a discussion of using unsigned integers in a class interface.
Reimplemented in Array< 1, T, A >, and ArrayIndexing< 1, T >.