ATLAS Offline Software
Loading...
Searching...
No Matches
CxxUtils::WritableArray< N > Class Template Reference

Read-write multidimensional array. More...

#include <Array.h>

Inheritance diagram for CxxUtils::WritableArray< N >:
Collaboration diagram for CxxUtils::WritableArray< N >:

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.

Public Member Functions

 WritableArray (Arrayrep &rep)
 Constructor.
WritableArray< N-1 > operator[] (unsigned int i)
 Array indexing.
Array< N-1 > operator[] (unsigned int i) const
 Array indexing.
Arrayeltptr ()
 Return a direct pointer to array elements.
bool valid () const
 Test for validity.
std::vector< unsigned int > shape () const
 Return the array shape.
unsigned int size (unsigned int dim=0) const
 Return the size of the array along one dimension.
const Arrayeltptr () const
 Return a direct pointer to array elements.
const_iterator begin () const
 Return an iterator pointing at the beginning of the container.
const_iterator end () const
 Return an iterator pointing past the end of the container.
void write_array (std::ostream &stream) const
 Creates a text representation of the array content.

Protected Attributes

const Arrayrepm_rep
 Pointer to the representation.
unsigned int m_offs
 Offset in the Arrayrep's data of the first element of this array.

Private Member Functions

 WritableArray (Arrayrep &rep, unsigned int offs)
 Private constructor for array indexing.

Private Attributes

Arrayrepm_rep_nc
 The underlying array representation, non-const copy.

Friends

class WritableArray< N+1 >

Detailed Description

template<unsigned int N>
class CxxUtils::WritableArray< N >

Read-write multidimensional array.

This class derives from Array<N>. It allows writing into the array, but otherwise works in the same way.

Definition at line 645 of file Control/CxxUtils/CxxUtils/Array.h.

Member Typedef Documentation

◆ const_iterator

template<unsigned int N>
typedef ArrayIteratorChooser<N>::const_iterator CxxUtils::Array< N >::const_iterator
inherited

The iterator for this container.

Definition at line 141 of file Control/CxxUtils/CxxUtils/Array.h.

Member Enumeration Documentation

◆ anonymous enum

template<unsigned int N>
anonymous enum
inherited

The number of dimensions of the array.

Enumerator
NDIM 

Definition at line 138 of file Control/CxxUtils/CxxUtils/Array.h.

Constructor & Destructor Documentation

◆ WritableArray() [1/2]

template<unsigned int N>
CxxUtils::WritableArray< N >::WritableArray ( Arrayrep & rep)

Constructor.

Parameters
repArrayrep 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.

◆ WritableArray() [2/2]

template<unsigned int N>
CxxUtils::WritableArray< N >::WritableArray ( Arrayrep & rep,
unsigned int offs )
private

Private constructor for array indexing.

Parameters
repArrayrep from which to initialize the array.
offsOffset 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.

Member Function Documentation

◆ begin()

template<unsigned int N>
const_iterator CxxUtils::Array< N >::begin ( ) const
inherited

Return an iterator pointing at the beginning of the container.

Returns
An iterator pointing at the beginning of the container.

◆ end()

template<unsigned int N>
const_iterator CxxUtils::Array< N >::end ( ) const
inherited

Return an iterator pointing past the end of the container.

Returns
An iterator pointing past the end of the container.

◆ operator[]() [1/2]

template<unsigned int N>
WritableArray< N-1 > CxxUtils::WritableArray< N >::operator[] ( unsigned int i)

Array indexing.

Parameters
iThe desired index. Must be less than the array size along this dimension.
Returns
The i'th N-1 dimensional subarray in the array.

Note that this operation is not available if N is 0.

◆ operator[]() [2/2]

template<unsigned int N>
Array< N-1 > CxxUtils::WritableArray< N >::operator[] ( unsigned int i) const

Array indexing.

Parameters
iThe desired index. Must be less than the array size along this dimension.
Returns
The i'th N-1 dimensional subarray in the array.

Note that this operation is not available if N is 0.

◆ ptr() [1/2]

template<unsigned int N>
const Arrayelt * CxxUtils::Array< N >::ptr ( ) const
inherited

Return a direct pointer to array elements.

Returns
A pointer to the first array elements.

Subsequent elements follow in standard C indexing order.

◆ ptr() [2/2]

template<unsigned int N>
Arrayelt * CxxUtils::WritableArray< N >::ptr ( )

Return a direct pointer to array elements.

Returns
A pointer to the first array elements.

Subsequent elements follow in standard C indexing order.

◆ shape()

template<unsigned int N>
std::vector< unsigned int > CxxUtils::Array< N >::shape ( ) const
inherited

Return the array shape.

Returns
The array shape.

The array shape is vector with one element for each array dimension, giving the size of the array along that dimension.

◆ size()

template<unsigned int N>
unsigned int CxxUtils::Array< N >::size ( unsigned int dim = 0) const
inherited

Return the size of the array along one dimension.

Parameters
dimThe dimension of the size to retrieve. Must be less than the number of dimensions.
Returns
The array size along dimension dim.

◆ valid()

template<unsigned int N>
bool CxxUtils::Array< N >::valid ( ) const
inherited

Test for validity.

Returns
True if the Array is associated with an Arrayrep, false if not.

◆ write_array()

template<unsigned int N>
void CxxUtils::Array< N >::write_array ( std::ostream & stream) const
inherited

Creates a text representation of the array content.

Parameters
std::ostreamwhere 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.

◆ WritableArray< N+1 >

template<unsigned int N>
friend class WritableArray< N+1 >
friend

Definition at line 698 of file Control/CxxUtils/CxxUtils/Array.h.

Member Data Documentation

◆ m_offs

template<unsigned int N>
unsigned int CxxUtils::Array< N >::m_offs
protectedinherited

Offset in the Arrayrep's data of the first element of this array.

Definition at line 255 of file Control/CxxUtils/CxxUtils/Array.h.

◆ m_rep

template<unsigned int N>
const Arrayrep* CxxUtils::Array< N >::m_rep
protectedinherited

Pointer to the representation.

Null if this instance was created using the default constructor.

Definition at line 252 of file Control/CxxUtils/CxxUtils/Array.h.

◆ m_rep_nc

template<unsigned int N>
Arrayrep* CxxUtils::WritableArray< N >::m_rep_nc
private

The underlying array representation, non-const copy.

Definition at line 704 of file Control/CxxUtils/CxxUtils/Array.h.


The documentation for this class was generated from the following file: