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 | |
| void | clear () | 
| Clear all allocated resources and go back to the initial default parameters.  More... | |
| unsigned int | getColumnsNumber () const | 
| The number of current matrix columns.  More... | |
| unsigned int | getLinesNumber () const | 
| The number of current matrix lines.  More... | |
| unsigned char | getMaxMemPercentUsage () const | 
| Returns the max amount of free memory to use when necessary.  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... | |
| virtual | ~Matrix () | 
Protected Member Functions | |
| bool | allocateDiskLines (unsigned int startingLineIdx) | 
| Allocate disk lines.  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 initial 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 char | m_maxMemPercentUsage | 
| the max amount of free memory to use when necessary.  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 | ( | ) | 
Definition at line 462 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::init().
| te::rp::Matrix< TemplateElementType >::Matrix | ( | const Matrix< TemplateElementType > & | external | ) | 
Definition at line 468 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::init(), and te::rp::Matrix< TemplateElementType >::operator=().
      
  | 
  virtual | 
Definition at line 477 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::clear().
      
  | 
  protected | 
Allocate disk lines.
| startingLineIdx | Starting line index. | 
Definition at line 738 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::createNewDiskFile(), te::rp::Matrix< TemplateElementType >::m_diskLinesInfoVec, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, te::rp::Matrix< TemplateElementType >::m_openDiskFilesHandler, te::rp::Matrix< TemplateElementType >::m_totalColumns, te::rp::Matrix< TemplateElementType >::m_totalLines, and TERP_LOGERR.
Referenced by te::rp::Matrix< TemplateElementType >::reset().
| void te::rp::Matrix< TemplateElementType >::clear | ( | ) | 
Clear all allocated resources and go back to the initial default parameters.
Definition at line 645 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< TemplateElementType >::m_allLinesPtrsVec, te::rp::Matrix< TemplateElementType >::m_diskLinesInfoVec, te::rp::Matrix< TemplateElementType >::m_memoryblocksHandler, te::rp::Matrix< TemplateElementType >::m_openDiskFilesHandler, te::rp::Matrix< TemplateElementType >::m_ramLinesIndexesVec, and te::rp::Matrix< TemplateElementType >::m_swapMemoryBlockHandler.
Referenced by te::rp::Matrix< TemplateElementType >::reset(), and te::rp::Matrix< TemplateElementType >::~Matrix().
      
  | 
  protected | 
Create a new disk file.
| size | The file size. | 
| fileptr | The file pointer. | 
| fullFileName | The created full file name. | 
Definition at line 894 of file Matrix.h.
References te::core::CharEncoding::fromUTF8(), te::core::GetUserDirectory(), and te::core::FileSystem::uniquePath().
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines().
| unsigned int te::rp::Matrix< TemplateElementType >::getColumnsNumber | ( | ) | const | 
The number of current matrix columns.
Definition at line 681 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_totalColumns.
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 674 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_totalLines.
Referenced by te::rp::Skeleton::applyMeanSmooth(), te::rp::CreateRasterFileFromMatrix(), and te::rp::Skeleton::getMagnitude().
| unsigned char te::rp::Matrix< TemplateElementType >::getMaxMemPercentUsage | ( | ) | const | 
Returns the max amount of free memory to use when necessary.
Definition at line 732 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::operator[]().
| unsigned long int te::rp::Matrix< TemplateElementType >::getMaxTmpFileSize | ( | ) | const | 
Returns the current maximum temporary disk file size.
Definition at line 726 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::operator[]().
| Matrix< TemplateElementType >::MemoryPolicy te::rp::Matrix< TemplateElementType >::getMemPolicy | ( | ) | const | 
Returns the current memory policy.
Definition at line 720 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_memoryPolicy.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::operator[]().
      
  | 
  protected | 
Returns a pointer to the required line.
| line | Line number. | 
| column | Column number. | 
Definition at line 814 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_allLinesPtrsVec, te::rp::Matrix< TemplateElementType >::m_currentSwapTilePtr, te::rp::Matrix< TemplateElementType >::m_diskLinesInfoVec, te::rp::Matrix< TemplateElementType >::m_nextSwapLineRamLinesIndexesVecIdx, te::rp::Matrix< TemplateElementType >::m_ramLinesIndexesVec, te::rp::Matrix< TemplateElementType >::m_totalColumns, te::rp::Matrix< TemplateElementType >::m_totalLines, TERP_DEBUG_TRUE_OR_THROW, and TERP_TRUE_OR_THROW.
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::operator()(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< rg::BaatzFeatureType >::operator[]().
      
  | 
  protected | 
Reset the internal variables to the initial state.
Definition at line 450 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_currentSwapTilePtr, te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, te::rp::Matrix< TemplateElementType >::m_memoryPolicy, te::rp::Matrix< TemplateElementType >::m_nextSwapLineRamLinesIndexesVecIdx, te::rp::Matrix< TemplateElementType >::m_totalColumns, te::rp::Matrix< TemplateElementType >::m_totalLines, and te::rp::Matrix< TemplateElementType >::RAMMemPol.
Referenced by te::rp::Matrix< TemplateElementType >::clear(), and te::rp::Matrix< TemplateElementType >::Matrix().
| bool te::rp::Matrix< TemplateElementType >::isEmpty | ( | ) | const | 
Empty Matrix verification.
Definition at line 688 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_totalLines.
      
  | 
  inline | 
      
  | 
  inline | 
| const Matrix< TemplateElementType > & te::rp::Matrix< TemplateElementType >::operator= | ( | const Matrix< TemplateElementType > & | external | ) | 
Operator = overload.
| external | External instance reference. | 
Definition at line 694 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::getScanLine(), te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, te::rp::Matrix< TemplateElementType >::m_memoryPolicy, te::rp::Matrix< TemplateElementType >::m_totalColumns, te::rp::Matrix< TemplateElementType >::m_totalLines, te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_THROW.
Referenced by te::rp::Matrix< TemplateElementType >::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 483 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::clear().
Referenced by te::rp::Skeleton::applyMeanSmooth(), te::rp::SegmenterRegionGrowingSegmentsPool< FeatureDataTypeT >::clear(), te::rp::Skeleton::getMagnitude(), te::rp::SegmenterRegionGrowingSegmentsPool< FeatureDataTypeT >::initialize(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::reset().
| void te::rp::Matrix< TemplateElementType >::reset | ( | MemoryPolicy | memoryPolicy | ) | 
Reset (clear) the active instance data and update its internal parameters folowing the the new supplied parameters.
| memoryPolicy | Memory policy. | 
Definition at line 489 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, and te::rp::Matrix< TemplateElementType >::reset().
| bool te::rp::Matrix< TemplateElementType >::reset | ( | unsigned int | lines, | 
| unsigned int | columns | ||
| ) | 
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. | 
Definition at line 495 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, te::rp::Matrix< TemplateElementType >::m_memoryPolicy, and te::rp::Matrix< TemplateElementType >::reset().
| 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. | 
Definition at line 503 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, and te::rp::Matrix< TemplateElementType >::reset().
| 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). | 
Definition at line 511 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, and te::rp::Matrix< TemplateElementType >::reset().
| 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). | 
Definition at line 520 of file Matrix.h.
References te::rp::Matrix< TemplateElementType >::allocateDiskLines(), te::rp::Matrix< TemplateElementType >::AutoMemPol, te::rp::Matrix< TemplateElementType >::clear(), te::common::GetTotalPhysicalMemory(), te::common::GetTotalVirtualMemory(), te::common::GetUsedVirtualMemory(), te::rp::Matrix< TemplateElementType >::m_allLinesPtrsVec, te::rp::Matrix< TemplateElementType >::m_currentSwapTilePtr, te::rp::Matrix< TemplateElementType >::m_maxMemPercentUsage, te::rp::Matrix< TemplateElementType >::m_maxTmpFileSize, te::rp::Matrix< TemplateElementType >::m_memoryblocksHandler, te::rp::Matrix< TemplateElementType >::m_memoryPolicy, te::rp::Matrix< TemplateElementType >::m_ramLinesIndexesVec, te::rp::Matrix< TemplateElementType >::m_swapMemoryBlockHandler, te::rp::Matrix< TemplateElementType >::m_totalColumns, te::rp::Matrix< TemplateElementType >::m_totalLines, MAX, MIN, te::rp::Matrix< TemplateElementType >::RAMMemPol, and TERP_LOG_AND_RETURN_FALSE.
      
  | 
  mutableprotected | 
A vector with pointers to all lines.
Definition at line 361 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::clear(), te::rp::Matrix< TemplateElementType >::getScanLine(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  mutableprotected | 
A pointer to the current swap tile.
Definition at line 354 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::getScanLine(), te::rp::Matrix< TemplateElementType >::init(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  mutableprotected | 
Info of all lines, used when a line is on disk.
Definition at line 371 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines(), te::rp::Matrix< TemplateElementType >::clear(), and te::rp::Matrix< TemplateElementType >::getScanLine().
      
  | 
  protected | 
the max amount of free memory to use when necessary.
Definition at line 327 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::getMaxMemPercentUsage(), te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  protected | 
Max bytes per temp file (for swapped tiles only, default: 2GB).
Definition at line 322 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines(), te::rp::Matrix< TemplateElementType >::getMaxTmpFileSize(), te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  protected | 
Definition at line 356 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::clear(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  protected | 
The used memory policy (default:RAMMemPol).
Definition at line 342 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::getMemPolicy(), te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::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 349 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::getScanLine(), and te::rp::Matrix< TemplateElementType >::init().
      
  | 
  protected | 
A vector with open disk files handler.
Definition at line 366 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines(), and te::rp::Matrix< TemplateElementType >::clear().
      
  | 
  mutableprotected | 
The indexes of all lines loaded into RAM.
Definition at line 376 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::clear(), te::rp::Matrix< TemplateElementType >::getScanLine(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  mutableprotected | 
An auxiliar line used when swapping data to/from disk.
Definition at line 382 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::clear(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  protected | 
The total columns number (default:0).
Definition at line 337 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines(), te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getScanLine(), te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< rg::BaatzFeatureType >::operator()(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::reset().
      
  | 
  protected | 
The total lines number (default:0).
Definition at line 332 of file Matrix.h.
Referenced by te::rp::Matrix< TemplateElementType >::allocateDiskLines(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rp::Matrix< TemplateElementType >::getScanLine(), te::rp::Matrix< TemplateElementType >::init(), te::rp::Matrix< TemplateElementType >::isEmpty(), te::rp::Matrix< TemplateElementType >::operator=(), and te::rp::Matrix< TemplateElementType >::reset().