ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CxxUtils::Array< 0 > Class Reference

Read-only multidimensional array, specialized for N=0. More...

#include <Array.h>

Inheritance diagram for CxxUtils::Array< 0 >:
Collaboration diagram for CxxUtils::Array< 0 >:

Public Types

enum  { NDIM = 0 }
 The number of dimensions of the array. 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...
 
 operator Arrayelt () const
 Convert to a number. More...
 
int asint () const
 Convert to an integer. 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

const Arrayelt * m_elt
 Pointer to this array's single element. More...
 

Friends

class Array< 1 >
 
class WritableArray< 1 >
 

Detailed Description

Read-only multidimensional array, specialized for N=0.

This is a specialization of Array for the case N=0, i.e., a scalar. It does not support indexing, but it does support implicit conversions to Arrayelt, as well as an explicit conversion to an integer.

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The number of dimensions of the array.

Enumerator
NDIM 

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

276 { NDIM = 0 };

Constructor & Destructor Documentation

◆ Array() [1/3]

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 thing that it is legal to do with an invalid array is to assign to it (which may make it valid).

◆ Array() [2/3]

CxxUtils::Array< 0 >::Array ( const 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.

◆ Array() [3/3]

CxxUtils::Array< 0 >::Array ( const Arrayrep rep,
unsigned int  offs 
)
protected

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

◆ asint()

int CxxUtils::Array< 0 >::asint ( ) const

Convert to an integer.

Returns
The Array<0> contents as an integer.

◆ operator Arrayelt()

CxxUtils::Array< 0 >::operator Arrayelt ( ) const

Convert to a number.

Returns
The Array<0> contents as a number.

◆ shape()

std::vector<unsigned int> CxxUtils::Array< 0 >::shape ( ) const

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. For Array<0>, this will always be an empty array.

◆ size()

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

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.

For Array<0>, dim must be 0, and the function will always return 0.

◆ valid()

bool CxxUtils::Array< 0 >::valid ( ) const

Test for validity.

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

◆ write_array()

void CxxUtils::Array< 0 >::write_array ( std::ostream &  stream) const

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.

Friends And Related Function Documentation

◆ Array< 1 >

friend class Array< 1 >
friend

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

◆ WritableArray< 1 >

friend class WritableArray< 1 >
friend

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

Member Data Documentation

◆ m_elt

const Arrayelt* CxxUtils::Array< 0 >::m_elt
protected

Pointer to this array's single element.

Null if this instance was created using the default constructor.

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


The documentation for this class was generated from the following file:
CxxUtils::Array< 0 >::NDIM
@ NDIM
Definition: Control/CxxUtils/CxxUtils/Array.h:276