te::rst::SynchronizedBandBlocksManager Class Reference

Synchronized raster raster band blocks manager. More...

#include <SynchronizedBandBlocksManager.h>

Inheritance diagram for te::rst::SynchronizedBandBlocksManager:

Classes

class  BlockIndex
 Internal blocks indexes. More...
 

Public Member Functions

void free ()
 
void * getBlockPointer (unsigned int band, unsigned int x, unsigned int y)
 Returns a pointer to the required data block. More...
 
unsigned int getMaxNumberOfCacheBlocks () const
 The maximum number of cache blocks. More...
 
te::rst::RastergetRaster () const
 Returns the associated raster. More...
 
RasterSynchronizergetSynchronizer () const
 Return a pointer to the assotiated synchronizer instance or NULL if there is none. More...
 
bool initialize (RasterSynchronizer &sync, const unsigned char maxMemPercentUsed)
 Initialize this instance to an initial state. More...
 
bool initialize (const unsigned int maxNumberOfCacheBlocks, RasterSynchronizer &sync)
 Initialize this instance to an initial state. More...
 
bool isInitialized () const
 Returns true if this instance is initialized. More...
 
 SynchronizedBandBlocksManager ()
 
 ~SynchronizedBandBlocksManager ()
 

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 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...
 
RasterSynchronizerm_syncPtr
 A pointer to the synchronizer used by this instance, of null if not initialized. More...
 

Private Member Functions

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

Detailed Description

Synchronized raster raster band blocks manager.

Definition at line 50 of file SynchronizedBandBlocksManager.h.

Constructor & Destructor Documentation

te::rst::SynchronizedBandBlocksManager::SynchronizedBandBlocksManager ( )
te::rst::SynchronizedBandBlocksManager::~SynchronizedBandBlocksManager ( )

Member Function Documentation

void te::rst::SynchronizedBandBlocksManager::free ( )
Note
Free all allocated internal resources and go back to the initial state.
void* te::rst::SynchronizedBandBlocksManager::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::rst::SynchronizedBandBlocksManager::getMaxNumberOfCacheBlocks ( ) const
inline

The maximum number of cache blocks.

Definition at line 117 of file SynchronizedBandBlocksManager.h.

te::rst::Raster* te::rst::SynchronizedBandBlocksManager::getRaster ( ) const

Returns the associated raster.

RasterSynchronizer* te::rst::SynchronizedBandBlocksManager::getSynchronizer ( ) const
inline

Return a pointer to the assotiated synchronizer instance or NULL if there is none.

Definition at line 123 of file SynchronizedBandBlocksManager.h.

bool te::rst::SynchronizedBandBlocksManager::initialize ( RasterSynchronizer sync,
const unsigned char  maxMemPercentUsed 
)

Initialize this instance to an initial state.

Parameters
syncThe synchronized used by this instance.
maxMemPercentUsedThe maximum free memory percentual to use valid range: [1:100].
Returns
true if OK, false on errors.
Note
For the case where using the write raster access policy: The use of multiple cached blocks can cause deadlocks if multiple threads are locking blocks needed by other threads, use it with caution!
bool te::rst::SynchronizedBandBlocksManager::initialize ( const unsigned int  maxNumberOfCacheBlocks,
RasterSynchronizer sync 
)

Initialize this instance to an initial state.

Parameters
syncThe synchronized used by this instance.
maxNumberOfCacheBlocksThe maximum number of cache blocks.
Returns
true if OK, false on errors.
Note
For the case where using the write raster access policy: The use of multiple cached blocks can cause deadlocks if multiple threads are locking blocks needed by other threads, use it with caution!
void te::rst::SynchronizedBandBlocksManager::initState ( )
private

Initialize this instance to an initial state.

bool te::rst::SynchronizedBandBlocksManager::isInitialized ( ) const
inline

Returns true if this instance is initialized.

Returns
true if this instance is initialized.

Definition at line 91 of file SynchronizedBandBlocksManager.h.

Member Data Documentation

std::vector< BlockIndex > te::rst::SynchronizedBandBlocksManager::m_blocksFifo
protected

blocks swap FIFO.

Definition at line 172 of file SynchronizedBandBlocksManager.h.

unsigned int te::rst::SynchronizedBandBlocksManager::m_blocksFifoNextSwapBlockIndex
protected

The next block swapp index over m_blocksFifo.

Definition at line 163 of file SynchronizedBandBlocksManager.h.

std::vector< unsigned char* > te::rst::SynchronizedBandBlocksManager::m_blocksHandler
protected

Cache blocks handler.

Definition at line 170 of file SynchronizedBandBlocksManager.h.

std::vector< std::vector< std::vector< unsigned char* > > > te::rst::SynchronizedBandBlocksManager::m_blocksPointers
protected

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

Definition at line 168 of file SynchronizedBandBlocksManager.h.

unsigned char* te::rst::SynchronizedBandBlocksManager::m_getBlockPointer_BlkPtr
protected

Definition at line 166 of file SynchronizedBandBlocksManager.h.

unsigned int te::rst::SynchronizedBandBlocksManager::m_globalBlockSizeBytes
protected

The maximum block size for all bands.

Definition at line 159 of file SynchronizedBandBlocksManager.h.

unsigned int te::rst::SynchronizedBandBlocksManager::m_globalBlocksNumberX
protected

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

Definition at line 155 of file SynchronizedBandBlocksManager.h.

unsigned int te::rst::SynchronizedBandBlocksManager::m_globalBlocksNumberY
protected

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

Definition at line 157 of file SynchronizedBandBlocksManager.h.

unsigned int te::rst::SynchronizedBandBlocksManager::m_maxNumberOfCacheBlocks
protected

The maximum number of cache blocks.

Definition at line 161 of file SynchronizedBandBlocksManager.h.

RasterSynchronizer* te::rst::SynchronizedBandBlocksManager::m_syncPtr
protected

A pointer to the synchronizer used by this instance, of null if not initialized.

Definition at line 153 of file SynchronizedBandBlocksManager.h.


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