| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
TeRasterMemManager Class Reference

This class deals with a raster memory management. More...

`#include <TeRasterMemManager.h>`

List of all members.

## Classes

class | DiskTileData
| Disk tile data. More...

## Public Types

enum | MemoryPolicy { AutoMemPol = 1, RAMMemPol = 2, DiskMemPol = 3 }

## Public Member Functions

| TeRasterMemManager ()
| Default Constructor.
| ~TeRasterMemManager ()
| Default Destructor.
void | clear ()
| Clear all data structures.
bool | reset (unsigned int bands, unsigned int tilesPerBand, const std::vector< unsigned int > &tilesSizesVec, MemoryPolicy memoryPolicy, unsigned char maxMemPercentUsage, unsigned long int maxTempFileSize)
| Reset the instance following new raster parameters.
void * | getTilePointer (const unsigned int &band, const unsigned int &tile)
| Returnas a pointer to a internal allocated tile.

## Protected Types

typedef unsigned char | TileDataT
typedef TileDataT * | TilePtrT
typedef std::vector< TilePtrT > | TilesPtrsVecT
typedef std::vector< DiskTileData > | DiskTileDataVecT
typedef std::vector< std::pair < FILE *, std::string > > | OpenDiskFilesVecT

## Protected Member Functions

bool | allocateDiskFiles (unsigned int tileSize, unsigned int tilesNmb, OpenDiskFilesVecT &openDiskFilesVec, DiskTileDataVecT &diskTilesData)
| Allocate disk files .
bool | createNewDiskFile (unsigned long int size, std::string &filename, FILE **fileptr)
| Create a new disk temp file.

## Protected Attributes

unsigned char | maxMemPercentUsage_
| the max amount of free memory to use when necessary (default:50).
unsigned long int | maxTempFileSize_
| The the maximum temp file size in bytes (default:2GB).
TilePtrT | getTilePointer_tilePtr_
unsigned int | getTilePointer_reqTileIdx_
unsigned int | getTilePointer_swapTileIdx_
unsigned int | tilesPerBand_
| Tiles per band (default:0).
unsigned int | bandsNmb_
| The number of bands (default:0).
std::vector< unsigned int > | bandsTileSizes_
| A vector of tiles sizes for each band.
TilesPtrsVecT | allTilesPtrsVec_
| A vector of pointers to all allocated tiles.
OpenDiskFilesVecT | openDiskFilesVec_
| Openend disk files data vector.
DiskTileDataVecT | diskTilesDataVec_
| Disk tiles data vector.
std::vector< unsigned int > | ramTilesIndexesVec_
| The indexes inside allTilesPtrsVec_ of all RAM tiles.
unsigned int | nextSwapTileRamTilesIndexesVecIdx_
| The index inside ramTilesIndexesVec_ of the next RAM tile index that will be swapped to disk when a disk tile is required.
TilePtrT | swapTilePtr_
| A pointer to the auxiliar tile used when swapping data to/from disk.

## Detailed Description

This class deals with a raster memory management.

Author:
  Emiliano F. Castejon <castejon@dpi.inpe.br>

## Member Typedef Documentation

typedef std::vector< DiskTileData > TeRasterMemManager::DiskTileDataVecT`[protected]`

typedef std::vector< std::pair< FILE*, std::string > > TeRasterMemManager::OpenDiskFilesVecT`[protected]`

unsigned char TeRasterMemManager::TileDataT`[protected]`

Tile data type.

TileDataT * TeRasterMemManager::TilePtrT`[protected]`

Tile pointer type.

std::vector< TilePtrT > TeRasterMemManager::TilesPtrsVecT`[protected]`

Tiles pointers vector type.

## Member Enumeration Documentation

enum TeRasterMemManager::MemoryPolicy

Enumerator:

  AutoMemPol | Automatic memory policy ( Try to use RAM or DISK, if there is no avaliable RAM ).
  RAMMemPol | RAM memory policy.
  DiskMemPol | Disk memory policy.

## Constructor & Destructor Documentation

TeRasterMemManager::TeRasterMemManager | ( |  | ) |

Default Constructor.

TeRasterMemManager::~TeRasterMemManager | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TeRasterMemManager::allocateDiskFiles | ( | unsigned int | tileSize,
|  | unsigned int | tilesNmb,
|  | OpenDiskFilesVecT & | openDiskFilesVec,
|  | DiskTileDataVecT & | diskTilesData
| ) |  | `[protected]`

Allocate disk files .

Parameters:

  tileSize | The tile size.
  tilesNmb | The tiles number.
  openDiskFilesVec | The output vector with all the created files info.
  diskTilesData | The output tiles info.

Returns:
  true if OK, false on errors.

void TeRasterMemManager::clear | ( | void |  | ) |

Clear all data structures.

bool TeRasterMemManager::createNewDiskFile | ( | unsigned long int | size,
|  | std::string & | filename,
|  | FILE ** | fileptr
| ) |  | `[protected]`

Create a new disk temp file.

Parameters:

  filename | The file name.
  size | The file size.
  fileptr | The file pointer.

Returns:
  true if OK. false on errors.

void * TeRasterMemManager::getTilePointer | ( | const unsigned int & | band,
|  | const unsigned int & | tile
| ) |  |

Returnas a pointer to a internal allocated tile.

Parameters:

  band | Band index.
  tile | Tile index.

Returns:
  a pointer to a internal allocated tile.

Note:
  This pointer is only valid until the next call to this function.

bool TeRasterMemManager::reset | ( | unsigned int | bands,
|  | unsigned int | tilesPerBand,
|  | const std::vector< unsigned int > & | tilesSizesVec,
|  | MemoryPolicy | memoryPolicy,
|  | unsigned char | maxMemPercentUsage,
|  | unsigned long int | maxTempFileSize
| ) |  |

Reset the instance following new raster parameters.

Parameters:

  bands | The number of bands (channels).
  tilesPerBand | The tiles inside each band.
  tilesSizesVec | The tile size (bytes) for each band.
  memoryPolicy | Memory policy.
  maxMemPercentUsage | The max amount of RAM memory percentage to use when necessary - valid range: [0,100] suggested default:40.
  maxMemPercentUsage | The the maximum temp file size (bytes) (sugested default:2GB=2ul * 1024ul * 1024ul * 1024ul).

Returns:
  true if OK, false on errors.

## Member Data Documentation

TilesPtrsVecT TeRasterMemManager::allTilesPtrsVec_`[protected]`

A vector of pointers to all allocated tiles.

Note:
  Declared as a simple vector to optimize the tile access.

unsigned int TeRasterMemManager::bandsNmb_`[protected]`

The number of bands (default:0).

std::vector< unsigned int > TeRasterMemManager::bandsTileSizes_`[protected]`

A vector of tiles sizes for each band.

DiskTileDataVecT TeRasterMemManager::diskTilesDataVec_`[protected]`

Disk tiles data vector.

unsigned int TeRasterMemManager::getTilePointer_reqTileIdx_`[protected]`

unsigned int TeRasterMemManager::getTilePointer_swapTileIdx_`[protected]`

TilePtrT TeRasterMemManager::getTilePointer_tilePtr_`[protected]`

unsigned char TeRasterMemManager::maxMemPercentUsage_`[protected]`

the max amount of free memory to use when necessary (default:50).

unsigned long int TeRasterMemManager::maxTempFileSize_`[protected]`

The the maximum temp file size in bytes (default:2GB).

unsigned int TeRasterMemManager::nextSwapTileRamTilesIndexesVecIdx_`[protected]`

The index inside ramTilesIndexesVec_ of the next RAM tile index that will be swapped to disk when a disk tile is required.

OpenDiskFilesVecT TeRasterMemManager::openDiskFilesVec_`[protected]`

Openend disk files data vector.

std::vector< unsigned int > TeRasterMemManager::ramTilesIndexesVec_`[protected]`

The indexes inside allTilesPtrsVec_ of all RAM tiles.

TilePtrT TeRasterMemManager::swapTilePtr_`[protected]`

A pointer to the auxiliar tile used when swapping data to/from disk.

unsigned int TeRasterMemManager::tilesPerBand_`[protected]`

Tiles per band (default:0).

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeRasterMemManager.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeRasterMemManager.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines