Array4D< T > Class Template Reference

A 4-dimensional template for making arrays. More...

#include <Array4D.h>

List of all members.

Public Member Functions

int dim1 ()
 Gets the number of elements in the array's first dimension.
int dim2 ()
 Gets the number of elements in the array's second dimension.
int dim3 ()
 Gets the number of elements in the array's third dimension.
int dim4 ()
 Gets the number of elements in the array's fourth dimension.
int size ()
 Gets the total number of elements in the array.
T **** array ()
 Gets a pointer to an array containing the array elements.
void allocate (int i, int j, int k, int l)
 Allocates memory for the array.
void deallocate ()
 Deallocates memory for the array.
void operator= (const Array4D &rhs)
 Sets two arrays equal.
 Array4D ()
 Creates an array.
 Array4D (int i, int j, int k, int l)
 Creates an array and allocates memory.
 Array4D (const Array4D &rhs)
 Creates an array and sets it equal to another array.
 ~Array4D ()
 Destroy's the array and cleans up the memory.
T & operator() (int i, int j, int k, int l)
 Accesses element (i,j,k,l) of the array.

Private Attributes

int n_1
 Number of elements in the array's first dimension.
int n_2
 Number of elements in the array's second dimension.
int n_3
 Number of elements in the array's third dimension.
int n_4
 Number of elements in the array's fourth dimension.
T **** pArray
 Array containing the data.


Detailed Description

template<class T>
class Array4D< T >

A 4-dimensional template for making arrays.

All of the memory allocation and deallocation details are dealt with by the class.

Definition at line 43 of file Array4D.h.


Constructor & Destructor Documentation

template<class T>
Array4D< T >::Array4D (  )  [inline]

Creates an array.

Definition at line 213 of file Array4D.h.

References Array4D< T >::n_1, Array4D< T >::n_2, Array4D< T >::n_3, Array4D< T >::n_4, and Array4D< T >::pArray.

template<class T>
Array4D< T >::Array4D ( int  i,
int  j,
int  k,
int  l 
) [inline]

Creates an array and allocates memory.

Parameters:
i size of the array's first dimension.
j size of the array's second dimension.
k size of the array's third dimension.
l size of the array's fourth dimension.

Definition at line 225 of file Array4D.h.

References Array4D< T >::allocate(), Array4D< T >::n_1, Array4D< T >::n_2, Array4D< T >::n_3, Array4D< T >::n_4, and Array4D< T >::pArray.

template<class T>
Array4D< T >::Array4D ( const Array4D< T > &  rhs  )  [inline]

Creates an array and sets it equal to another array.

Parameters:
rhs array to set this array equal to.

Definition at line 235 of file Array4D.h.

References Array4D< T >::allocate(), Array4D< T >::n_1, Array4D< T >::n_2, Array4D< T >::n_3, Array4D< T >::n_4, and Array4D< T >::pArray.

template<class T>
Array4D< T >::~Array4D (  )  [inline]

Destroy's the array and cleans up the memory.

Definition at line 256 of file Array4D.h.

References Array4D< T >::deallocate().


Member Function Documentation

template<class T>
int Array4D< T >::dim1 (  )  [inline]

Gets the number of elements in the array's first dimension.

Returns:
number of elements in the array's first dimension.

Definition at line 87 of file Array4D.h.

References Array4D< T >::n_1.

template<class T>
int Array4D< T >::dim2 (  )  [inline]

Gets the number of elements in the array's second dimension.

Returns:
number of elements in the array's second dimension.

Definition at line 94 of file Array4D.h.

References Array4D< T >::n_2.

template<class T>
int Array4D< T >::dim3 (  )  [inline]

Gets the number of elements in the array's third dimension.

Returns:
number of elements in the array's third dimension.

Definition at line 101 of file Array4D.h.

References Array4D< T >::n_3.

template<class T>
int Array4D< T >::dim4 (  )  [inline]

Gets the number of elements in the array's fourth dimension.

Returns:
number of elements in the array's fourth dimension.

Definition at line 108 of file Array4D.h.

References Array4D< T >::n_4.

template<class T>
int Array4D< T >::size (  )  [inline]

Gets the total number of elements in the array.

Returns:
total number of elements in the array.

Definition at line 115 of file Array4D.h.

References Array4D< T >::n_1, Array4D< T >::n_2, and Array4D< T >::n_3.

template<class T>
T**** Array4D< T >::array (  )  [inline]

Gets a pointer to an array containing the array elements.

The ordering of this array is NOT specified.

Definition at line 121 of file Array4D.h.

References Array4D< T >::pArray.

template<class T>
void Array4D< T >::allocate ( int  i,
int  j,
int  k,
int  l 
) [inline]

Allocates memory for the array.

Parameters:
i size of the array's first dimension.
j size of the array's second dimension.
k size of the array's third dimension.
l size of the array's fourth dimension.

Definition at line 132 of file Array4D.h.

References Array4D< T >::deallocate(), Array4D< T >::n_1, Array4D< T >::n_2, Array4D< T >::n_3, Array4D< T >::n_4, and Array4D< T >::pArray.

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

template<class T>
void Array4D< T >::deallocate (  )  [inline]

Deallocates memory for the array.

Definition at line 171 of file Array4D.h.

References Array4D< T >::n_1, Array4D< T >::n_2, Array4D< T >::n_3, and Array4D< T >::pArray.

Referenced by Array4D< T >::allocate(), and Array4D< T >::~Array4D().

template<class T>
void Array4D< T >::operator= ( const Array4D< T > &  rhs  )  [inline]

template<class T>
T& Array4D< T >::operator() ( int  i,
int  j,
int  k,
int  l 
) [inline]

Accesses element (i,j,k,l) of the array.

Definition at line 261 of file Array4D.h.

References Array4D< T >::pArray.


Member Data Documentation

template<class T>
int Array4D< T >::n_1 [private]

Number of elements in the array's first dimension.

Definition at line 50 of file Array4D.h.

Referenced by Array4D< T >::allocate(), Array4D< T >::Array4D(), Array4D< T >::deallocate(), Array4D< T >::dim1(), Array4D< T >::operator=(), and Array4D< T >::size().

template<class T>
int Array4D< T >::n_2 [private]

Number of elements in the array's second dimension.

Definition at line 57 of file Array4D.h.

Referenced by Array4D< T >::allocate(), Array4D< T >::Array4D(), Array4D< T >::deallocate(), Array4D< T >::dim2(), Array4D< T >::operator=(), and Array4D< T >::size().

template<class T>
int Array4D< T >::n_3 [private]

Number of elements in the array's third dimension.

Definition at line 64 of file Array4D.h.

Referenced by Array4D< T >::allocate(), Array4D< T >::Array4D(), Array4D< T >::deallocate(), Array4D< T >::dim3(), Array4D< T >::operator=(), and Array4D< T >::size().

template<class T>
int Array4D< T >::n_4 [private]

Number of elements in the array's fourth dimension.

Definition at line 71 of file Array4D.h.

Referenced by Array4D< T >::allocate(), Array4D< T >::Array4D(), Array4D< T >::dim4(), and Array4D< T >::operator=().

template<class T>
T**** Array4D< T >::pArray [private]


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

Generated on Sat Jul 5 16:14:00 2008 for QMcBeaver by  doxygen 1.5.6