RAM cached and tiled raster band blocks manager. More...
#include <ExpansibleBandBlocksManager.h>
Classes | |
class | BlockIndex3D |
3D Block index. More... | |
class | DiskBlockInfo |
Disk block info. More... | |
class | OpenDiskFileHandler |
Open disk file handler. More... | |
Public Member Functions | |
bool | addBottomBands (const unsigned int &expansionSize, std::vector< BlockIndex3D > &addedBlocksCoords) |
New bands will be added at the bottom of the raster (after de the last band). More... | |
bool | addBottomBlocks (const unsigned int &expansionSize, const unsigned int &band, std::vector< BlockIndex3D > &addedBlocksCoords) |
New blocks will be added at the bottom of the raster. More... | |
bool | addLeftBlocks (const unsigned int &expansionSize, const unsigned int &band, std::vector< BlockIndex3D > &addedBlocksCoords) |
New blocks will be added at the left of the raster. More... | |
bool | addRightBlocks (const unsigned int &expansionSize, const unsigned int &band, std::vector< BlockIndex3D > &addedBlocksCoords) |
New blocks will be added at the right of the raster. More... | |
bool | addTopBands (const unsigned int &expansionSize, std::vector< BlockIndex3D > &addedBlocksCoords) |
New bands will be added at the top of the raster (before the first band). More... | |
bool | addTopBlocks (const unsigned int &expansionSize, const unsigned int &band, std::vector< BlockIndex3D > &addedBlocksCoords) |
New blocks will be added at the top of the raster. More... | |
ExpansibleBandBlocksManager () | |
void | free () |
Free all allocated internal resources and go back to the initial state. More... | |
void * | getBlockPointer (unsigned int band, unsigned int x, unsigned int y) |
Returns a pointer to the required data block. More... | |
unsigned long int | getBlockSizeBytes () |
Returns the internal size( bytes ) used for all internal blocks. More... | |
unsigned int | getMaxNumberOfRAMBlocks () const |
The maximum number of cache blocks. More... | |
unsigned int | getNumberOfBands () const |
Returns the number of bands. More... | |
unsigned int | getNumberOfBlocksX (const unsigned int band) const |
Returns the number of blocks along the X directon for the required band. More... | |
unsigned int | getNumberOfBlocksY (const unsigned int band) const |
Returns the number of blocks along the Y directon for the required band. More... | |
bool | initialize (const unsigned int maxNumberRAMBlocks, const std::vector< unsigned int > &numbersOfBlocksX, const std::vector< unsigned int > &numbersOfBlocksY, const std::vector< unsigned int > &blocksSizesBytes, const unsigned long int maxDiskFilesSize) |
Initialize this instance to an initial state. More... | |
bool | isInitialized () const |
Returns true if this instance is initialized. More... | |
~ExpansibleBandBlocksManager () | |
Protected Types | |
typedef std::vector< std::vector< std::vector< DiskBlockInfo > > > | ActiveDiskBlocksInfoT |
Active disk blocks info type;. More... | |
typedef BlockElementT * | BlockelementPtrT |
Block element pointer type. More... | |
typedef unsigned char | BlockElementT |
Block element type. More... | |
typedef std::list< DiskBlockInfo > | InactiveDiskBlocksInfoT |
Inactive disk blocks info type. More... | |
typedef boost::shared_ptr< OpenDiskFileHandler > | OpenDiskFileHandlerPtrT |
Open disk file pointer type. More... | |
typedef std::list< OpenDiskFileHandlerPtrT > | OpenDiskFilesHandlerT |
Open dis files handler type. More... | |
typedef boost::shared_array< BlockElementT > | RAMBlockHandlerT |
RAM Block handler type;. More... | |
typedef std::list< RAMBlockHandlerT > | RAMBlocksHandlerT |
Blocks handler type;. More... | |
typedef std::vector< std::vector< std::vector< BlockelementPtrT > > > | RAMBlocksPointersContainerT |
RAM blocks pointers container type. More... | |
typedef std::vector< BlockIndex3D > | SwapFifoT |
Swap fifo type. More... | |
Protected Member Functions | |
bool | allocateAndActivateDiskBlocks (const std::vector< BlockIndex3D > &blocksIndxes) |
Allocate and activate disk blocks. More... | |
bool | allocateDiskBlocks (const unsigned int blocksNumber, std::vector< DiskBlockInfo > &diskBlocksInfos, OpenDiskFilesHandlerT &diskFilesHandler) const |
Allocate disk blocks. More... | |
bool | createNewDiskFile (unsigned long int size, FILE **fileptr, std::string &fullFileName) const |
Create a new disk file. More... | |
void | initState () |
Initialize this instance to an initial state. More... | |
template<typename ContainerType > | |
void | shift3DCoords (ContainerType &inputContainer, const int &dim0Shift, const int &dim1Shift, const int &dim2Shift) const |
Shift 3D coords. More... | |
template<typename ContainerType > | |
void | shiftDim03DCoords (ContainerType &inputContainer, const unsigned int dim0index, const int dim1Shift, const int dim2Shift) const |
Shift coords given a fixed dimention 0 index. More... | |
Protected Attributes | |
ActiveDiskBlocksInfoT | m_activeDiskBlocksInfo |
3D Matrix of active disk block info indexed as [band][blockYIndex][blockXIndex]. More... | |
RAMBlocksHandlerT | m_activeRAMBlocksHandler |
The active RAM blocks handler. More... | |
unsigned char * | m_currSwapBlockPtr |
A pointer to the current block where disk data swap will be done. More... | |
OpenDiskFilesHandlerT | m_diskFilesHandler |
The disk files handler;. More... | |
bool | m_isInitialized |
Is this instance initialized ? More... | |
unsigned long int | m_maxBlockSizeBytes |
The maximum global used block size in bytes. More... | |
unsigned long int | m_maxDiskFilesSize |
The maximum temporary disk file size (bytes). More... | |
unsigned int | m_maxNumberRAMBlocks |
The maximum number of RAM blocks;. More... | |
SwapFifoT::size_type | m_nextFIFOPositionOverSwapFifo |
The next position where a block swap will occur over m_swapFifo;. More... | |
RAMBlocksPointersContainerT | m_ramBlocksPointers |
3D Matrix of active RAM blocks pointers indexed in the form [band][blockYIndex][blockXIndex]. More... | |
RAMBlockHandlerT | m_swapBlockHandler |
An extra block for disk swap purposes. More... | |
SwapFifoT | m_swapFifo |
Disk swapping FIFO. More... | |
Private Attributes | |
unsigned char * | m_getBlockPointer_returnValue |
RAM cached and tiled raster band blocks manager.
Definition at line 53 of file ExpansibleBandBlocksManager.h.
|
protected |
Active disk blocks info type;.
Definition at line 431 of file ExpansibleBandBlocksManager.h.
|
protected |
Block element pointer type.
Definition at line 423 of file ExpansibleBandBlocksManager.h.
|
protected |
Block element type.
Definition at line 421 of file ExpansibleBandBlocksManager.h.
|
protected |
Inactive disk blocks info type.
Definition at line 433 of file ExpansibleBandBlocksManager.h.
|
protected |
Open disk file pointer type.
Definition at line 296 of file ExpansibleBandBlocksManager.h.
|
protected |
Open dis files handler type.
Definition at line 298 of file ExpansibleBandBlocksManager.h.
|
protected |
RAM Block handler type;.
Definition at line 425 of file ExpansibleBandBlocksManager.h.
|
protected |
Blocks handler type;.
Definition at line 429 of file ExpansibleBandBlocksManager.h.
|
protected |
RAM blocks pointers container type.
Definition at line 427 of file ExpansibleBandBlocksManager.h.
|
protected |
Swap fifo type.
Definition at line 435 of file ExpansibleBandBlocksManager.h.
te::mem::ExpansibleBandBlocksManager::ExpansibleBandBlocksManager | ( | ) |
te::mem::ExpansibleBandBlocksManager::~ExpansibleBandBlocksManager | ( | ) |
bool te::mem::ExpansibleBandBlocksManager::addBottomBands | ( | const unsigned int & | expansionSize, |
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New bands will be added at the bottom of the raster (after de the last band).
expansionSize | The number of bands to add. |
addedBlocksCoords | The added blocks coords. |
bool te::mem::ExpansibleBandBlocksManager::addBottomBlocks | ( | const unsigned int & | expansionSize, |
const unsigned int & | band, | ||
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New blocks will be added at the bottom of the raster.
expansionSize | The expansion size over the Y direction. |
band | The band where the operation will be performed. |
addedBlocksCoords | The added blocks coords. |
bool te::mem::ExpansibleBandBlocksManager::addLeftBlocks | ( | const unsigned int & | expansionSize, |
const unsigned int & | band, | ||
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New blocks will be added at the left of the raster.
expansionSize | The expansion size over the X direction. |
band | The band where the operation will be performed. |
addedBlocksCoords | The added blocks coords. |
bool te::mem::ExpansibleBandBlocksManager::addRightBlocks | ( | const unsigned int & | expansionSize, |
const unsigned int & | band, | ||
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New blocks will be added at the right of the raster.
expansionSize | The expansion size over the X direction. |
band | The band where the operation will be performed. |
addedBlocksCoords | The added blocks coords. |
bool te::mem::ExpansibleBandBlocksManager::addTopBands | ( | const unsigned int & | expansionSize, |
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New bands will be added at the top of the raster (before the first band).
expansionSize | The number of bands to add. |
addedBlocksCoords | The added blocks coords. |
bool te::mem::ExpansibleBandBlocksManager::addTopBlocks | ( | const unsigned int & | expansionSize, |
const unsigned int & | band, | ||
std::vector< BlockIndex3D > & | addedBlocksCoords | ||
) |
New blocks will be added at the top of the raster.
expansionSize | The expansion size over the Y direction. |
band | The band where the operation will be performed. |
addedBlocksCoords | The added blocks coords. |
|
protected |
Allocate and activate disk blocks.
blocksIndxes | The blocks indexes inside the internal 3D indexing matrices. |
|
protected |
Allocate disk blocks.
blocksNumber | The number of blocks to allocate. |
diskBlocksInfos | The info for the allocated blocks. |
diskFilesHandler | The file handlers for all the allocated blocks. |
|
protected |
Create a new disk file.
size | The file size. |
fileptr | The file pointer. |
fullFileName | The full created file name. |
void te::mem::ExpansibleBandBlocksManager::free | ( | ) |
Free all allocated internal resources and go back to the initial state.
void* te::mem::ExpansibleBandBlocksManager::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). |
|
inline |
Returns the internal size( bytes ) used for all internal blocks.
Definition at line 159 of file ExpansibleBandBlocksManager.h.
|
inline |
The maximum number of cache blocks.
Definition at line 179 of file ExpansibleBandBlocksManager.h.
|
inline |
Returns the number of bands.
Definition at line 149 of file ExpansibleBandBlocksManager.h.
|
inline |
Returns the number of blocks along the X directon for the required band.
band | The required band. |
Definition at line 123 of file ExpansibleBandBlocksManager.h.
|
inline |
Returns the number of blocks along the Y directon for the required band.
band | The required band. |
Definition at line 137 of file ExpansibleBandBlocksManager.h.
bool te::mem::ExpansibleBandBlocksManager::initialize | ( | const unsigned int | maxNumberRAMBlocks, |
const std::vector< unsigned int > & | numbersOfBlocksX, | ||
const std::vector< unsigned int > & | numbersOfBlocksY, | ||
const std::vector< unsigned int > & | blocksSizesBytes, | ||
const unsigned long int | maxDiskFilesSize | ||
) |
Initialize this instance to an initial state.
maxNumberRAMBlocks | The maximum number of RAM blocks. |
numbersOfBlocksX | The number of blocks along the X directon (for each band). |
numbersOfBlocksY | The number of blocks along the Y directon (for each band). |
blocksSizesBytes | The blocks sizes in bytes (for each band). |
maxDiskFilesSize | The maximum temporary disk file size (if required). |
|
protected |
Initialize this instance to an initial state.
|
inline |
Returns true if this instance is initialized.
Definition at line 111 of file ExpansibleBandBlocksManager.h.
|
inlineprotected |
Shift 3D coords.
inputContainer | The input coords container. |
dim0Shift | The shift to be done over the dimension 0. |
dim1Shift | The shift to be done over the dimension 1. |
dim2Shift | The shift to be done over the dimension 2. |
Definition at line 393 of file ExpansibleBandBlocksManager.h.
|
inlineprotected |
Shift coords given a fixed dimention 0 index.
inputContainer | The input coords container. |
dim0index | The dimension 0 fixed index. |
dim1Shift | The shift to be done over the dimension 1. |
dim2Shift | The shift to be done over the dimension 2. |
Definition at line 356 of file ExpansibleBandBlocksManager.h.
|
protected |
3D Matrix of active disk block info indexed as [band][blockYIndex][blockXIndex].
Definition at line 455 of file ExpansibleBandBlocksManager.h.
|
protected |
The active RAM blocks handler.
Definition at line 449 of file ExpansibleBandBlocksManager.h.
|
protected |
A pointer to the current block where disk data swap will be done.
Definition at line 445 of file ExpansibleBandBlocksManager.h.
|
protected |
The disk files handler;.
Definition at line 457 of file ExpansibleBandBlocksManager.h.
|
private |
Definition at line 464 of file ExpansibleBandBlocksManager.h.
|
protected |
Is this instance initialized ?
Definition at line 437 of file ExpansibleBandBlocksManager.h.
|
protected |
The maximum global used block size in bytes.
Definition at line 443 of file ExpansibleBandBlocksManager.h.
|
protected |
The maximum temporary disk file size (bytes).
Definition at line 441 of file ExpansibleBandBlocksManager.h.
|
protected |
The maximum number of RAM blocks;.
Definition at line 439 of file ExpansibleBandBlocksManager.h.
|
protected |
The next position where a block swap will occur over m_swapFifo;.
Definition at line 447 of file ExpansibleBandBlocksManager.h.
|
protected |
3D Matrix of active RAM blocks pointers indexed in the form [band][blockYIndex][blockXIndex].
Definition at line 451 of file ExpansibleBandBlocksManager.h.
|
protected |
An extra block for disk swap purposes.
Definition at line 459 of file ExpansibleBandBlocksManager.h.
|
protected |
Disk swapping FIFO.
Definition at line 453 of file ExpansibleBandBlocksManager.h.