CVR-Lib last update 20 Sep 2009

cvr::genericLattice2D< T > Class Template Reference
[Linear AlgebraAggregate Data Types]

Container class for two dimensional lattices. More...

#include <cvrGenericLattice2D.h>

Inheritance diagram for cvr::genericLattice2D< T >:

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

Collaboration graph
[legend]

List of all members.

Protected Member Functions

Memory allocation and deallocation
Restrict all memory allocation and deallocation to these functions.

virtual row_typeallocNewRows (const int fromRow, const int toRow)
T * reserveNewMem (const int theSize) const
void reserveMem (const int fromRow, const int fromColumn, const int toRow, const int toColumn)
void releaseMem (T *&block) const
void releaseMem ()
void releaseRows (row_type *&theRows, const int offset) const
void distributeMem (const int firstRow, const int firstColumn, const int lastRow, const int lastColumn, T *block, row_type *theRows) const

Protected Attributes

size_type theSize_
size_type first_
size_type last_
int totalSize_
bool ownData_
eConstantReference constReference_
T * theElements_
row_typerowAddressTable_

Package Functions

 genericLattice2D ()
 genericLattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol)
 genericLattice2D (const size_type &from, const size_type &to)
 genericLattice2D (const iinterval &rows, const iinterval &columns)
 genericLattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T &value)
 genericLattice2D (const size_type &from, const size_type &to, const T &value)
 genericLattice2D (const iinterval &rows, const iinterval &columns, const T &value)
 genericLattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T data[])
 genericLattice2D (const size_type &from, const size_type &to, const T data[])
 genericLattice2D (const iinterval &rows, const iinterval &columns, const T data[])
 genericLattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, T data[], const eConstantReference constRef)
 genericLattice2D (const size_type &from, const size_type &to, T data[], const eConstantReference constRef)
 genericLattice2D (const iinterval &rows, const iinterval &columns, T data[], const eConstantReference constRef)
 genericLattice2D (const genericLattice2D< T > &other)
 genericLattice2D (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=MaxIndex, const int toCol=MaxIndex)
 genericLattice2D (const genericLattice2D< T > &other, const size_type &from, const size_type &to)
 genericLattice2D (const genericLattice2D< T > &other, const iinterval &rows, const iinterval &columns)
 genericLattice2D (const genericLattice2D< T > &other, const genericLattice1D< int > &rows)
virtual ~genericLattice2D ()
bool ownsData () const
void restoreOwnership ()
void useExternData (const int fromRow, const int fromCol, const int toRow, const int toCol, T data[], const eConstantReference constRef=VariableReference)
void useExternData (const size_type &from, const size_type &to, T data[], const eConstantReference constRef=VariableReference)
void useExternData (const iinterval &rows, const iinterval &columns, T data[], const eConstantReference constRef=VariableReference)
void attach (const int fromRow, const int fromCol, const int toRow, const int toCol, T *data)
void attach (const size_type &from, const size_type &to, T *data)
void attach (const iinterval &rows, const iinterval &columns, T *data)
void detach (genericLattice2D< T > &receiver)
void detach (genericVector< T > &receiver)
void swap (genericLattice2D< T > &other)
int rows () const
int columns () const
int firstRow () const
int firstColumn () const
int lastRow () const
int lastColumn () const
const size_typesize () const
const size_typefirstIndex () const
const size_typelastIndex () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
iterator inverseBegin ()
const_iterator inverseBegin () const
iterator inverseEnd ()
const_iterator inverseEnd () const
void resize (const int fromRow, const int fromCol, const int toRow, const int toCol, const T &iniValue, const eResizeType resizeType=CopyAndInit)
void resize (const size_type &from, const size_type &to, const T &iniValue, const eResizeType resizeType=CopyAndInit)
void resize (const iinterval &rows, const iinterval &columns, const T &iniValue, const eResizeType resizeType=CopyAndInit)
void resize (const int fromRow, const int fromCol, const int toRow, const int toCol)
void resize (const size_type &from, const size_type &to)
void resize (const iinterval &rows, const iinterval &columns)
void allocate (const int fromRow, const int fromCol, const int toRow, const int toCol)
void allocate (const size_type &from, const size_type &to)
void allocate (const iinterval &rows, const iinterval &columns)
void assign (const int fromRow, const int fromCol, const int toRow, const int toCol, const T &initValue)
void assign (const size_type &from, const size_type &to, const T &initValue)
void assign (const iinterval &rows, const iinterval &columns, const T &initValue)
void clear ()
bool empty () const
void fill (const T &iniValue, const int fromRow=MinIndex, const int fromCol=MinIndex, const int toRow=MaxIndex, const int toCol=MaxIndex)
void fill (const T &iniValue, const size_type &from, const size_type &to=size_type(MaxIndex, MaxIndex))
void fill (const T &iniValue, const irectangle &window)
void fill (const T data[], const int fromRow=MinIndex, const int fromCol=MinIndex, const int toRow=MaxIndex, const int toCol=MaxIndex)
void fill (const T data[], const size_type &from, const size_type &to=size_type(MaxIndex, MaxIndex))
void fill (const T data[], const irectangle &window)
void fill (const genericLattice2D< T > &mat, const int fromRow=MinIndex, const int fromCol=MinIndex, const int toRow=MaxIndex, const int toCol=MaxIndex, const int startAtRow=MinIndex, const int startAtCol=MinIndex)
void fill (const genericLattice2D< T > &mat, const size_type &from, const size_type &to=size_type(MaxIndex, MaxIndex), const size_type &startAt=size_type(MinIndex, MinIndex))
void fill (const genericLattice2D< T > &mat, const irectangle &window, const size_type &start=size_type(MinIndex, MinIndex))
T & at (const int row, const int col)
const T & at (const int row, const int col) const
T & at (const size_type &p)
const T & at (const size_type &p) const
T & elem (const int pos)
const T & elem (const int pos) const
row_typegetRow (const int row)
const row_typegetRow (const int row) const
row_typeoperator[] (const int row)
const row_typeoperator[] (const int row) const
void getRowCopy (const int row, row_type &theRow) const
row_type getRowCopy (const int row) const
void getColumnCopy (const int col, row_type &theCol) const
row_type getColumnCopy (const int col) const
void setRow (const int row, const row_type &theRow)
void setColumn (const int col, const row_type &theCol)
genericLattice2D< T > & copy (const genericLattice2D< T > &other)
genericLattice2D< T > & copy (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=MaxIndex, const int toCol=MaxIndex)
genericLattice2D< T > & copy (const genericLattice2D< T > &other, const size_type &from, const size_type &to)
genericLattice2D< T > & copy (const genericLattice2D< T > &other, const iinterval &r, const iinterval &c)
genericLattice2D< T > & copy (const genericLattice2D< T > &other, const irectangle &window)
genericLattice2D< T > & copyRows (const genericLattice2D< T > &other, const genericLattice1D< int > &idx)
genericLattice2D< T > & copyColumns (const genericLattice2D< T > &other, const genericLattice1D< int > &idx)
template<typename U >
genericLattice2D< T > & castFrom (const genericLattice2D< U > &other)
genericLattice2D< T > & castFrom (const genericLattice2D< T > &other)
template<typename U >
genericLattice2D< T > & castFrom (const genericLattice2D< U > &other, const int fromRow, const int fromCol, const int toRow=MaxIndex, const int toCol=MaxIndex)
genericLattice2D< T > & castFrom (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=MaxIndex, const int toCol=MaxIndex)
virtual const std::string & name () const
virtual genericLattice2D< T > * clone () const
virtual genericLattice2D< T > * newInstance () const
bool equals (const genericLattice2D< T > &other) const
bool operator== (const genericLattice2D< T > &other) const
genericLattice2D< T > & operator= (const genericLattice2D< T > &other)
Apply Methods
Following methods are used to apply simple functions to each element of the vector.

genericLattice2D< T > & apply (T(*function)(T))
genericLattice2D< T > & apply (const genericLattice2D< T > &other, T(*function)(T))
genericLattice2D< T > & apply (T(*function)(const T &))
genericLattice2D< T > & apply (const genericLattice2D< T > &other, T(*function)(const T &))
genericLattice2D< T > & apply (const genericLattice2D< T > &other, T(*function)(const T &, const T &))
genericLattice2D< T > & apply (const genericLattice2D< T > &other, T(*function)(T, T))
genericLattice2D< T > & apply (const genericLattice2D< T > &a, const genericLattice2D< T > &b, T(*function)(const T &, const T &))
genericLattice2D< T > & apply (const genericLattice2D< T > &a, const genericLattice2D< T > &b, T(*function)(T, T))
Input and Output
virtual bool write (ioHandler &handler, const bool complete=true) const
virtual bool read (ioHandler &handler, const bool complete=true)

Internal types and classes

typedef
cvr::constReferenceException 
constReferenceException
typedef T value_type
typedef ipoint size_type
typedef genericLattice1D< T > row_type
typedef T * pointer
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
 __pad0__:debugIterator<genericLattice2D<T>
false iterator
 __pad1__:debugIterator<genericLattice2D<T>
true const_iterator


Detailed Description

template<class T>
class cvr::genericLattice2D< T >

Container class for two dimensional lattices.

The cvr::genericLattice2D class is a container class implemented as a template.

The cvr::genericLattice2D class allows the representation of two dimensional lattice, containing an element at each point of the lattice. The points are inidicated with an ordered pair n x m, where n and m can be taken from intervals selected at construction time, that may include negative values.

The type of the elements contained must be static in nature. All types defined in cvrTypes.h use static members and can be contained by the cvr::genericLattice1D and cvr::genericLattice2D classes.

If you need to create a genericLattice2D of floats with 20 rows and 15 columns, all elements initialized with an initial value of 4.27 just create it:

 cvr::genericLattice2D<float> myMat(-9,10,
                                    -7,8,4.27f) // creates genericLattice2D
                                                // with 300 elements all
                                                // initialized with 4.27f

To access the cvr::genericLattice2D elements use the access operators. There are many possibilities. With at(const int row, const int col) it is possible to access an element directly.

With getRow(const int row) you can get the row cvr::lattice1D. You cannot for instance resize nor change the memory referenced in this lattice1D (see cvr::lattice1D::resize). For example:

 float accu = 0; // initialize accumulator
 cvr::genericLattice2D<float> myMat(-9,10,-7,8,4.27f)
 cvr::genericLattice1D<float> myLat;

 for (int j = myMat.firstRow(); j <= myMat.lastRow(); j++) {
   for (int i = myMat.firstColumn(); i <= myMat.lastColumn(); i++) {
   tmp += myMat.at(j,i); // access each element of the genericLattice2D:
                         // j is the row and i the column
   }
 }

 myMat.getRowCopy(5,myLat);    // copy the row with index 5 in myLat!
 myLat.resize(-6,6);           // Valid, the vector has its own memory!
 myMat.getRow(5).resize(-6,6); // ERROR!! the vector is not resizable!

Lattices in the CVR-Lib use always a continuous block of memory, which allows efficient elementwise operations.

See also:
cvr::lattice2D
The genericLattice2D has following methods:

Member Typedef Documentation

template<class T>
typedef const T* cvr::genericLattice2D< T >::const_pointer

Const pointer to value_type.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
typedef const T& cvr::genericLattice2D< T >::const_reference

Const reference to value_type.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

Exception thrown when a constant reference is violated.

template<class T>
typedef T* cvr::genericLattice2D< T >::pointer

Pointer to value_type.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
typedef T& cvr::genericLattice2D< T >::reference

Reference to value_type.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
typedef genericLattice1D<T> cvr::genericLattice2D< T >::row_type

Vector type of each row.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
typedef ipoint cvr::genericLattice2D< T >::size_type

Return type of the size() member.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
typedef T cvr::genericLattice2D< T >::value_type

Type of the contained data.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.


Constructor & Destructor Documentation

template<class T>
cvr::genericLattice2D< T >::genericLattice2D (  )  [package]

Default constructor creates an empty genericLattice2D.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol 
) [package]

Create a genericLattice2D with uninitialized elements.

Parameters:
fromRow lowest row index
fromCol lowest column index
toRow highest row index (inclusive)
toCol highest column index (inclusive)

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const size_type from,
const size_type to 
) [package]

Create a rows x cols genericLattice2D with uninitialized elements.

Parameters:
from lowest row and column
to highest row and column

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const iinterval rows,
const iinterval columns 
) [package]

Create a genericLattice2D with uninitialized elements.

Parameters:
rows interval used for the rows
columns interval used for the columns

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
const T &  value 
) [package]

Create a genericLattice2D and initialize all elements with the given value.

Parameters:
fromRow lowest row index
fromCol lowest column index
toRow highest row index (inclusive)
toCol highest column index (inclusive)
value value used for initializing the elements

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const size_type from,
const size_type to,
const T &  value 
) [package]

Create a genericLattice2D and initialize all elements with the given value.

Parameters:
from lowest index
to highest index (inclusive)
value value used for initializing the elements

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const iinterval rows,
const iinterval columns,
const T &  value 
) [package]

Create a genericLattice2D and initialize all elements with the given value.

Parameters:
rows interval used for the rows
columns interval used for the columns
value value used for initializing the elements

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
const T  data[] 
) [package]

Create a genericLattice2D and initialize all elements with the data pointed by data.

The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Parameters:
fromRow lowest row index
fromCol lowest column index
toRow highest row index (inclusive)
toCol highest column index (inclusive)
data pointer to the memory block with the data to be initialized with.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const size_type from,
const size_type to,
const T  data[] 
) [package]

Create a genericLattice2D and initialize all elements with the data pointed by data.

The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Parameters:
from lowest index
to highest index (inclusive)
data pointer to the memory block with the data to be initialized with.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const iinterval rows,
const iinterval columns,
const T  data[] 
) [package]

Create a genericLattice2D and initialize all elements with the data pointed by data.

The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Parameters:
rows interval used for the rows
columns interval used for the columns
data pointer to the memory block with the data to be initialized with.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
data[],
const eConstantReference  constRef 
) [package]

Create a genericLattice2D and use the given data as if it was given through the useExternData().

See also:
useExternData()
The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Note:
Please observe that the last argument makes a huge difference to the constructors that do not have it. Here the data is not copied, just a reference is kept. Without the last argument, the data is always copied.
Parameters:
fromRow lowest row index
fromCol lowest column index
toRow highest row index (inclusive)
toCol highest column index (inclusive)
data pointer to the memory block with the data to be initialized with.
constRef usually you want this value to be ConstantReference.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const size_type from,
const size_type to,
data[],
const eConstantReference  constRef 
) [package]

Create a genericLattice2D and use the given data as if it was given through the useExternData().

See also:
useExternData()
The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Note:
Please observe that the last argument makes a huge difference to the constructors that do not have it. Here the data is not copied, just a reference is kept. Without the last argument, the data is always copied.
Parameters:
from lowest index
to highest index (inclusive)
data pointer to the memory block with the data to be initialized with.
constRef usually you want this value to be ConstantReference.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const iinterval rows,
const iinterval columns,
data[],
const eConstantReference  constRef 
) [package]

Create a genericLattice2D and use the given data as if it was given through the useExternData().

See also:
useExternData()
The first elements of the data will be copied on the first row, the next ones on the second row and so on.

Note:
Please observe that the last argument makes a huge difference to the constructors that do not have it. Here the data is not copied, just a reference is kept. Without the last argument, the data is always copied.
Parameters:
rows interval for rows
columns interval for columns
data pointer to the memory block with the data to be initialized with.
constRef usually you want this value to be ConstantReference.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const genericLattice2D< T > &  other  )  [package]

Copy constructor.

Create this genericLattice2D as a copy of another genericLattice2D.

Parameters:
other the genericLattice2D to be copied.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const genericLattice2D< T > &  other,
const int  fromRow,
const int  fromCol,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [package]

Copy constructor.

Create this genericLattice2D as a copy of another genericLattice2D for this const version, the data will be always copied!

Parameters:
other the genericLattice2D to be copied.
fromRow initial row of the other genericLattice2D to be copied
fromCol initial column of the other genericLattice2D to be copied
toRow last row to be copied of the other genericLattice2D
toCol last column to be copied of the other genericLattice2D

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const genericLattice2D< T > &  other,
const size_type from,
const size_type to 
) [package]

Copy constructor.

Create this genericLattice2D as a copy of a sublattice2D of another genericLattice2D.

Parameters:
other the genericLattice2D to be copied.
from initial position in the other genericLattice2D to be copied
to last position to be copied of the other genericLattice2D

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const genericLattice2D< T > &  other,
const iinterval rows,
const iinterval columns 
) [package]

Copy constructor.

Create this genericLattice2D as a copy of a sublattice2D of another genericLattice2D.

Parameters:
other the genericLattice2D to be copied.
rows interval of rows to be copied.
columns interval of columns to be copied.

template<class T>
cvr::genericLattice2D< T >::genericLattice2D ( const genericLattice2D< T > &  other,
const genericLattice1D< int > &  rows 
) [package]

Copy constructor.

Create this genericLattice2D as a copy of another genericLattice2D taking only the rows indicated by the vector.

The data will be always copied! Multiple occurence of one row index in rows is allowed.

Parameters:
other the genericLattice2D to be copied.
rows indices of the rows to be copied

template<class T>
virtual cvr::genericLattice2D< T >::~genericLattice2D (  )  [package, virtual]

Destructor.


Member Function Documentation

template<class T>
void cvr::genericLattice2D< T >::allocate ( const iinterval rows,
const iinterval columns 
) [inline, package]

Change the dimensions of the genericLattice2D and leave ALL data uninitialized.

Parameters:
rows interval of valid rows
columns interval of valid columns
The old values will be discarded and the new data will be kept uninitialized. In principle this is an alias for resize(newSize.y, newSize.x, T(), AllocateOnly).

If the resize is possible (see useExternData()), this object will always own the data!

template<class T>
void cvr::genericLattice2D< T >::allocate ( const size_type from,
const size_type to 
) [inline, package]

Change the dimensions of the genericLattice2D and leave ALL data uninitialized.

Parameters:
from initial index
to final index
The old values will be discarded and the new data will be kept uninitialized. In principle this is an alias for resize(newSize.y, newSize.x, T(), AllocateOnly).

If the resize is possible (see useExternData()), this object will always own the data!

template<class T>
void cvr::genericLattice2D< T >::allocate ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol 
) [inline, package]

Change the dimensions of the genericLattice2D and leave ALL data uninitialized.

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index (inclusive)
toCol final column index (inclusive)
The old values will be discarded and the new data will be kept uninitialized. In principle this is an alias for resize(newRows,newCols,T(),AllocateOnly).

If the resize is possible (see useExternData()), this object will always own the data!

template<class T>
virtual row_type* cvr::genericLattice2D< T >::allocNewRows ( const int  fromRow,
const int  toRow 
) [inline, protected, virtual]

Allocate n number of rows or the appropriate type.

Never remove the returned pointer directly, since it is moved with an offset of fromRow.

You need to add to the pointer "fromRow" before deleting it.

If the given interval is invalid (fromRow > toRow) then a null pointer will be returned.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  a,
const genericLattice2D< T > &  b,
T(*)(T, T)  function 
) [package]

A two-parameter C-function receives the i-th elements of both given matrices and leaves the result here.

Note that both matrices must have the same size!

Parameters:
a the first genericLattice2D
b the second genericLattice2D
function a pointer to C-function with two parameters
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  a,
const genericLattice2D< T > &  b,
T(*)(const T &, const T &)  function 
) [package]

A two-parameter C-function receives the i-th elements of both given matrices and leaves the result here.

Note that both matrices must have the same size!

Parameters:
a the first genericLattice2D
b the second genericLattice2D
function a pointer to C-function with two parameters
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  other,
T(*)(T, T)  function 
) [package]

A two-parameter C-function receives the i-th elements of this and the given genericLattice2D and the result will be left in this genericLattice2D.

Note that both matrices must have the same size!

Parameters:
other the second genericLattice2D to be considered (the first genericLattice2D will be this object!)
function a pointer to C-function with two parameters
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  other,
T(*)(const T &, const T &)  function 
) [package]

A two-parameter C-function receives the i-th elements of this and the given genericLattice2D and the result will be left in this genericLattice2D.

Note that both matrices must have the same size!

Parameters:
other the second genericLattice2D to be considered (the first genericLattice2D will be this object!)
function a pointer to C-function with two parameters
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  other,
T(*)(const T &)  function 
) [package]

Applies a C-function to each element of the other genericLattice2D.

Parameters:
other the genericLattice2D which elements will go through the given function.
function a pointer to a C-function
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( T(*)(const T &)  function  )  [package]

Applies a C-function to each element of the genericLattice2D.

Parameters:
function a pointer to a C-function
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( const genericLattice2D< T > &  other,
T(*)(T)  function 
) [package]

Applies a C-function to each element of the other genericLattice2D.

Parameters:
other the genericLattice2D which elements will go through the given function.
function a pointer to a C-function
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::apply ( T(*)(T)  function  )  [package]

Applies a C-function to each element of the genericLattice2D.

Parameters:
function a pointer to a C-function
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
void cvr::genericLattice2D< T >::assign ( const iinterval rows,
const iinterval columns,
const T &  initValue 
) [inline, package]

Change the dimensions of the genericLattice2D and initialize ALL data with the given value.

The old values will be discarded and all data will be initialized with initValue. In principle this is an alias for resize(newSize.y, newSize.x, initValue, Init).

If the resize is possible (see useExternData()), this object will always own the data!

Parameters:
rows interval of valid rows
columns interval of valid columns
initValue value to be assigned to all lattice2D elements

template<class T>
void cvr::genericLattice2D< T >::assign ( const size_type from,
const size_type to,
const T &  initValue 
) [inline, package]

Change the dimensions of the genericLattice2D and initialize ALL data with the given value.

The old values will be discarded and all data will be initialized with initValue. In principle this is an alias for resize(newSize.y, newSize.x, initValue, Init).

If the resize is possible (see useExternData()), this object will always own the data!

Parameters:
from initial index
to final index
initValue value to be assigned to all lattice2D elements

template<class T>
void cvr::genericLattice2D< T >::assign ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
const T &  initValue 
) [inline, package]

Change the dimensions of the genericLattice2D and initialize ALL data with the given value.

The old values will be discarded and all data will be initialized with initValue. In principle this is an alias for resize(newRows, newCols, initValue, Init).

If the resize is possible (see useExternData()), this object will always own the data!

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index (inclusive)
toCol final column index (inclusive)
initValue value to be assigned to all lattice2D elements

template<class T>
const T& cvr::genericLattice2D< T >::at ( const size_type p  )  const [inline, package]

Const access operator of genericLattice2D element as a point in a 2D-Map.

Parameters:
p position of the element (this is equivalent to at(p.y,p.x))
Returns:
a const reference to the vector element

template<class T>
T& cvr::genericLattice2D< T >::at ( const size_type p  )  [inline, package]

Access operator of genericLattice2D element as a point in a 2D-Map.

Parameters:
p position of the element (this is equivalent to at(p.y,p.x))
Returns:
a reference to the genericLattice2D element

template<class T>
const T& cvr::genericLattice2D< T >::at ( const int  row,
const int  col 
) const [inline, package]

Read-only access at the given row and column.

Parameters:
row the row of the element
col the column of the element
Returns:
a reference to the genericLattice2D element

template<class T>
T& cvr::genericLattice2D< T >::at ( const int  row,
const int  col 
) [inline, package]

Access element at the given row and column.

Parameters:
row the row of the element
col the column of the element
Returns:
a reference to the genericLattice2D element

template<class T>
void cvr::genericLattice2D< T >::attach ( const iinterval rows,
const iinterval columns,
T *  data 
) [inline, package]

Attach extern data to the genericLattice2D.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

The memory will be administrated by this genericLattice2D object, and may be deleted if required (genericLattice2D deleted or resized!). The user should not try to manipulate the memory allocation of the data after the attachment! See also useExternData().

Parameters:
rows interval for rows
columns interval fro columns
data a pointer to the memory block to be used

template<class T>
void cvr::genericLattice2D< T >::attach ( const size_type from,
const size_type to,
T *  data 
) [inline, package]

Attach extern data to the genericLattice2D.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

The memory will be administrated by this genericLattice2D object, and may be deleted if required (genericLattice2D deleted or resized!). The user should not try to manipulate the memory allocation of the data after the attachment! See also useExternData().

Parameters:
from initial index
to final index (inclusive)
data a pointer to the memory block to be used

template<class T>
void cvr::genericLattice2D< T >::attach ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
T *  data 
) [package]

Attach extern data to the genericLattice2D.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

The memory will be administrated by this genericLattice2D object, and may be deleted if required (genericLattice2D deleted or resized!). The user should not try to manipulate the memory allocation of the data after the attachment! See also useExternData().

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index (inclusive)
toCol final column index (inclusive)
data a pointer to the memory block to be used

template<class T>
const_iterator cvr::genericLattice2D< T >::begin (  )  const [inline, package]

Return first element of the genericLattice2D as a const_iterator.

Note that you can not change the values of the genericLattice2D elements when you use a const_iterator. See also begin() for an example

template<class T>
iterator cvr::genericLattice2D< T >::begin (  )  [inline, package]

Return iterator to the begin of the genericLattice2D.

The use of the interators is similar to the iterators of the Standard Template Library (STL). If you need to iterate on all elements of the genericLattice2D, you can use following code:

 int tmp,accu;                  // a temporal variable
 cvr::genericLattice2D<int> myMat(10,8,1); // a vector with 10 elements
 cvr::genericLattice2D<int>::iterator it;  // an iterator

 for (it=myMat.begin();it!=myMat.end();it++) {
   tmp = *it;                   // tmp has value of element pointed
                                // by the iterator.
   accu += tmp;
   (*it) = accu;                // change the value in the lattice.
 }

Please note that if you define it as a const_iterator, you can not do something like *it=accu.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::castFrom ( const genericLattice2D< T > &  other,
const int  fromRow,
const int  fromCol,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [package]

This is just an alias for copy(const genericLattice2D<T>&, const int fromRow, const int fromCol, const int toRow, const int toCol) to facilitate generic programming.

Parameters:
other The genericLattice2D to be copied.
fromRow initial row of the other genericLattice2D to be copied
fromCol initial column of the other genericLattice2D to be copied
toRow last row to be copied of the other genericLattice2D
toCol last column to be copied of the other genericLattice2D
Returns:
a reference to the current casted lattice2D.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
template<typename U >
genericLattice2D<T>& cvr::genericLattice2D< T >::castFrom ( const genericLattice2D< U > &  other,
const int  fromRow,
const int  fromCol,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [inline, package]

Copy a sublattice2D of the other genericLattice2D by casting each of its elements.

Parameters:
other The genericLattice2D to be casted
fromRow initial row of the other genericLattice2D to be copied
fromCol initial column of the other genericLattice2D to be copied
toRow last row to be copied of the other genericLattice2D
toCol last column to be copied of the other genericLattice2D
Returns:
a reference to the current casted lattice2D.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::castFrom ( const genericLattice2D< T > &  other  )  [package]

This is just an alias for copy(const genericLattice2D<T>&) to facilitate generic programming.

Parameters:
other The genericLattice2D to be copied.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
template<typename U >
genericLattice2D<T>& cvr::genericLattice2D< T >::castFrom ( const genericLattice2D< U > &  other  )  [inline, package]

Copy the other genericLattice2D by casting each of its elements.

Parameters:
other The genericLattice2D to be casted

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
void cvr::genericLattice2D< T >::clear (  )  [package]

Clears the genericLattice2D (at the end this will be an empty genericLattice2D).

template<class T>
virtual genericLattice2D<T>* cvr::genericLattice2D< T >::clone (  )  const [package, virtual]

Create a clone of this genericLattice2D.

Returns:
a pointer to a copy of this genericLattice2D

Implements cvr::container.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
int cvr::genericLattice2D< T >::columns (  )  const [inline, package]

Number of columns of the genericLattice2D.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copy ( const genericLattice2D< T > &  other,
const irectangle window 
) [inline, package]

Assigment operator.

Copy the contents of a sublattice2D of other into this object. The content of the current object is removed and at the end it will contain only the copy of the sublattice2D.

Parameters:
other the other genericLattice2D to be copied
window rectangle define the copy area

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copy ( const genericLattice2D< T > &  other,
const iinterval r,
const iinterval c 
) [inline, package]

Assigment operator.

copy the contents of other in this object.

The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.

Parameters:
other the other lattice2D to be copied
r interval used for the rows
c interval used for the columns

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copy ( const genericLattice2D< T > &  other,
const size_type from,
const size_type to 
) [inline, package]

Assigment operator.

Copy the contents of a sublattice2D of other into this object. The content of the current object is removed and at the end it will contain only the sublattice2D.

Parameters:
other the other genericLattice2D to be copied
from initial sublattice2D indices (x,y) to be copied
to last sublattice2D indices (x,y) to be copied (inclusive)

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copy ( const genericLattice2D< T > &  other,
const int  fromRow,
const int  fromCol,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [package]

Assigment operator.

Copy the contents of a sublattice2D of other into this object. The content of the current object is removed and at the end it will contain a copy the sublattice2D only.

Parameters:
other the other genericLattice2D to be copied
fromRow initial row of the other genericLattice2D to be copied
fromCol initial column of the other genericLattice2D to be copied
toRow last row to be copied of the other genericLattice2D
toCol last column to be copied of the other genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copy ( const genericLattice2D< T > &  other  )  [package]

Assigment operator.

Copy the contents of other in this object.

Parameters:
other the other genericLattice2D to be copied

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copyColumns ( const genericLattice2D< T > &  other,
const genericLattice1D< int > &  idx 
) [package]

Assigment operator.

Copy the contents of the specified columns of other into this object. Multiple occurence of one column index in idx is allowed.

Parameters:
other the other genericLattice2D to be copied
idx indices of the rows to be copied.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::copyRows ( const genericLattice2D< T > &  other,
const genericLattice1D< int > &  idx 
) [package]

Assigment operator.

Copy the contents of the specified rows of other into this object. Multiple occurence of one row index in idx is allowed.

Parameters:
other the other genericLattice2D to be copied
idx indices of the rows to be copied.

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
void cvr::genericLattice2D< T >::detach ( genericVector< T > &  receiver  )  [package]

Free the data of this object and hand it over to the "receiver".

The value of ownsData is also transfered to the receiver. (see Note).

This function makes a "memory block transfusion" to a vector by concatenating the rows of the genericLattice2D. It is a very efficient way to move the data of this genericLattice2D into a vector, if you don't need the source data anymore!

Note: If the attach() or useExternData() methods of this genericLattice2D have been called before detachment, the same rules for memory management apply now for the receiver.

At the end of the detachment, this genericLattice2D will be empty.

Parameters:
receiver the genericLattice2D which will receive the memory block. All data of that genericLattice2D will be first deleted!

template<class T>
void cvr::genericLattice2D< T >::detach ( genericLattice2D< T > &  receiver  )  [package]

Free the data of this object and hand it over to the "receiver".

The value of ownsData is also transfered to the receiver. (see Note).

This function makes a "memory block transfusion" to another genericLattice2D. It is a very efficient way to make a copy of this genericLattice2D, if you don't need the source data anymore!

If the current lattice2D does not own its data, neither will the receiver lattice2D, which will also be just a wrapper of the same data.

If the current lattice2D is lined, then the other lattice2D will end as an exact copy if this one, and this one will be emptied after the detachment. In other words, it works similar like a swap() followed by clear(). In extremely time critical situations you may want to use swap() as it does not need to deallocate any memory of the receiver and is therefore a little bit faster.

Please take special care to the memory management issues involved if the current object does not own its data, as its control will still be yours.

At the end of the detachment, this genericLattice2D will be empty.

Parameters:
receiver the genericLattice2D which will receive the memory block. All data of that genericLattice2D will be first deleted!

template<class T>
void cvr::genericLattice2D< T >::distributeMem ( const int  firstRow,
const int  firstColumn,
const int  lastRow,
const int  lastColumn,
T *  block,
row_type theRows 
) const [protected]

Take the memory block and distribute it on the allocated vectors pointed by theRows.

template<class T>
const T& cvr::genericLattice2D< T >::elem ( const int  pos  )  const [inline, package]

Access element at the given position.

With this operator the genericLattice2D can be accessed as a vector, where the rows of the genericLattice2D are concatenated. The access to the genericLattice2D with at(row,col) is equivalent to elem(row*columns()+col), but more efficient.

Parameters:
pos the index of the element of the genericLattice2D
Returns:
a reference to the genericLattice2D element

template<class T>
T& cvr::genericLattice2D< T >::elem ( const int  pos  )  [inline, package]

Access element at the given position.

With this operator the genericLattice2D can be accessed as a vector, where the rows of the genericLattice2D are concatenated. The access to the genericLattice2D with at(row,col) is equivalent to elem(row*columns()+col), but more efficient.

Parameters:
pos the index of the element of the genericLattice2D
Returns:
a reference to the genericLattice2D element

template<class T>
bool cvr::genericLattice2D< T >::empty (  )  const [inline, package]

Returns true if the genericLattice2D is empty.

template<class T>
const_iterator cvr::genericLattice2D< T >::end (  )  const [inline, package]

returns iterator to the end of the genericLattice2D

template<class T>
iterator cvr::genericLattice2D< T >::end (  )  [inline, package]

returns iterator to the end of the genericLattice2D

template<class T>
bool cvr::genericLattice2D< T >::equals ( const genericLattice2D< T > &  other  )  const [package]

Compare this genericLattice2D with other.

Parameters:
other the other genericLattice2D to be compared with
Returns:
true if both matrices have the same elements and same size

template<class T>
void cvr::genericLattice2D< T >::fill ( const genericLattice2D< T > &  mat,
const irectangle window,
const size_type start = size_type(MinIndexMinIndex) 
) [inline, package]

Fills the region of this genericLattice2D specified by window with the contents of the genericLattice2D mat starting at start.

If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
mat pointer to the data to be copied
window the window to be filled
start the start position of the region to be copied of the genericLattice2D mat

template<class T>
void cvr::genericLattice2D< T >::fill ( const genericLattice2D< T > &  mat,
const size_type from,
const size_type to = size_type(MaxIndexMaxIndex),
const size_type startAt = size_type(MinIndexMinIndex) 
) [inline, package]

Fills this genericLattice2D between the "from's" and "to's" with the contents of the genericLattice2D mat starting at startAtRow and startAtCol.

Parameters:
mat the genericLattice2D with the data to be copied
from first position of the sublattice2D to be filled
to last position of the sublattice2D to be filled
startAt starting position of mat where the data is located.

template<class T>
void cvr::genericLattice2D< T >::fill ( const genericLattice2D< T > &  mat,
const int  fromRow = MinIndex,
const int  fromCol = MinIndex,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex,
const int  startAtRow = MinIndex,
const int  startAtCol = MinIndex 
) [package]

Fills this genericLattice2D between the "from's" and "to's" with the contents of the genericLattice2D mat starting at startAtRow and startAtCol.

Parameters:
mat the genericLattice2D with the data to be copied
fromRow first row of the sublattice2D to be filled
fromCol first column of the sublattice2D to be filled
toRow last row of the sublattice2D to be filled
toCol last column of the sublattice2D to be filled
startAtRow starting row of mat where the data is located.
startAtCol starting column of mat where the data is located.

template<class T>
void cvr::genericLattice2D< T >::fill ( const T  data[],
const irectangle window 
) [inline, package]

Fills genericLattice2D elements with iniValue.

The fill "area" is limited by window.

If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
data pointer to the data to be copied
window the window to be filled

template<class T>
void cvr::genericLattice2D< T >::fill ( const T  data[],
const size_type from,
const size_type to = size_type(MaxIndexMaxIndex) 
) [inline, package]

Fills genericLattice2D elements with the data pointed by data.

The fill "area" is limited by fromCol,toCol, fromRow and toRow. If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
data pointer to the data to be copied.
from first position of the sublattice2D to be filled
to last position of the sublattice2D to be filled

template<class T>
void cvr::genericLattice2D< T >::fill ( const T  data[],
const int  fromRow = MinIndex,
const int  fromCol = MinIndex,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [package]

Fills genericLattice2D elements with the data pointed by data.

The fill "area" is limited by fromCol,toCol, fromRow and toRow. If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
data pointer to the data to be copied.
fromRow first row of the sublattice2D to be filled
fromCol first column of the sublattice2D to be filled
toRow last row of the sublattice2D to be filled
toCol last column of the sublattice2D to be filled

template<class T>
void cvr::genericLattice2D< T >::fill ( const T &  iniValue,
const irectangle window 
) [inline, package]

Fills genericLattice2D elements with iniValue.

The fill "area" is limited by window. If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
iniValue the elements will be initialized with this value
window the window to be filled

template<class T>
void cvr::genericLattice2D< T >::fill ( const T &  iniValue,
const size_type from,
const size_type to = size_type(MaxIndexMaxIndex) 
) [inline, package]

Fills genericLattice2D elements with iniValue.

The fill "area" is limited by from and to points If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
iniValue the elements will be initialized with this value
from first position of the sublattice2D to be filled
to last row of the sublattice2D to be filled

template<class T>
void cvr::genericLattice2D< T >::fill ( const T &  iniValue,
const int  fromRow = MinIndex,
const int  fromCol = MinIndex,
const int  toRow = MaxIndex,
const int  toCol = MaxIndex 
) [package]

Fills genericLattice2D elements with iniValue.

The fill "area" is limited by fromCol,toCol, fromRow and toRow. If these values are out of bounds, they will be (internally) adjusted to correct values.

Parameters:
iniValue the elements will be initialized with this value
fromRow first row of the sublattice2D to be filled
fromCol first column of the sublattice2D to be filled
toRow last row of the sublattice2D to be filled
toCol last column of the sublattice2D to be filled

template<class T>
int cvr::genericLattice2D< T >::firstColumn (  )  const [inline, package]

Index of the first columns (columns()-1).

template<class T>
const size_type& cvr::genericLattice2D< T >::firstIndex (  )  const [inline, package]

Returns a read-only reference to the last index of the lattice2D.

Returns:
cvr::ipoint with the number of columns in its x coordinate and the number of rows in its y coordinate.

template<class T>
int cvr::genericLattice2D< T >::firstRow (  )  const [inline, package]

Index of the first row (rows()-1).

template<class T>
row_type cvr::genericLattice2D< T >::getColumnCopy ( const int  col  )  const [inline, package]

Return genericLattice2D-column as a vector.

This method copies the data of the genericLattice2D, therefore is not as fast as getRow()

Parameters:
col the number of the column to be copied
Returns:
a vector with the contents of the column of the genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
void cvr::genericLattice2D< T >::getColumnCopy ( const int  col,
row_type theCol 
) const [package]

Return genericLattice2D-column as a vector.

This method copies the data of the genericLattice2D, therefore is not as fast as getRow().

Parameters:
col the number of the column to be copied
theCol a vector, where the column vector of the genericLattice2D should be copied.

template<class T>
const row_type& cvr::genericLattice2D< T >::getRow ( const int  row  )  const [inline, package]

Return genericLattice2D-row as a const vector.

This method works fast, since it returns a reference to the row vector. The data will NOT be copied.

Parameters:
row the row to be accessed
Returns:
a const reference to the vector row

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
row_type& cvr::genericLattice2D< T >::getRow ( const int  row  )  [inline, package]

Return genericLattice2D-row as a vector.

This method works fast, since it returns a reference to the row vector. The data will NOT be copied.

Parameters:
row the row to be accessed
Returns:
a reference to the vector row

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
row_type cvr::genericLattice2D< T >::getRowCopy ( const int  row  )  const [inline, package]

Return genericLattice2D-row as a vector.

This method copies the data of the genericLattice2D, therefore is not as fast as getRow().

Parameters:
row the number of the row to be copied
Returns:
a vector with the contents of the row of the genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
void cvr::genericLattice2D< T >::getRowCopy ( const int  row,
row_type theRow 
) const [inline, package]

Copy a row vector in the given parameter.

This method copies the data of a given row of the genericLattice2D in the given vector.

Parameters:
row the number of the row to be copied
theRow the vector, where the data will be copied
See also:
getRow()

template<class T>
const_iterator cvr::genericLattice2D< T >::inverseBegin (  )  const [inline, package]

This method returns an iterator that points to the last valid element of the genericLattice2D.

See inverseBegin() for more details.

template<class T>
iterator cvr::genericLattice2D< T >::inverseBegin (  )  [inline, package]

This method returns an iterator that points to the last valid element of the genericLattice2D.

It is used for inverse order iteration through the genericLattice2D using normal iterators (as opposed to reverse iterators). This has the advantage that iterators going from front to end and in the inverse direction are the same and can thus be compared, copied etc. Further the implementation of reverse_iterators is not as fast as that of iterators and thus not desired in the CVR-Lib.

See cvr::genericVector<T>::inverseBegin() for an example.

template<class T>
const_iterator cvr::genericLattice2D< T >::inverseEnd (  )  const [inline, package]

This method returns an iterator that points to the element before the first valid element of the genericLattice2D.

template<class T>
iterator cvr::genericLattice2D< T >::inverseEnd (  )  [inline, package]

This method returns an iterator that points to the element before the first valid element of the genericLattice2D.

It is used to mark the end for inverse order iteration through the genericLattice2D using normal iterators (as opposed to reverse iterators). This has the advantage that iterators going from front to end and in the inverse direction are the same and can thus be compared, copied etc.

template<class T>
int cvr::genericLattice2D< T >::lastColumn (  )  const [inline, package]

Index of the last columns (columns()-1).

template<class T>
const size_type& cvr::genericLattice2D< T >::lastIndex (  )  const [inline, package]

Returns a read-only reference to the last index of the lattice2D.

Returns:
cvr::ipoint with the number of columns in its x coordinate and the number of rows in its y coordinate.

template<class T>
int cvr::genericLattice2D< T >::lastRow (  )  const [inline, package]

Index of the last row (rows()-1).

template<class T>
virtual const std::string& cvr::genericLattice2D< T >::name (  )  const [package, virtual]

Returns the name of this type.

Implements cvr::ioObject.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
virtual genericLattice2D<T>* cvr::genericLattice2D< T >::newInstance (  )  const [package, virtual]

Create a new instance of genericLattice2D.

Returns:
a pointer to a new instance of genericLattice2D

Implements cvr::container.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
genericLattice2D<T>& cvr::genericLattice2D< T >::operator= ( const genericLattice2D< T > &  other  )  [inline, package]

Assigment operator (alias for copy(other)).

Parameters:
other the genericLattice2D to be copied
Returns:
a reference to the actual genericLattice2D

Reimplemented in cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
bool cvr::genericLattice2D< T >::operator== ( const genericLattice2D< T > &  other  )  const [inline, package]

Compare the contents of each element of this genericLattice2D with the other one.

It assumes the type T can be compared using the operator==.

Parameters:
other the other genericLattice2D to be compared with
Returns:
true if both matrices have the same elements and same size

template<class T>
const row_type& cvr::genericLattice2D< T >::operator[] ( const int  row  )  const [inline, package]

template<class T>
row_type& cvr::genericLattice2D< T >::operator[] ( const int  row  )  [inline, package]

template<class T>
bool cvr::genericLattice2D< T >::ownsData (  )  const [inline, package]

Owns this object the data? returns false if this genericLattice2D contains a reference to extern data.

template<class T>
virtual bool cvr::genericLattice2D< T >::read ( ioHandler handler,
const bool  complete = true 
) [package, virtual]

Read the object from the given ioHandler.

Reimplemented from cvr::ioObject.

Reimplemented in cvr::kernel2D< T >.

template<class T>
void cvr::genericLattice2D< T >::releaseMem (  )  [protected]

Release the internal memory blocks, including theElements_ and the row array.

template<class T>
void cvr::genericLattice2D< T >::releaseMem ( T *&  block  )  const [protected]

Release the given block of memory.

The block is directly released (not previously modified with the offset).

template<class T>
void cvr::genericLattice2D< T >::releaseRows ( row_type *&  theRows,
const int  offset 
) const [inline, protected]

Allocate n number of rows or the appropriate type.

template<class T>
void cvr::genericLattice2D< T >::reserveMem ( const int  fromRow,
const int  fromColumn,
const int  toRow,
const int  toColumn 
) [protected]

Reserve memory.

This method allocates memory for the elements, for the rows and distributes the memory into the blocks

template<class T>
T* cvr::genericLattice2D< T >::reserveNewMem ( const int  theSize  )  const [inline, protected]

Reserve just a memory block of the given size;.

template<class T>
void cvr::genericLattice2D< T >::resize ( const iinterval rows,
const iinterval columns 
) [inline, package]

Change the dimensions of the genericLattice2D, copying old data but leaving all new elements uninitialized.

Parameters:
rows interval of valid rows
columns interval of valid columns
If the resize is possible (see useExternData()), this object will always own the data!

This is equivalent to call resize(newDim.y,newDim.x,iniValue,resizeType)

See also:
eResizeType

template<class T>
void cvr::genericLattice2D< T >::resize ( const size_type from,
const size_type to 
) [inline, package]

Change the dimensions of the genericLattice2D, copying old data but leaving all new elements uninitialized.

Parameters:
from initial index
to final index
If the resize is possible (see useExternData()), this object will always own the data!

This is equivalent to call resize(newDim.y,newDim.x,iniValue,resizeType)

See also:
eResizeType

template<class T>
void cvr::genericLattice2D< T >::resize ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol 
) [inline, package]

Change the dimensions of the genericLattice2D, copying old data but leaving all new elements uninitialized.

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index (inclusive)
toCol final column index (inclusive)
If the resize is possible (see useExternData()), this object will always owns the data!

See also:
eResizeType, assign(),allocate()

template<class T>
void cvr::genericLattice2D< T >::resize ( const iinterval rows,
const iinterval columns,
const T &  iniValue,
const eResizeType  resizeType = CopyAndInit 
) [inline, package]

Change the dimensions of the genericLattice2D.

Parameters:
rows interval of valid rows
columns interval of valid columns
iniValue value to initialize the rest
resizeType specifies what should happen with the data of the resized lattice2D.
If the resize is possible (see useExternData()), this object will always own the data!

This is equivalent to call resize(newDim.y,newDim.x,iniValue,resizeType)

See also:
eResizeType

template<class T>
void cvr::genericLattice2D< T >::resize ( const size_type from,
const size_type to,
const T &  iniValue,
const eResizeType  resizeType = CopyAndInit 
) [inline, package]

Change the dimensions of the genericLattice2D.

Parameters:
from initial index
to final index
iniValue value to initialize the rest
resizeType specifies what should happen with the data of the resized lattice2D.
If the resize is possible (see useExternData()), this object will always own the data!

This is equivalent to call resize(newDim.y,newDim.x,iniValue,resizeType)

See also:
eResizeType

template<class T>
void cvr::genericLattice2D< T >::resize ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
const T &  iniValue,
const eResizeType  resizeType = CopyAndInit 
) [package]

Change the dimensions of the genericLattice2D.

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index (inclusive)
toCol final column index (inclusive)
iniValue the initialization value.
resizeType specifies what should happen with the data of the resized lattice2D.
If the resize is possible (see useExternData()), this object will always owns the data!

See also:
eResizeType, assign(),allocate()

template<class T>
void cvr::genericLattice2D< T >::restoreOwnership (  )  [package]

If this object does not own its data, this member will create a new memory buffer with the same data and will make this genericLattice2D as its owner.

If this genericLattice2D already owns its data nothing happens.

template<class T>
int cvr::genericLattice2D< T >::rows (  )  const [inline, package]

Number of rows of the genericLattice2D.

template<class T>
void cvr::genericLattice2D< T >::setColumn ( const int  col,
const row_type theCol 
) [package]

Copy the data of a vector in a given column.

Parameters:
col the column that receives the data.
theCol the vector with the data to be copied

template<class T>
void cvr::genericLattice2D< T >::setRow ( const int  row,
const row_type theRow 
) [inline, package]

Copy the data of a vector in a given row.

Parameters:
row the row that receives the data.
theRow the vector with the data to be copied

template<class T>
const size_type& cvr::genericLattice2D< T >::size (  )  const [inline, package]

Returns the size of the genericLattice2D in a cvr::ipoint structure.

Returns:
cvr::ipoint with the number of columns in its x coordinate and the number of rows in its y coordinate.

template<class T>
void cvr::genericLattice2D< T >::swap ( genericLattice2D< T > &  other  )  [package]

Exchange (in a fast way) the data between this and the other genericLattice2D.

Similar to detach(), this method will exchange the complete memory blocks, avoiding an element-wise copy.

Parameters:
other the genericLattice2D with which the data will be exchanged.

template<class T>
void cvr::genericLattice2D< T >::useExternData ( const iinterval rows,
const iinterval columns,
data[],
const eConstantReference  constRef = VariableReference 
) [inline, package]

Reference to extern data.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. The user must take care for memory allocation and deallocation: this object will never delete the data!. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

Parameters:
rows interval of rows to be used.
columns interval of columns to be used.
data a pointer to the memory block to be used.
constRef constant reference.
For an example see attach()

template<class T>
void cvr::genericLattice2D< T >::useExternData ( const size_type from,
const size_type to,
data[],
const eConstantReference  constRef = VariableReference 
) [inline, package]

Reference to extern data.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. The user must take care for memory allocation and deallocation: this object will never delete the data!. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

Parameters:
from initial index
to initial index
data a pointer to the memory block to be used
constRef constant reference
For an example see attach()

template<class T>
void cvr::genericLattice2D< T >::useExternData ( const int  fromRow,
const int  fromCol,
const int  toRow,
const int  toCol,
data[],
const eConstantReference  constRef = VariableReference 
) [package]

Reference to extern data.

This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. The user must take care for memory allocation and deallocation: this object will never delete the data!. If rows and cols are invalid dimensions, the behaviour will be unpredictible.

Parameters:
fromRow initial row index
fromCol initial column index
toRow final row index
toCol final column index
data a pointer to the memory block to be used
constRef constant reference
For an example see attach()

template<class T>
virtual bool cvr::genericLattice2D< T >::write ( ioHandler handler,
const bool  complete = true 
) const [package, virtual]

Write the object in the given ioHandler.

Reimplemented from cvr::ioObject.

Reimplemented in cvr::kernel2D< T >.


Member Data Documentation

template<class T>
cvr::genericLattice2D< T >::__pad0__ [package]

Iterator type (allows read and write operations).

The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::genericLattice2D::begin() for an example .

For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.

The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a genericLattice2D use iterators instead (in the release version iterators are approximately a factor 3 faster than "at()").

Warning:
Try to use the prefix incremental operator (i.e. ++it) over the postfix operator (i.e. it++) to allow efficient code also in debug-modus!

template<class T>
cvr::genericLattice2D< T >::__pad1__ [package]

Constant iterator type (allows read-only operations).

The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::genericLattice2D::begin() for an example.

For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.

The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a genericLattice2D use iterators instead (in the release version iterators are approximately a factor 3 faster than "at()").

Warning:
Try to use the prefix incremental operator (i.e. ++it) instead of the postfix operator (i.e. it++) to allow efficient code also in debug-modus!

template<class T>
true cvr::genericLattice2D< T >::const_iterator [package]

Exception thrown when a constant reference is violated.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
eConstantReference cvr::genericLattice2D< T >::constReference_ [protected]

If constReference=true, is not possible to resize or change the reference of this genericVector.

Very important for an efficient lattice2D class!! (see useExternData())

template<class T>
size_type cvr::genericLattice2D< T >::first_ [protected]

Index of the last row, i.e.

last_.x=theSize.x-1, and last_.y=theSize.y-1

template<class T>
false cvr::genericLattice2D< T >::iterator [package]

Exception thrown when a constant reference is violated.

Reimplemented in cvr::kernel2D< T >, cvr::lattice2D< T >, cvr::lattice2D< float >, and cvr::lattice2D< T >.

template<class T>
size_type cvr::genericLattice2D< T >::last_ [protected]

Index of the last row, i.e.

last_.x=theSize.x-1, and last_.y=theSize.y-1

template<class T>
bool cvr::genericLattice2D< T >::ownData_ [protected]

Indicates if theElements points to own data or to external data.

template<class T>
row_type* cvr::genericLattice2D< T >::rowAddressTable_ [protected]

Table of pointers to the rows.

template<class T>
T* cvr::genericLattice2D< T >::theElements_ [protected]

Pointer to the elements of the genericLattice2D.

template<class T>
size_type cvr::genericLattice2D< T >::theSize_ [protected]

Size of the lattice2D as point.

template<class T>
int cvr::genericLattice2D< T >::totalSize_ [protected]

Size of theElements_ memory block, i.e.

theSize_.x*theSize_.y;


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

Generated on Sun Sep 20 22:09:07 2009 for CVR-Lib by Doxygen 1.5.8