26#ifndef __TERRALIB_MEMORY_INTERNAL_CACHEDBANDBLOCKSMANAGER_H
27#define __TERRALIB_MEMORY_INTERNAL_CACHEDBANDBLOCKSMANAGER_H
38#include <boost/noncopyable.hpp>
39#include <boost/thread.hpp>
40#include <boost/scoped_array.hpp>
71 const unsigned char maxMemPercentUsed,
72 const unsigned int dataPrefetchThreshold );
85 bool initialize(
const unsigned int maxNumberOfCacheBlocks,
87 const unsigned int dataPrefetchThreshold );
unsigned int m_y
Block index over the Y axis.
unsigned int m_b
Block band index.
unsigned int m_x
Block index over the X axis.
Internal read/write thread execution parameters.
unsigned char * m_exchangeBlockPtr
Exchange block pointer.
unsigned int m_dataPrefetchThreshold
The user defined read-ahead threshold.
unsigned int m_blockB
Raster block band index.
boost::condition_variable m_doTaskCondVar
Used by the thread when awakenning to perform some task.
te::rst::Raster * m_rasterPtr
External raster pointer.
unsigned int m_blockY
Raster block Y index.
boost::mutex m_doTaskMutex
Used when wakenning the thread to perform some task.
unsigned int m_blockX
Raster block X index.
bool m_taskFinished
true when the thread has finished the required task.
boost::scoped_array< unsigned char > m_threadDataBlockHandler
A extra block used in exchange when a read-ahead task is performed.
@ WriteTaskT
m_blockPtr must point to the block to be written, m_exchangeBlockPtr must be zero.
@ SuicideTastT
The thread will finish the main loop and exit.
@ ReadTaskT
m_exchangeBlockPtr must point to a valid exchange block (it will be keept inside the thread for furth...
boost::condition_variable m_taskFinishedCondVar
Used to wait for the required task finishment.
unsigned char * m_blockPtr
Input block pointer.
TaskType m_task
The required task to be performed (read/write/exit).
boost::mutex m_taskFinishedMutex
used by the thread to inform a task finishment.
unsigned int m_globalBlockSizeBytes
The maximum block size for all bands.
unsigned char * m_getBlockPointer_BlkPtr
~CachedBandBlocksManager()
std::unique_ptr< boost::thread > m_threadHandler
The internal thread handler.
std::vector< unsigned char * > m_blocksHandler
Cache blocks handler.
void * getBlockPointer(unsigned int band, unsigned int x, unsigned int y)
Returns a pointer to the required data block.
static void threadEntry(ThreadParameters *paramsPtr)
Thread entry.
bool initialize(const unsigned int maxNumberOfCacheBlocks, const te::rst::Raster &externalRaster, const unsigned int dataPrefetchThreshold)
Initialize this instance to an initial state.
unsigned int getDataPrefetchThreshold() const
The read-ahead data prefetch threshold.
unsigned int m_globalBlocksNumberX
The maximum number of blocks (X axis) for all bands.
bool isInitialized() const
Returns true if this instance is initialized.
unsigned int m_blocksFifoNextSwapBlockIndex
The next block swapp index over m_blocksFifo.
unsigned int m_globalBlocksNumberY
The maximum number of blocks (Y axis) for all bands.
std::vector< std::vector< std::vector< unsigned char * > > > m_blocksPointers
3D Matrix of block pointers indexed as [band][blockYIndex][blockXIndex].
unsigned int m_dataPrefetchThreshold
The read-ahead data prefetch threshold (0-will disable prefetch, 1-data always prefetched,...
CachedBandBlocksManager()
te::rst::Raster * m_rasterPtr
External raster pointer.
ThreadParameters m_threadParams
The internal thread execution parameters.
void initState()
Initialize this instance to an initial state.
te::rst::Raster * getRaster() const
Returns the associated raster.
bool initialize(const te::rst::Raster &externalRaster, const unsigned char maxMemPercentUsed, const unsigned int dataPrefetchThreshold)
Initialize this instance to an initial state.
std::vector< BlockIndex > m_blocksFifo
blocks swap FIFO.
unsigned int m_maxNumberOfCacheBlocks
The maximum number of cache blocks.
unsigned int getMaxNumberOfCacheBlocks() const
The maximum number of cache blocks.
An abstract class for raster data strucutures.
Namespace for the memory data source of TerraLib.
An abstract class for raster data strucutures.
Configuration flags for the TerraLib In-memory Data Access driver.
#define TEMEMORYEXPORT
You can use this macro in order to export/import classes and functions from this module.