mat_morph< contents > Class Template Reference

Represents a two-dimensional matrix of pointers to objects. More...

#include <mat_morph.h>

Inheritance diagram for mat_morph< contents >:

Inheritance graph
[legend]
Collaboration diagram for mat_morph< contents >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 mat_morph (int rows=0, int cols=0)
 ~mat_morph ()
int rows () const
int columns () const
contents * get (int row, int column)
const contents * get (int row, int column) const
 retrieves the contents from the specified "row" and "column".
contents * acquire (int row, int column)
 checks the held pointer out of the matrix permanently.
bool put (int row, int column, const contents *to_put)
 stores "to_put" into the matrix at "row" and "column".
void reset (int rows=0, int columns=0)
 empties the matrix and changes its size.
void redimension (int new_rows, int new_columns)
 changes the size to contain "new_rows" by "new_columns" elements.
bool zap_row (int row_to_zap)
 removes a row from the matrix.
bool zap_column (int column_to_zap)
 removes a column from the matrix, destroying that column's contents.
bool insert_row (int before_row)
 inserts a row into the matrix before the "before_" parameter.
bool insert_column (int before_column)

Detailed Description

template<class contents>
class mat_morph< contents >

Represents a two-dimensional matrix of pointers to objects.

This is a similar concept to the amorph class, and hence this is called mat_morph, short for matrix amorph. The indices of the mat_morph range from zero to (maximum_value - 1) for rows and columns. Any pointers that are checked into the mat_morph become its property and they will be destroyed when it is destroyed unless they are re-acquired from it.

Definition at line 30 of file mat_morph.h.


Constructor & Destructor Documentation

template<class contents>
mat_morph< contents >::mat_morph ( int  rows = 0,
int  cols = 0 
)

Definition at line 33 of file mat_morph.cpp.

template<class contents>
mat_morph< contents >::~mat_morph (  )  [inline]

Definition at line 34 of file mat_morph.h.


Member Function Documentation

template<class contents>
int mat_morph< contents >::rows (  )  const [inline]

Definition at line 36 of file mat_morph.h.

Referenced by mat_morph< contents >::insert_column(), mat_morph< contents >::insert_row(), mat_morph< contents >::put(), mat_morph< contents >::redimension(), mat_morph< contents >::zap_column(), and mat_morph< contents >::zap_row().

template<class contents>
int mat_morph< contents >::columns (  )  const [inline]

Definition at line 37 of file mat_morph.h.

Referenced by mat_morph< contents >::insert_column(), mat_morph< contents >::insert_row(), mat_morph< contents >::put(), mat_morph< contents >::redimension(), mat_morph< contents >::zap_column(), and mat_morph< contents >::zap_row().

template<class contents>
contents * mat_morph< contents >::get ( int  row,
int  column 
)

Definition at line 41 of file mat_morph.cpp.

References amorph< contents >::operator[]().

template<class contents>
const contents * mat_morph< contents >::get ( int  row,
int  column 
) const

retrieves the contents from the specified "row" and "column".

Definition at line 37 of file mat_morph.cpp.

References amorph< contents >::get().

template<class contents>
contents * mat_morph< contents >::acquire ( int  row,
int  column 
)

checks the held pointer out of the matrix permanently.

this ensures that the returned pointer is not destroyed when the matrix is.

Definition at line 45 of file mat_morph.cpp.

References amorph< contents >::acquire().

Referenced by mat_morph< contents >::redimension().

template<class contents>
bool mat_morph< contents >::put ( int  row,
int  column,
const contents *  to_put 
)

stores "to_put" into the matrix at "row" and "column".

Definition at line 83 of file mat_morph.cpp.

References mat_morph< contents >::columns(), amorph< contents >::put(), and mat_morph< contents >::rows().

Referenced by mat_morph< contents >::redimension().

template<class contents>
void mat_morph< contents >::reset ( int  rows = 0,
int  columns = 0 
)

empties the matrix and changes its size.

Definition at line 53 of file mat_morph.cpp.

References amorph< contents >::clear_all(), and amorph< contents >::reset().

template<class contents>
void mat_morph< contents >::redimension ( int  new_rows,
int  new_columns 
)

changes the size to contain "new_rows" by "new_columns" elements.

data that was held previously stays in the amorph as long as its row and column indices are still valid.

Definition at line 62 of file mat_morph.cpp.

References mat_morph< contents >::acquire(), mat_morph< contents >::columns(), minimum(), mat_morph< contents >::put(), amorph< contents >::reset(), and mat_morph< contents >::rows().

template<class contents>
bool mat_morph< contents >::zap_row ( int  row_to_zap  ) 

removes a row from the matrix.

the mat_morph becomes one row less than before and all data from the deleted vector is lost.

Definition at line 92 of file mat_morph.cpp.

References bounds_halt, mat_morph< contents >::columns(), FUNCDEF, mat_morph< contents >::rows(), and amorph< contents >::zap().

template<class contents>
bool mat_morph< contents >::zap_column ( int  column_to_zap  ) 

removes a column from the matrix, destroying that column's contents.

Definition at line 108 of file mat_morph.cpp.

References bounds_halt, mat_morph< contents >::columns(), FUNCDEF, mat_morph< contents >::rows(), and amorph< contents >::zap().

template<class contents>
bool mat_morph< contents >::insert_row ( int  before_row  ) 

inserts a row into the matrix before the "before_" parameter.

all existing data is preserved, although it may have been moved aside.

Definition at line 123 of file mat_morph.cpp.

References bounds_halt, mat_morph< contents >::columns(), FUNCDEF, amorph< contents >::insert(), and mat_morph< contents >::rows().

template<class contents>
bool mat_morph< contents >::insert_column ( int  before_column  ) 

Definition at line 134 of file mat_morph.cpp.

References bounds_halt, mat_morph< contents >::columns(), FUNCDEF, and mat_morph< contents >::rows().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:30:52 2008 for HOOPLE Libraries by  doxygen 1.5.1