OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Array1D< T > Class Template Reference

One-dimensional array. More...

#include <Array1D.h>

Inheritance diagram for Array1D< T >:
Collaboration diagram for Array1D< T >:

Public Types

typedef T value_type
 The value type of this array.
typedef T * iterator
 The iterator type for the array.
typedef const T * const_iterator
 The iterator type for constant array.

Public Member Functions

 Array1D ()
 Default constructor.
 Array1D (int n)
 Constructor.
 Array1D (int n, const T &t)
 Constructor.
 Array1D (const Array1D< T > &)
 ~Array1D ()
Array1D< T > & operator= (const Array1D< T > &)
T & operator() (int n)
 Get reference to element.
const T & operator() (int n) const
 Get value of element.
T & operator[] (int)
 Get reference to element.
const T & operator[] (int) const
 Get value of element.
iterator begin ()
 Get beginning of data.
iterator end ()
 Get end of data.
const_iterator begin () const
 Get beginning of data.
const_iterator end () const
 Get end of data.
int size () const
 Get array size.
void resize (int size)
 Change array size.

Protected Attributes

int len
T * data

Detailed Description

template<class T>
class Array1D< T >

One-dimensional array.

Definition at line 36 of file Array1D.h.

Member Typedef Documentation

◆ const_iterator

template<class T>
typedef const T* Array1D< T >::const_iterator

The iterator type for constant array.

Definition at line 47 of file Array1D.h.

◆ iterator

template<class T>
typedef T* Array1D< T >::iterator

The iterator type for the array.

Definition at line 44 of file Array1D.h.

◆ value_type

template<class T>
typedef T Array1D< T >::value_type

The value type of this array.

Definition at line 41 of file Array1D.h.

Constructor & Destructor Documentation

◆ Array1D() [1/4]

template<class T>
Array1D< T >::Array1D ( )

Default constructor.

Definition at line 127 of file Array1D.h.

References data, and len.

Referenced by Array1D(), operator=(), Vector< T >::Vector(), Vector< T >::Vector(), Vector< T >::Vector(), Vector< T >::Vector(), and Vector< T >::Vector().

◆ Array1D() [2/4]

template<class T>
Array1D< T >::Array1D ( int n)
explicit

Constructor.

Definition at line 140 of file Array1D.h.

References data, and len.

◆ Array1D() [3/4]

template<class T>
Array1D< T >::Array1D ( int n,
const T & t )

Constructor.

Definition at line 146 of file Array1D.h.

References begin(), data, end(), and len.

Here is the call graph for this function:

◆ Array1D() [4/4]

template<class T>
Array1D< T >::Array1D ( const Array1D< T > & array)

Definition at line 133 of file Array1D.h.

References Array1D(), begin(), data, end(), and len.

Here is the call graph for this function:

◆ ~Array1D()

template<class T>
Array1D< T >::~Array1D ( )

Definition at line 153 of file Array1D.h.

References data.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

template<class T>
Array1D< T >::const_iterator Array1D< T >::begin ( ) const

Get beginning of data.

Definition at line 216 of file Array1D.h.

References data.

◆ end() [1/2]

template<class T>
Array1D< T >::iterator Array1D< T >::end ( )

◆ end() [2/2]

template<class T>
Array1D< T >::const_iterator Array1D< T >::end ( ) const

Get end of data.

Definition at line 222 of file Array1D.h.

References data, and len.

◆ operator()() [1/2]

template<class T>
T & Array1D< T >::operator() ( int n)

Get reference to element.

Definition at line 186 of file Array1D.h.

References data, and size().

Here is the call graph for this function:

◆ operator()() [2/2]

template<class T>
const T & Array1D< T >::operator() ( int n) const

Get value of element.

Definition at line 195 of file Array1D.h.

References data, and size().

Here is the call graph for this function:

◆ operator=()

template<class T>
Array1D< T > & Array1D< T >::operator= ( const Array1D< T > & rhs)

Definition at line 159 of file Array1D.h.

References Array1D(), begin(), data, end(), and len.

Referenced by Vector< T >::operator=().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T>
T & Array1D< T >::operator[] ( int i)
inline

Get reference to element.

Definition at line 174 of file Array1D.h.

References data.

◆ operator[]() [2/2]

template<class T>
const T & Array1D< T >::operator[] ( int i) const
inline

Get value of element.

Definition at line 180 of file Array1D.h.

References data.

◆ resize()

template<class T>
void Array1D< T >::resize ( int size)

Change array size.

Definition at line 234 of file Array1D.h.

References begin(), data, and len.

Here is the call graph for this function:

◆ size()

Member Data Documentation

◆ data

template<class T>
T* Array1D< T >::data
protected

◆ len

template<class T>
int Array1D< T >::len
protected

Definition at line 116 of file Array1D.h.

Referenced by Array1D(), Array1D(), Array1D(), Array1D(), end(), end(), operator=(), resize(), and size().


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