Simple2DArray Class Template Reference

A 2D array data type that manages the allocation and deallocation of memory. More...

#include <Simple2DArray.h>

Inheritance diagram for Simple2DArray::

Basic2DArray Num2DArray List of all members.

Public Methods

 Simple2DArray ()
 Null constructor.

 Simple2DArray (const BasicArray< T > &array, const size_type nrows=1, const EnumDataOwned own=DataNotOwned)
 Constructor that initializes the 2D array using a given array. More...

 Simple2DArray (const size_type nrows, const size_type ncols, T *d=((T *) 0), const EnumDataOwned own=DataNotOwned)
 Constructor that initializes the 2D array using a given array. More...

 Simple2DArray (const size_type nrows, const size_type ncols, const BasicArray< T > &array, const EnumDataOwned own=DataNotOwned)
 Constructor that initializes the 2D array using a given array. More...

 Simple2DArray (const Simple2DArray< T > &array)
 Copy constructor.

Simple2DArray< T > & operator= (const Simple2DArray< T > &array)
 Copies the array object by constructing a new Simple2DArray.

Simple2DArray< T > & operator= (const T &val)
 Set all elements of the array to val.

int operator== (const Simple2DArray< T > &array) const
 Checks to see if the current array equals array.

int operator!= (const Simple2DArray< T > &array) const
 Checks to see if the current array does not equal array.

int compare (const Simple2DArray< T > &array) const
 Compares the current array with array. More...

virtual int write (ostream &output) const
 Write the array to the output stream. More...

virtual int read (istream &input)
 Read the array from the input stream.

virtual int write (PackBuffer &output) const
 Pack the array into a PackBuffer class.

virtual int read (UnPackBuffer &input)
 Unpack the array from an UnPackBuffer class.


Detailed Description

template<class T>
class Simple2DArray< T >

A 2D array data type that manages the allocation and deallocation of memory.

The Simple2DArray class extends the Basic2DArray class to include I/O operations and comparison methods.


Constructor & Destructor Documentation

template<class T>
Simple2DArray< T >::Simple2DArray const BasicArray< T > &    array,
const size_type    nrows = 1,
const EnumDataOwned    own = DataNotOwned
[inline]
 

Constructor that initializes the 2D array using a given array.

The 2D array only constructs the array of pointers, which point into the data owned by the array object.

template<class T>
Simple2DArray< T >::Simple2DArray const size_type    nrows,
const size_type    ncols,
T *    d = ((T*)0),
const EnumDataOwned    own = DataNotOwned
[inline]
 

Constructor that initializes the 2D array using a given array.

The 2D array only constructs the array of pointers, which point into the data owned by the d object.

template<class T>
Simple2DArray< T >::Simple2DArray const size_type    nrows,
const size_type    ncols,
const BasicArray< T > &    array,
const EnumDataOwned    own = DataNotOwned
[inline]
 

Constructor that initializes the 2D array using a given array.

The 2D array only constructs the array of pointers, which point into the data owned by the array object.


Member Function Documentation

template<class T>
int Simple2DArray< T >::compare const Simple2DArray< T > &    array const
 

Compares the current array with array.

If the current array is longer, then returns 1. If shorter, then returns -1. Otherwise, does a pairwise comparison on elements of both arrays. If there exists a nonequal pair of elements, then returns 1 if the current array is greater and -1 otherwise.

template<class T>
int Simple2DArray< T >::write ostream &    os const [virtual]
 

Write the array to the output stream.

The format for this output is

 <nrows> <ncols> <elt-1,1> <elt-1,2> ... <elt-1,m> ... <elt-n,m> 


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