A generic template matrix. More...
#include <Matrix.h>
Classes | |
class | DiskLineInfo |
Disk lines info. More... | |
class | OpenDiskFileHandler |
Openend disk files info node. More... | |
Public Types | |
typedef TemplateElementType | ElementTypeT |
Public matrix element type definition. More... | |
enum | MemoryPolicy { AutoMemPol, RAMMemPol, DiskMemPol } |
Memory polycy. More... | |
Public Member Functions | |
unsigned int | getColumnsNumber () const |
The number of current matrix columns. More... | |
unsigned int | getLinesNumber () const |
The number of current matrix lines. More... | |
unsigned int | getMaxRAMLines () const |
Returns the allowed maximum amount of RAM lines. More... | |
unsigned long int | getMaxTmpFileSize () const |
Returns the current maximum temporary disk file size. More... | |
MemoryPolicy | getMemPolicy () const |
Returns the current memory policy. More... | |
bool | isEmpty () const |
Empty Matrix verification. More... | |
Matrix () | |
Matrix (const Matrix< TemplateElementType > &external) | |
TemplateElementType & | operator() (const unsigned int &line, const unsigned int &column) |
Operator () overload. More... | |
const TemplateElementType & | operator() (const unsigned int &line, const unsigned int &column) const |
Operator () overload. More... | |
const Matrix< TemplateElementType > & | operator= (const Matrix< TemplateElementType > &external) |
Operator = overload. More... | |
TemplateElementType * | operator[] (const unsigned int &line) |
Operator [] overload. More... | |
TemplateElementType const * | operator[] (const unsigned int &line) const |
Operator [] overload. More... | |
void | reset () |
Reset (clear) the active instance data. More... | |
void | reset (MemoryPolicy memoryPolicy) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters. More... | |
bool | reset (unsigned int lines, unsigned int columns) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters. More... | |
bool | reset (unsigned int lines, unsigned int columns, MemoryPolicy memoryPolicy) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters. More... | |
bool | reset (unsigned int lines, unsigned int columns, MemoryPolicy memoryPolicy, unsigned char maxMemPercentUsage) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters. More... | |
bool | reset (unsigned int lines, unsigned int columns, MemoryPolicy memoryPolicy, unsigned long int maxTmpFileSize, unsigned char maxMemPercentUsage) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters. More... | |
bool | reset (MemoryPolicy memoryPolicy, unsigned int lines, unsigned int columns, unsigned int maxRAMLines) |
bool | reset (MemoryPolicy memoryPolicy, unsigned int lines, unsigned int columns, unsigned long int maxTmpFileSize, unsigned int maxRAMLines) |
virtual | ~Matrix () |
Protected Member Functions | |
void | clear () |
Clear all allocated resources but keep the current parameters. More... | |
bool | createNewDiskFile (unsigned long int size, FILE **fileptr, std::string &fullFileName) const |
Create a new disk file. More... | |
TemplateElementType * | getScanLine (const unsigned int &line) const |
Returns a pointer to the required line. More... | |
void | init () |
Reset the internal variables to the default state. More... | |
Protected Attributes | |
std::vector< TemplateElementType *> | m_allLinesPtrsVec |
A vector with pointers to all lines. More... | |
TemplateElementType * | m_currentSwapTilePtr |
A pointer to the current swap tile. More... | |
std::vector< DiskLineInfo > | m_diskLinesInfoVec |
Info of all lines, used when a line is on disk. More... | |
unsigned int | m_maxRAMLines |
the max amount of RAM lines. More... | |
unsigned long int | m_maxTmpFileSize |
Max bytes per temp file (for swapped tiles only, default: 2GB). More... | |
std::vector< TemplateElementType *> | m_memoryblocksHandler |
MemoryPolicy | m_memoryPolicy |
The used memory policy (default:RAMMemPol). More... | |
unsigned int | m_nextSwapLineRamLinesIndexesVecIdx |
The index inside ramLinesIndexesVec_ of the next RAM line index that will be swapped to disk when a disk line is required. More... | |
std::vector< OpenDiskFileHandler > | m_openDiskFilesHandler |
A vector with open disk files handler. More... | |
std::vector< unsigned int > | m_ramLinesIndexesVec |
The indexes of all lines loaded into RAM. More... | |
boost::scoped_array< TemplateElementType > | m_swapMemoryBlockHandler |
An auxiliar line used when swapping data to/from disk. More... | |
unsigned int | m_totalColumns |
The total columns number (default:0). More... | |
unsigned int | m_totalLines |
The total lines number (default:0). More... | |
A generic template matrix.
typedef TemplateElementType te::rp::Matrix< TemplateElementType >::ElementTypeT |
enum te::rp::Matrix::MemoryPolicy |
te::rp::Matrix< TemplateElementType >::Matrix | ( | ) |
te::rp::Matrix< TemplateElementType >::Matrix | ( | const Matrix< TemplateElementType > & | external | ) |
|
virtual |
|
protected |
Clear all allocated resources but keep the current parameters.
Definition at line 756 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::reset(), and te::rp::Matrix< rg::BaatzFeatureType >::~Matrix().
|
protected |
Create a new disk file.
size | The file size. |
fileptr | The file pointer. |
fullFileName | The created full file name. |
Definition at line 936 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::reset().
unsigned int te::rp::Matrix< TemplateElementType >::getColumnsNumber | ( | ) | const |
The number of current matrix columns.
Definition at line 798 of file Matrix.h.
Referenced by te::rp::Skeleton::applyMeanSmooth(), te::rp::CreateRasterFileFromMatrix(), and te::rp::Skeleton::getMagnitude().
unsigned int te::rp::Matrix< TemplateElementType >::getLinesNumber | ( | ) | const |
The number of current matrix lines.
Definition at line 791 of file Matrix.h.
Referenced by te::rp::Skeleton::applyMeanSmooth(), te::rp::CreateRasterFileFromMatrix(), and te::rp::Skeleton::getMagnitude().
unsigned int te::rp::Matrix< TemplateElementType >::getMaxRAMLines | ( | ) | const |
unsigned long int te::rp::Matrix< TemplateElementType >::getMaxTmpFileSize | ( | ) | const |
Matrix< TemplateElementType >::MemoryPolicy te::rp::Matrix< TemplateElementType >::getMemPolicy | ( | ) | const |
|
protected |
Returns a pointer to the required line.
line | Line number. |
column | Column number. |
Definition at line 856 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::operator()(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::operator[]().
|
protected |
Reset the internal variables to the default state.
Definition at line 469 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::Matrix().
bool te::rp::Matrix< TemplateElementType >::isEmpty | ( | ) | const |
|
inline |
|
inline |
const Matrix< TemplateElementType > & te::rp::Matrix< TemplateElementType >::operator= | ( | const Matrix< TemplateElementType > & | external | ) |
Operator = overload.
external | External instance reference. |
Definition at line 811 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::Matrix().
|
inline |
Operator [] overload.
line | Line number. |
column | Column number. |
|
inline |
Operator [] overload.
line | Line number. |
column | Column number. |
void te::rp::Matrix< TemplateElementType >::reset | ( | ) |
Reset (clear) the active instance data.
memoryPolicy | Memory policy. |
Definition at line 502 of file Matrix.h.
Referenced by te::rp::Skeleton::applyMeanSmooth(), te::rp::Skeleton::getMagnitude(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
void te::rp::Matrix< TemplateElementType >::reset | ( | MemoryPolicy | memoryPolicy | ) |
bool te::rp::Matrix< TemplateElementType >::reset | ( | unsigned int | lines, |
unsigned int | columns | ||
) |
bool te::rp::Matrix< TemplateElementType >::reset | ( | unsigned int | lines, |
unsigned int | columns, | ||
MemoryPolicy | memoryPolicy | ||
) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters.
lines | Number of lines. |
columns | Number of columns. |
memoryPolicy | Memory policy. |
bool te::rp::Matrix< TemplateElementType >::reset | ( | unsigned int | lines, |
unsigned int | columns, | ||
MemoryPolicy | memoryPolicy, | ||
unsigned char | maxMemPercentUsage | ||
) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters.
lines | Number of lines. |
columns | Number of columns. |
memoryPolicy | Memory policy. |
maxMemPercentUsage | The max amount of free memory to use when necessary (suggested default:40). |
bool te::rp::Matrix< TemplateElementType >::reset | ( | unsigned int | lines, |
unsigned int | columns, | ||
MemoryPolicy | memoryPolicy, | ||
unsigned long int | maxTmpFileSize, | ||
unsigned char | maxMemPercentUsage | ||
) |
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters.
lines | Number of lines. |
columns | Number of columns. |
memoryPolicy | Memory policy. |
maxTmpFileSize | Max temp file size. |
maxMemPercentUsage | The max amount of free memory to use when necessary (suggested default:40). |
bool te::rp::Matrix< TemplateElementType >::reset | ( | MemoryPolicy | memoryPolicy, |
unsigned int | lines, | ||
unsigned int | columns, | ||
unsigned int | maxRAMLines | ||
) |
bool te::rp::Matrix< TemplateElementType >::reset | ( | MemoryPolicy | memoryPolicy, |
unsigned int | lines, | ||
unsigned int | columns, | ||
unsigned long int | maxTmpFileSize, | ||
unsigned int | maxRAMLines | ||
) |
|
mutableprotected |
A vector with pointers to all lines.
Definition at line 382 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
mutableprotected |
A pointer to the current swap tile.
Definition at line 375 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), te::rp::Matrix< rg::BaatzFeatureType >::init(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
mutableprotected |
Info of all lines, used when a line is on disk.
Definition at line 392 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
the max amount of RAM lines.
Definition at line 348 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::getMaxRAMLines(), te::rp::Matrix< rg::BaatzFeatureType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
Max bytes per temp file (for swapped tiles only, default: 2GB).
Definition at line 343 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::getMaxTmpFileSize(), te::rp::Matrix< rg::BaatzFeatureType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
Definition at line 377 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
The used memory policy (default:RAMMemPol).
Definition at line 363 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::getMemPolicy(), te::rp::Matrix< rg::BaatzFeatureType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
mutableprotected |
The index inside ramLinesIndexesVec_ of the next RAM line index that will be swapped to disk when a disk line is required.
Definition at line 370 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), and te::rp::Matrix< rg::BaatzFeatureType >::init().
|
protected |
A vector with open disk files handler.
Definition at line 387 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
mutableprotected |
The indexes of all lines loaded into RAM.
Definition at line 397 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
mutableprotected |
An auxiliar line used when swapping data to/from disk.
Definition at line 403 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
The total columns number (default:0).
Definition at line 358 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getColumnsNumber(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), te::rp::Matrix< rg::BaatzFeatureType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::operator()(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().
|
protected |
The total lines number (default:0).
Definition at line 353 of file Matrix.h.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::clear(), te::rp::Matrix< rg::BaatzFeatureType >::getLinesNumber(), te::rp::Matrix< rg::BaatzFeatureType >::getScanLine(), te::rp::Matrix< rg::BaatzFeatureType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::isEmpty(), te::rp::Matrix< rg::BaatzFeatureType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::reset().