Array< T > Class Template Reference

This Array class is a template class that provides arrays of simple types. More...

#include <array.h>

Inheritance diagram for Array< T >:

Inheritance graph
[legend]
Collaboration diagram for Array< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Array (long nbOfRows, long nbOfColumns)
void setSize (long nbOfRows, long nbOfColumns)
operator() (long row, long column) const
 Accessor Array(i,j).
T & operator() (long row, long column)
 Mutator Array(i,j).
T & operator[] (long position)
 Return the i element of the internal array by reference.
long nbOfRows () const
 Returns the number of rows in the array.
long nbOfColumns () const
 Returns the number of columns in the array.
void copyAndPrependColumn (Array &source)
 Copies data from source to the current object prepending an empty column.
void copySubset (Array &source, long lastColumnToCopy)
 Copies a subset of data from source to the current object.
void copySubset (Array &source, long firstColumnToCopy, long lastColumnToCopy, long startingColumn)
 Copies a subset of data from source to the current object.
void fillWithZeros ()
 Fills the array with zeros.
Array< T > & operator= (const Array< T > &source)
 Overloading of the operator=.
 Array (long nbOfRows, long nbOfColumns)
void setSize (long nbOfRows, long nbOfColumns)
operator() (long row, long column) const
 Accessor Array(i,j).
T & operator() (long row, long column)
 Mutator Array(i,j).
T & operator[] (long position)
 Return the i element of the internal array by reference.
long nbOfRows () const
 Returns the number of rows in the array.
long nbOfColumns () const
 Returns the number of columns in the array.
void copyAndPrependColumn (Array &source)
 Copies data from source to the current object prepending an empty column.
void copySubset (Array &source, long lastColumnToCopy)
 Copies a subset of data from source to the current object.
void copySubset (Array &source, long firstColumnToCopy, long lastColumnToCopy, long startingColumn)
 Copies a subset of data from source to the current object.
void fillWithZeros ()
 Fills the array with zeros.
Array< T > & operator= (const Array< T > &source)
 Overloading of the operator=.

Protected Attributes

long nbColumns
 Number of columns in the array.
long nbRows
 Number of rows in the array.
T * array
T * array

Detailed Description

template<class T>
class Array< T >

This Array class is a template class that provides arrays of simple types.

Array stores the array elements directly in the array. It can only deal with simple types. Array provides an easy way to acess the elements through the parenthesis operator.

Author:
Lynn Hazan


Member Function Documentation

template<class T>
T Array< T >::operator() ( long  row,
long  column 
) const [inline]

Accessor Array(i,j).

The rows and columns starts at 1.

Parameters:
row index
column index
Returns:
the element (by value)

template<class T>
T& Array< T >::operator() ( long  row,
long  column 
) [inline]

Mutator Array(i,j).

The rows and columns starts at 1.

Parameters:
row index
column index
Returns:
the element (by value)

template<class T>
T& Array< T >::operator[] ( long  position  )  [inline]

Return the i element of the internal array by reference.

The position starts at 0.

Parameters:
position index
Returns:
the element (by value)

template<class T>
long Array< T >::nbOfRows (  )  const [inline]

Returns the number of rows in the array.

Returns:
number of rows

template<class T>
long Array< T >::nbOfColumns (  )  const [inline]

Returns the number of columns in the array.

Returns:
number of columns

template<class T>
void Array< T >::copyAndPrependColumn ( Array< T > &  source  )  [inline]

Copies data from source to the current object prepending an empty column.

Parameters:
source Array containing the data to put in the current Array.

template<class T>
void Array< T >::copySubset ( Array< T > &  source,
long  lastColumnToCopy 
) [inline]

Copies a subset of data from source to the current object.

Copy from the first column to the lastColumnToCopy. Assumes that the Array has the correct size.

Parameters:
source Array containing the data to put in the current Array.
lastColumnToCopy last column containing data to copy, start at 1.

template<class T>
void Array< T >::copySubset ( Array< T > &  source,
long  firstColumnToCopy,
long  lastColumnToCopy,
long  startingColumn 
) [inline]

Copies a subset of data from source to the current object.

Copy from firstColumnToCopy to the lastColumnToCopy inserting them after startingColumn. Assumes that the Array has the correct size.

Parameters:
source Array containing the data to put in the current Array.
firstColumnToCopy first column containing data to copy, start at 1.
lastColumnToCopy last column containing data to copy, start at 1.
startingColumn column from where to start copying to.

template<class T>
T Array< T >::operator() ( long  row,
long  column 
) const [inline]

Accessor Array(i,j).

The rows and columns starts at 1.

Parameters:
row index
column index
Returns:
the element (by value)

template<class T>
T& Array< T >::operator() ( long  row,
long  column 
) [inline]

Mutator Array(i,j).

The rows and columns starts at 1.

Parameters:
row index
column index
Returns:
the element (by value)

template<class T>
T& Array< T >::operator[] ( long  position  )  [inline]

Return the i element of the internal array by reference.

The position starts at 0.

Parameters:
position index
Returns:
the element (by value)

template<class T>
long Array< T >::nbOfRows (  )  const [inline]

Returns the number of rows in the array.

Returns:
number of rows

template<class T>
long Array< T >::nbOfColumns (  )  const [inline]

Returns the number of columns in the array.

Returns:
number of columns

template<class T>
void Array< T >::copyAndPrependColumn ( Array< T > &  source  )  [inline]

Copies data from source to the current object prepending an empty column.

Parameters:
source Array containing the data to put in the current Array.

template<class T>
void Array< T >::copySubset ( Array< T > &  source,
long  lastColumnToCopy 
) [inline]

Copies a subset of data from source to the current object.

Copy from the first column to the lastColumnToCopy. Assumes that the Array has the correct size.

Parameters:
source Array containing the data to put in the current Array.
lastColumnToCopy last column containing data to copy, start at 1.

template<class T>
void Array< T >::copySubset ( Array< T > &  source,
long  firstColumnToCopy,
long  lastColumnToCopy,
long  startingColumn 
) [inline]

Copies a subset of data from source to the current object.

Copy from firstColumnToCopy to the lastColumnToCopy inserting them after startingColumn. Assumes that the Array has the correct size.

Parameters:
source Array containing the data to put in the current Array.
firstColumnToCopy first column containing data to copy, start at 1.
lastColumnToCopy last column containing data to copy, start at 1.
startingColumn column from where to start copying to.


The documentation for this class was generated from the following files:
Generated on Mon Sep 17 20:47:31 2007 for NeuroScope by  doxygen 1.5.1