te::mem::CachedBandBlocksManager Class Reference

RAM cached and tiled raster band blocks manager. More...

#include <CachedBandBlocksManager.h>

Inheritance diagram for te::mem::CachedBandBlocksManager:

Classes

class  BlockIndex
 Internal blocks indexes. More...
 
class  ThreadParameters
 Internal read/write thread execution parameters. More...
 

Public Member Functions

 CachedBandBlocksManager ()
 
void free ()
 
void * getBlockPointer (unsigned int band, unsigned int x, unsigned int y)
 Returns a pointer to the required data block. More...
 
unsigned int getDataPrefetchThreshold () const
 The read-ahead data prefetch threshold. More...
 
unsigned int getMaxNumberOfCacheBlocks () const
 The maximum number of cache blocks. More...
 
te::rst::RastergetRaster () const
 Returns the associated raster. More...
 
bool initialize (const te::rst::Raster &externalRaster, const unsigned char maxMemPercentUsed, const unsigned int dataPrefetchThreshold)
 Initialize this instance to an initial state. More...
 
bool initialize (const unsigned int maxNumberOfCacheBlocks, const te::rst::Raster &externalRaster, const unsigned int dataPrefetchThreshold)
 Initialize this instance to an initial state. More...
 
bool isInitialized () const
 Returns true if this instance is initialized. More...
 
 ~CachedBandBlocksManager ()
 

Static Protected Member Functions

static void threadEntry (ThreadParameters *paramsPtr)
 Thread entry. More...
 

Protected Attributes

std::vector< BlockIndexm_blocksFifo
 blocks swap FIFO. More...
 
unsigned int m_blocksFifoNextSwapBlockIndex
 The next block swapp index over m_blocksFifo. More...
 
std::vector< unsigned char * > m_blocksHandler
 Cache blocks handler. More...
 
std::vector< std::vector< std::vector< unsigned char * > > > m_blocksPointers
 3D Matrix of block pointers indexed as [band][blockYIndex][blockXIndex]. More...
 
unsigned int m_dataPrefetchThreshold
 The read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary). More...
 
unsigned char * m_getBlockPointer_BlkPtr
 
unsigned int m_globalBlockSizeBytes
 The maximum block size for all bands. More...
 
unsigned int m_globalBlocksNumberX
 The maximum number of blocks (X axis) for all bands. More...
 
unsigned int m_globalBlocksNumberY
 The maximum number of blocks (Y axis) for all bands. More...
 
unsigned int m_maxNumberOfCacheBlocks
 The maximum number of cache blocks. More...
 
te::rst::Rasterm_rasterPtr
 External raster pointer. More...
 
std::auto_ptr< boost::thread > m_threadHandler
 The internal thread handler. More...
 
ThreadParameters m_threadParams
 The internal thread execution parameters. More...
 

Private Member Functions

void initState ()
 Initialize this instance to an initial state. More...
 

Detailed Description

RAM cached and tiled raster band blocks manager.

Definition at line 51 of file CachedBandBlocksManager.h.

Constructor & Destructor Documentation

te::mem::CachedBandBlocksManager::CachedBandBlocksManager ( )
te::mem::CachedBandBlocksManager::~CachedBandBlocksManager ( )

Member Function Documentation

void te::mem::CachedBandBlocksManager::free ( )
Note
Free all allocated internal resources and go back to the initial state.
void* te::mem::CachedBandBlocksManager::getBlockPointer ( unsigned int  band,
unsigned int  x,
unsigned int  y 
)

Returns a pointer to the required data block.

Parameters
bandThe band index.
xThe block-id in x (or x-offset).
yThe block-id in y (or y-offset).
Returns
Pointer to the required data block.
unsigned int te::mem::CachedBandBlocksManager::getDataPrefetchThreshold ( ) const
inline

The read-ahead data prefetch threshold.

Definition at line 129 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::getMaxNumberOfCacheBlocks ( ) const
inline

The maximum number of cache blocks.

Definition at line 123 of file CachedBandBlocksManager.h.

te::rst::Raster* te::mem::CachedBandBlocksManager::getRaster ( ) const
inline

Returns the associated raster.

Definition at line 117 of file CachedBandBlocksManager.h.

bool te::mem::CachedBandBlocksManager::initialize ( const te::rst::Raster externalRaster,
const unsigned char  maxMemPercentUsed,
const unsigned int  dataPrefetchThreshold 
)

Initialize this instance to an initial state.

Parameters
externalRasterThe external raster where the data will be read/written.
maxMemPercentUsedThe maximum free memory percentual to use valid range: [1:100].
dataPrefetchThresholdThe read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary).
Returns
true if OK, false on errors.
bool te::mem::CachedBandBlocksManager::initialize ( const unsigned int  maxNumberOfCacheBlocks,
const te::rst::Raster externalRaster,
const unsigned int  dataPrefetchThreshold 
)

Initialize this instance to an initial state.

Parameters
externalRasterThe external raster where the data will be read/written.
maxNumberOfCacheBlocksThe maximum number of cache blocks.
dataPrefetchThresholdThe read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary).
Returns
true if OK, false on errors.
void te::mem::CachedBandBlocksManager::initState ( )
private

Initialize this instance to an initial state.

bool te::mem::CachedBandBlocksManager::isInitialized ( ) const
inline

Returns true if this instance is initialized.

Returns
true if this instance is initialized.

Definition at line 94 of file CachedBandBlocksManager.h.

static void te::mem::CachedBandBlocksManager::threadEntry ( ThreadParameters paramsPtr)
staticprotected

Thread entry.

Parameters
paramsPtrA pointer to the thread parameters.

Member Data Documentation

std::vector< BlockIndex > te::mem::CachedBandBlocksManager::m_blocksFifo
protected

blocks swap FIFO.

Definition at line 241 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_blocksFifoNextSwapBlockIndex
protected

The next block swapp index over m_blocksFifo.

Definition at line 232 of file CachedBandBlocksManager.h.

std::vector< unsigned char* > te::mem::CachedBandBlocksManager::m_blocksHandler
protected

Cache blocks handler.

Definition at line 239 of file CachedBandBlocksManager.h.

std::vector< std::vector< std::vector< unsigned char* > > > te::mem::CachedBandBlocksManager::m_blocksPointers
protected

3D Matrix of block pointers indexed as [band][blockYIndex][blockXIndex].

Definition at line 237 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_dataPrefetchThreshold
protected

The read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary).

Definition at line 222 of file CachedBandBlocksManager.h.

unsigned char* te::mem::CachedBandBlocksManager::m_getBlockPointer_BlkPtr
protected

Definition at line 235 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_globalBlockSizeBytes
protected

The maximum block size for all bands.

Definition at line 228 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_globalBlocksNumberX
protected

The maximum number of blocks (X axis) for all bands.

Definition at line 224 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_globalBlocksNumberY
protected

The maximum number of blocks (Y axis) for all bands.

Definition at line 226 of file CachedBandBlocksManager.h.

unsigned int te::mem::CachedBandBlocksManager::m_maxNumberOfCacheBlocks
protected

The maximum number of cache blocks.

Definition at line 230 of file CachedBandBlocksManager.h.

te::rst::Raster* te::mem::CachedBandBlocksManager::m_rasterPtr
protected

External raster pointer.

Definition at line 220 of file CachedBandBlocksManager.h.

std::auto_ptr< boost::thread > te::mem::CachedBandBlocksManager::m_threadHandler
protected

The internal thread handler.

Definition at line 245 of file CachedBandBlocksManager.h.

ThreadParameters te::mem::CachedBandBlocksManager::m_threadParams
protected

The internal thread execution parameters.

Definition at line 243 of file CachedBandBlocksManager.h.


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