NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

arr2< T > Class Template Reference
[Array classes]

#include <arr.h>

Inheritance diagram for arr2< T >:

List of all members.

Public Member Functions

 arr2 ()
 arr2 (long sz1, long sz2)
 arr2 (const arr2 &orig)
 ~arr2 ()
long size1 () const
long size2 () const
long size () const
void alloc (long sz1, long sz2)
void fast_alloc (long sz1, long sz2)
void dealloc ()
void fill (const T &val)
arr2operator= (const arr2 &orig)
template<typename T2>
T * operator[] (T2 n)
template<typename T2>
const T * operator[] (T2 n) const
void minmax (T &minv, T &maxv) const
void swap (arr2 &other)


Detailed Description

template<typename T>
class arr2< T >

Two-dimensional array type. The storage ordering is the same as in C. An entry is located by address arithmetic, not by double dereferencing. The indices start at zero.

Definition at line 183 of file arr.h.


Constructor & Destructor Documentation

template<typename T>
arr2< T >::arr2 (  )  [inline]

Creates a zero-sized array.

Definition at line 200 of file arr.h.

template<typename T>
arr2< T >::arr2 ( long  sz1,
long  sz2 
) [inline]

Creates an array with the dimensions sz1 and sz2.

Definition at line 202 of file arr.h.

template<typename T>
arr2< T >::arr2 ( const arr2< T > &  orig  )  [inline]

Creates the array as a copy of orig.

Definition at line 205 of file arr.h.

template<typename T>
arr2< T >::~arr2 (  )  [inline]

Frees the memory associated with the array.

Definition at line 208 of file arr.h.


Member Function Documentation

template<typename T>
long arr2< T >::size1 (  )  const [inline]

Returns the first array dimension.

Definition at line 211 of file arr.h.

template<typename T>
long arr2< T >::size2 (  )  const [inline]

Returns the second array dimension.

Definition at line 213 of file arr.h.

template<typename T>
long arr2< T >::size (  )  const [inline]

Returns the total array size, i.e. the product of both dimensions.

Definition at line 215 of file arr.h.

template<typename T>
void arr2< T >::alloc ( long  sz1,
long  sz2 
) [inline]

Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is the same as the currently allocated space, no reallocation is performed.

Definition at line 221 of file arr.h.

template<typename T>
void arr2< T >::fast_alloc ( long  sz1,
long  sz2 
) [inline]

Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is smaller than the currently allocated space, no reallocation is performed.

Definition at line 231 of file arr.h.

template<typename T>
void arr2< T >::dealloc (  )  [inline]

Deallocates the space and makes the array zero-sized.

Definition at line 239 of file arr.h.

template<typename T>
void arr2< T >::fill ( const T &  val  )  [inline]

Sets all array elements to val.

Definition at line 242 of file arr.h.

template<typename T>
arr2& arr2< T >::operator= ( const arr2< T > &  orig  )  [inline]

Changes the array to be a copy of orig.

Definition at line 246 of file arr.h.

template<typename T>
template<typename T2>
T* arr2< T >::operator[] ( T2  n  )  [inline]

Returns a pointer to the beginning of slice n.

Definition at line 261 of file arr.h.

template<typename T>
template<typename T2>
const T* arr2< T >::operator[] ( T2  n  )  const [inline]

Returns a constant pointer to the beginning of slice n.

Definition at line 263 of file arr.h.

template<typename T>
void arr2< T >::minmax ( T &  minv,
T &  maxv 
) const [inline]

Returns the minimum and maximum entry in minv and maxv, respectively. Throws an exception if the array is zero-sized.

Definition at line 268 of file arr.h.

template<typename T>
void arr2< T >::swap ( arr2< T > &  other  )  [inline]

Swaps contents and sizes with other.

Definition at line 281 of file arr.h.


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

Generated on Fri Jun 18 16:12:29 2010 for LevelS C++ support library
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650