ATLAS Offline Software
|
Read-only multidimensional array. More...
#include <Array.h>
Public Types | |
enum | { NDIM = N } |
The number of dimensions of the array. More... | |
typedef ArrayIteratorChooser< N >::const_iterator | const_iterator |
The iterator for this container. More... | |
Public Member Functions | |
Array () | |
Default constructor. More... | |
Array (const Arrayrep &rep) | |
Constructor. More... | |
bool | valid () const |
Test for validity. More... | |
std::vector< unsigned int > | shape () const |
Return the array shape. More... | |
unsigned int | size (unsigned int dim=0) const |
Return the size of the array along one dimension. More... | |
Array< N-1 > | operator[] (unsigned int i) const |
Array indexing. More... | |
const Arrayelt * | ptr () const |
Return a direct pointer to array elements. More... | |
const_iterator | begin () const |
Return an iterator pointing at the beginning of the container. More... | |
const_iterator | end () const |
Return an iterator pointing past the end of the container. More... | |
void | write_array (std::ostream &stream) const |
Creates a text representation of the array content. More... | |
Protected Member Functions | |
Array (const Arrayrep &rep, unsigned int offs) | |
Private constructor for array indexing. More... | |
Protected Attributes | |
friend | WritableArray< N+1 > |
const Arrayrep * | m_rep |
Pointer to the representation. More... | |
unsigned int | m_offs |
Offset in the Arrayrep's data of the first element of this array. More... | |
Friends | |
class | Array< N+1 > |
class | ArrayIterator< N+1 > |
Read-only multidimensional array.
Array<N>
provides read-only access to an array. Indexing with [] returns an Array<N-1>
. Array<0>
is special; it doesn't support indexing, but does support implicit conversion to the element type, Arrayelt
. The Array
classes do not own their storage (and thus indexing does not require a complete copy). Rather, the complete data for the array are stored in an instance of Arrayrep
. An Array
holds a pointer to an Arrayrep
and an offset into the data.
Definition at line 137 of file Control/CxxUtils/CxxUtils/Array.h.
typedef ArrayIteratorChooser<N>::const_iterator CxxUtils::Array< N >::const_iterator |
The iterator for this container.
Definition at line 144 of file Control/CxxUtils/CxxUtils/Array.h.
anonymous enum |
The number of dimensions of the array.
Enumerator | |
---|---|
NDIM |
Definition at line 141 of file Control/CxxUtils/CxxUtils/Array.h.
CxxUtils::Array< N >::Array | ( | ) |
Default constructor.
This produces an invalid Array
that is not associated with an Arrayrep
. valid()
will return false
for such an array. The only other things that it is legal to do with an invalid array are to assign to it (which may make it valid) or request its size with size() (which will always return 0).
CxxUtils::Array< N >::Array | ( | const Arrayrep & | rep | ) |
Constructor.
rep | Arrayrep from which to initialize the array. |
Initialize an array from an Arrayrep
. The new array will represent the entire Arrayrep
. The dimension N
must match the length of the Arrayrep's
shape.
|
protected |
Private constructor for array indexing.
rep | Arrayrep from which to initialize the array. |
offs | Offset of the first element of the new array within rep. |
This is a private constructor used to make the Array
instances returned from an indexing operation.
const_iterator CxxUtils::Array< N >::begin | ( | ) | const |
Return an iterator pointing at the beginning of the container.
const_iterator CxxUtils::Array< N >::end | ( | ) | const |
Return an iterator pointing past the end of the container.
Array<N-1> CxxUtils::Array< N >::operator[] | ( | unsigned int | i | ) | const |
Array indexing.
i | The desired index. Must be less than the array size along this dimension. |
N-1
dimensional subarray in the array.Note that this operation is not available if N
is 0.
const Arrayelt* CxxUtils::Array< N >::ptr | ( | ) | const |
Return a direct pointer to array elements.
Subsequent elements follow in standard C indexing order.
std::vector<unsigned int> CxxUtils::Array< N >::shape | ( | ) | const |
Return the array shape.
The array shape is vector with one element for each array dimension, giving the size of the array along that dimension.
unsigned int CxxUtils::Array< N >::size | ( | unsigned int | dim = 0 | ) | const |
Return the size of the array along one dimension.
dim | The dimension of the size to retrieve. Must be less than the number of dimensions. |
dim
. bool CxxUtils::Array< N >::valid | ( | ) | const |
void CxxUtils::Array< N >::write_array | ( | std::ostream & | stream | ) | const |
Creates a text representation of the array content.
std::ostream | where the text should be written |
Writes the content of the array to a ostream. The sub-arrays are enclosed by square-brackets and separated by commas.
|
friend |
Definition at line 246 of file Control/CxxUtils/CxxUtils/Array.h.
|
friend |
Definition at line 250 of file Control/CxxUtils/CxxUtils/Array.h.
|
protected |
Offset in the Arrayrep's
data of the first element of this array.
Definition at line 258 of file Control/CxxUtils/CxxUtils/Array.h.
|
protected |
Pointer to the representation.
Null if this instance was created using the default constructor.
Definition at line 255 of file Control/CxxUtils/CxxUtils/Array.h.
|
protected |
Definition at line 250 of file Control/CxxUtils/CxxUtils/Array.h.