RAM cached and tiled raster band blocks manager. More...
#include <CachedBandBlocksManager.h>
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::Raster * | getRaster () 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< BlockIndex > | m_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::Raster * | m_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... | |
RAM cached and tiled raster band blocks manager.
Definition at line 51 of file CachedBandBlocksManager.h.
| te::mem::CachedBandBlocksManager::CachedBandBlocksManager | ( | ) |
Definition at line 47 of file CachedBandBlocksManager.cpp.
| te::mem::CachedBandBlocksManager::~CachedBandBlocksManager | ( | ) |
Definition at line 52 of file CachedBandBlocksManager.cpp.
| void te::mem::CachedBandBlocksManager::free | ( | ) |
Definition at line 155 of file CachedBandBlocksManager.cpp.
References te::common::WAccess.
| void * te::mem::CachedBandBlocksManager::getBlockPointer | ( | unsigned int | band, |
| unsigned int | x, | ||
| unsigned int | y | ||
| ) |
Returns a pointer to the required data block.
| band | The band index. |
| x | The block-id in x (or x-offset). |
| y | The block-id in y (or y-offset). |
Definition at line 222 of file CachedBandBlocksManager.cpp.
References te::mem::CachedBandBlocksManager::BlockIndex::m_b, te::mem::CachedBandBlocksManager::BlockIndex::m_x, te::mem::CachedBandBlocksManager::BlockIndex::m_y, and te::common::WAccess.
|
inline |
The read-ahead data prefetch threshold.
Definition at line 129 of file CachedBandBlocksManager.h.
|
inline |
The maximum number of cache blocks.
Definition at line 123 of file CachedBandBlocksManager.h.
|
inline |
Returns the associated raster.
Definition at line 117 of file CachedBandBlocksManager.h.
Referenced by te::mem::CachedBand::CachedBand().
| 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.
| externalRaster | The external raster where the data will be read/written. |
| maxMemPercentUsed | The maximum free memory percentual to use valid range: [1:100]. |
| dataPrefetchThreshold | The read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary). |
Definition at line 57 of file CachedBandBlocksManager.cpp.
References te::rst::Raster::getBand(), te::mem::Band::getBlockSize(), te::rst::Raster::getNumberOfBands(), te::common::GetTotalPhysicalMemory(), te::common::GetTotalVirtualMemory(), and te::common::GetUsedVirtualMemory().
Referenced by te::mem::CachedRaster::CachedRaster().
| 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.
| externalRaster | The external raster where the data will be read/written. |
| maxNumberOfCacheBlocks | The maximum number of cache blocks. |
| dataPrefetchThreshold | The read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched, higher values will do prefetch when necessary). |
Definition at line 85 of file CachedBandBlocksManager.cpp.
References te::rst::Raster::getBand(), te::mem::Band::getBlockSize(), te::rst::Raster::getNumberOfBands(), te::rst::Band::getProperty(), te::rst::BandProperty::m_nblocksx, and te::rst::BandProperty::m_nblocksy.
|
private |
Initialize this instance to an initial state.
Definition at line 35 of file CachedBandBlocksManager.cpp.
References m_blocksFifoNextSwapBlockIndex, m_dataPrefetchThreshold, m_getBlockPointer_BlkPtr, m_globalBlockSizeBytes, m_globalBlocksNumberX, m_globalBlocksNumberY, m_maxNumberOfCacheBlocks, and m_rasterPtr.
|
inline |
Returns true if this instance is initialized.
Definition at line 94 of file CachedBandBlocksManager.h.
|
staticprotected |
Thread entry.
| paramsPtr | A pointer to the thread parameters. |
Definition at line 354 of file CachedBandBlocksManager.cpp.
References te::rst::Raster::getBand(), te::rst::Raster::getNumberOfBands(), te::rst::Band::getProperty(), te::mem::CachedBandBlocksManager::ThreadParameters::m_blockB, te::mem::CachedBandBlocksManager::ThreadParameters::m_blockPtr, te::mem::CachedBandBlocksManager::ThreadParameters::m_blockX, te::mem::CachedBandBlocksManager::ThreadParameters::m_blockY, te::mem::CachedBandBlocksManager::ThreadParameters::m_dataPrefetchThreshold, te::mem::CachedBandBlocksManager::ThreadParameters::m_doTaskCondVar, te::mem::CachedBandBlocksManager::ThreadParameters::m_doTaskMutex, te::mem::CachedBandBlocksManager::ThreadParameters::m_exchangeBlockPtr, te::rst::BandProperty::m_nblocksx, te::rst::BandProperty::m_nblocksy, te::mem::CachedBandBlocksManager::ThreadParameters::m_rasterPtr, te::mem::CachedBandBlocksManager::ThreadParameters::m_task, te::mem::CachedBandBlocksManager::ThreadParameters::m_taskFinished, te::mem::CachedBandBlocksManager::ThreadParameters::m_taskFinishedCondVar, te::mem::CachedBandBlocksManager::ThreadParameters::m_taskFinishedMutex, te::mem::CachedBandBlocksManager::ThreadParameters::m_threadDataBlockHandler, te::mem::Band::read(), and te::mem::Band::write().
|
protected |
blocks swap FIFO.
Definition at line 241 of file CachedBandBlocksManager.h.
|
protected |
The next block swapp index over m_blocksFifo.
Definition at line 232 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
Cache blocks handler.
Definition at line 239 of file CachedBandBlocksManager.h.
|
protected |
3D Matrix of block pointers indexed as [band][blockYIndex][blockXIndex].
Definition at line 237 of file CachedBandBlocksManager.h.
|
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.
Referenced by initState().
|
protected |
Definition at line 235 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
The maximum block size for all bands.
Definition at line 228 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
The maximum number of blocks (X axis) for all bands.
Definition at line 224 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
The maximum number of blocks (Y axis) for all bands.
Definition at line 226 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
The maximum number of cache blocks.
Definition at line 230 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
External raster pointer.
Definition at line 220 of file CachedBandBlocksManager.h.
Referenced by initState().
|
protected |
The internal thread handler.
Definition at line 245 of file CachedBandBlocksManager.h.
|
protected |
The internal thread execution parameters.
Definition at line 243 of file CachedBandBlocksManager.h.