Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PackTable Class Template Reference

Packed two-dimensional table; works also with native types. More...

#include <mtable.h>

Inheritance diagram for PackTable:

List of all members.

Public Methods

 PackTable ()
 PackTable (int rs, int cs)
 PackTable (const PackTable &orig, bool deep=false)
void destroy ()
virtual void make (int nrows, int ncols)
const TYPE & get (int row, int col) const
TYPE & get (int row, int col)

Public Attributes

int rows
int cols

Detailed Description

template<class TYPE>
class PackTable< TYPE >

Packed two-dimensional table; works also with native types.

Ideal for storing numeric matrices; any mathematical matrix implementation would most probably inherit PackTable<double>.

Definition at line 56 of file mtable.h.


Constructor & Destructor Documentation

PackTable   [inline]
 

Creates a null-sized table.

Dimensions can be given later with the make() method.

Definition at line 63 of file mtable.h.

PackTable int    rs,
int    cs
[inline]
 

Creates a Table.

Parameters:
rs  Number of rows in the Table.
cs  Number of columns in the Table.

Definition at line 74 of file mtable.h.

PackTable const PackTable< TYPE > &    orig,
bool    deep = false
[inline]
 

Copy constructor.

Copying is shallow by default: works *fast* with native types, but messes more complex objects up. Use with caution.

Parameters:
orig  Original table to be copied.
deep  Should we copy deep?

Definition at line 89 of file mtable.h.


Member Function Documentation

void destroy   [inline]
 

Destroys the content of the Table, as well as its dimensions.

Can be resized later with the make() method.

Definition at line 116 of file mtable.h.

Referenced by PackTable< double >::make().

TYPE& get int    row,
int    col
[inline]
 

Retrieves a reference to an item in the Table.

Non-const version.

Parameters:
row  Row index of the item. 0-based.
col  Column index of the item. 0-based.

Definition at line 163 of file mtable.h.

const TYPE& get int    row,
int    col
const [inline]
 

Retrieves a reference to an item in the Table.

Const version.

Parameters:
row  Row index of the item. 0-based.
col  Column index of the item. 0-based.

Definition at line 148 of file mtable.h.

Referenced by PackTable< double >::PackTable().

virtual void make int    nrows,
int    ncols
[inline, virtual]
 

Creates or recreates the Table with the given dimensions.

If the Table has any old contents, they are destroyed.

Parameters:
nrows  Number of rows in the Table.
ncols  Number of columns in the Table.

Reimplemented in Matrix.

Definition at line 129 of file mtable.h.

Referenced by Matrix::make(), and PackTable< double >::PackTable().


Member Data Documentation

int cols
 

Number of columns in the table.

Definition at line 202 of file mtable.h.

Referenced by PackTable< double >::destroy(), PackTable< double >::get(), PackTable< double >::make(), and PackTable< double >::PackTable().

int rows
 

Number of rows in the table.

Definition at line 199 of file mtable.h.

Referenced by PackTable< double >::destroy(), PackTable< double >::get(), PackTable< double >::make(), and PackTable< double >::PackTable().


The documentation for this class was generated from the following file:
Generated on Thu Feb 10 20:06:43 2005 for LibMagiC by doxygen1.2.18