The indexing interface to 1-D arrays. More...
#include <ArrayIndexing.h>
Public Types | |
| typedef types::value_type | value_type |
| The element type of the array. | |
| typedef types::parameter_type | parameter_type |
| The parameter type. | |
| typedef types::unqualified_value_type | unqualified_value_type |
| The unqualified value type. | |
| typedef types::pointer | pointer |
| A pointer to an array element. | |
| typedef types::const_pointer | const_pointer |
| A pointer to a constant array element. | |
| typedef types::reference | reference |
| A reference to an array element. | |
| typedef types::const_reference | const_reference |
| A reference to a constant array element. | |
| typedef types::size_type | size_type |
| The size type is a signed integer. | |
| typedef types::difference_type | difference_type |
| Pointer difference type. | |
| 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. | |
| typedef ArrayIndexIterator< 1 > | index_iterator |
| A multi-index iterator. | |
Public Member Functions | |
Accessors | |
| index_type | extents () const |
| Return the extents of the array. | |
| size_type | extent (const int i) 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. | |
| index_iterator | indices_begin () const |
| Return an index iterator to the beginning of the indices. | |
| index_iterator | indices_end () const |
| Return an index iterator to the end of the indices. | |
| const_pointer | root () const |
Return the root for indexing, i.e., the location of (*this)(lbound()). | |
Accessors: Indexing. | |
| parameter_type | operator() (const index_type &mi) const |
| Return the specified element. | |
| parameter_type | operator() (const int i) const |
| Return the specified element. | |
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. | |
Manipulators. | |
| pointer | root () |
| Return the root for indexing. | |
Manipulators: Array indexing. | |
| reference | operator() (const index_type &mi) |
| Return a reference to the element. | |
| reference | operator() (const int i) |
| Return a reference to the element. | |
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. | |
| void | pretty_print (std::ostream &out) const |
| Write to a file stream in a tabular format. | |
Equality. | |
| template<typename T2 > | |
| bool | operator== (const ArrayIndexing< 1, T2 > &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. | |
| ArrayIndexing () | |
| Default constructor. Empty range. | |
| ArrayIndexing (const ArrayIndexing &x) | |
| Copy constructor. Shallow copy. | |
| ArrayIndexing (const index_type &extent, const pointer data) | |
Construct given the extent and a pointer to the data. | |
| void | rebuild (const index_type &extent, const pointer data) |
Rebuild given the extent and a pointer to the data. | |
| ArrayIndexing (const size_type size, const pointer data) | |
Construct given the size and a pointer to the data. | |
| void | rebuild (const size_type size, const pointer data) |
Rebuild given the size and a pointer to the data. | |
| ArrayIndexing (const range_type &range, const pointer data) | |
Construct given the index range and a pointer to the data. | |
| void | rebuild (const range_type &range, const pointer data) |
Rebuild given the index range and a pointer to the data. | |
| void | swap (ArrayIndexing &x) |
| Swaps data with another ArrayIndexing. | |
| ~ArrayIndexing () | |
| Destructor. Do nothing. Leave memory management to derived classes. | |
The indexing interface to 1-D arrays.
| T | is the value type. By default it is double. |
This class implements the indexing interface to an array.
| typedef types::parameter_type ArrayIndexing< 1, T >::parameter_type |
The parameter type.
This is used for passing the value type as an argument.
Reimplemented in Array< 1, T, A >.
| typedef types::size_type ArrayIndexing< 1, T >::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 from ArrayIndexingBase< 1 >.
Reimplemented in Array< 1, T, A >.
| typedef types::unqualified_value_type ArrayIndexing< 1, T >::unqualified_value_type |
The unqualified value type.
The value type with top level const and volatile qualifiers removed.
Reimplemented in Array< 1, T, A >.
| reference ArrayIndexing< 1, T >::operator() | ( | const int | i | ) | [inline] |
Return a reference to the element.
This performs indexing into the array. The index i must be in the range [lbound() .. ubound()). This is different than the container indexing performed in ArrayContainer::operator[].
| parameter_type ArrayIndexing< 1, T >::operator() | ( | const int | i | ) | const [inline] |
Return the specified element.
This performs indexing into the array. The index i must be in the range [lbound() .. ubound()). This is different than the container indexing performed in ArrayContainer::operator[].
| void ArrayIndexing< 1, T >::pretty_print | ( | std::ostream & | out | ) | const |
Write to a file stream in a tabular format.
Write one element per line.
1.6.3