Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PackTable Class Template Reference

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

#include <mtable.h>

Inheritance diagram for PackTable::

Object Matrix List of all members.

Public Methods

 PackTable ()
 PackTable (int rs, int cs)
 PackTable (const PackTable &orig, bool deep=false)
 ~PackTable ()
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

Protected Attributes

TYPE* data

Detailed Description

template<class TYPE> class PackTable

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 30 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 37 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 48 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 63 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 90 of file mtable.h.

Referenced by 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 137 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 122 of file mtable.h.

Referenced by PackTable().

void make ( int rs,
int cs ) [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 103 of file mtable.h.

Referenced by PackTable(), and Matrix::make().


Member Data Documentation

int cols
 

Number of columns in the table.

Definition at line 176 of file mtable.h.

int rows
 

Number of rows in the table.

Definition at line 173 of file mtable.h.


The documentation for this class was generated from the following file:
Generated at Tue Dec 4 19:53:31 2001 for MagiC++ by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001