| TerraLib 4.1

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

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

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
TeMappedMemory Class Reference
General purpose utilitary functions

This is class deals with mapped memory resources. More...

`#include <TeMappedMemory.h>`

List of all members.

## Public Types

typedef TeSharedPtr < TeMappedMemory > | pointer
typedef const TeSharedPtr < TeMappedMemory > | const_pointer

## Public Member Functions

| TeMappedMemory ()
| Default Constructor.
| ~TeMappedMemory ()
| Default Destructor.
void | reset ()
| Reset the current instance (free all allocated resources).
bool | reset (unsigned long int size, bool enabled)
| Reset the current instance to new size.
bool | reset (const std::string &filename, unsigned long int size, bool keep_disk_file, bool enabled)
| Reset the current instance using a new created disk file.
bool | reset (const std::string &filename, bool enabled)
| Reset the current instance using an exising disk file.
bool | toggle (bool enabled)
| Enable / disable the current mapping instance.
void * | getPointer () const
| Returns a pointer reference to the mapped memory.
std::string | getFileName () const
| Returns the current mapped file name.
unsigned long int | size () const
| The current allocated mapped memory size (bytes).

## Protected Member Functions

void | init ()
| Initiates the global initial state.
bool | createNewDiskFile (const std::string &filename, unsigned long int size) const
| Create a new disk file suitable for memory mapping.
std::string | getLastErrorStr ()
| Generate the last error string.

## Protected Attributes

bool | mapping_is_active_
| A flag indicating when this map is active.
std::string | disk_file_name_
| The disk file name.
unsigned long int | curr_size_
| The current mapped memory size.
bool | must_delete_file_
| True if the mapped file must be deleted.

## Detailed Description

This is class deals with mapped memory resources.

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

## Member Typedef Documentation

typedef const TeSharedPtr< TeMappedMemory > TeMappedMemory::const_pointer

typedef TeSharedPtr< TeMappedMemory > TeMappedMemory::pointer

## Constructor & Destructor Documentation

TeMappedMemory::TeMappedMemory | ( |  | ) |

Default Constructor.

TeMappedMemory::~TeMappedMemory | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TeMappedMemory::createNewDiskFile | ( | const std::string & | filename,
|  | unsigned long int | size
| ) |  | const`[protected]`

Create a new disk file suitable for memory mapping.

Parameters:

  filename | The file name.
  size | The file size.

Returns:
  true if OK. false on errors.

std::string TeMappedMemory::getFileName | ( |  | ) | const

Returns the current mapped file name.

Returns:
  The current mapped file name.

Note:
  Throws an exception if no mapped memory is active.

std::string TeMappedMemory::getLastErrorStr | ( |  | ) | `[protected]`

Generate the last error string.

Returns:
  The last error string.

void * TeMappedMemory::getPointer | ( |  | ) | const

Returns a pointer reference to the mapped memory.

Note:
  Throws an exception if no mapped memory is active.

void TeMappedMemory::init | ( |  | ) | `[protected]`

Initiates the global initial state.

void TeMappedMemory::reset | ( |  | ) |

Reset the current instance (free all allocated resources).

bool TeMappedMemory::reset | ( | const std::string & | filename,
|  | unsigned long int | size,
|  | bool | keep_disk_file,
|  | bool | enabled
| ) |  |

Reset the current instance using a new created disk file.

Note:
  The mapped memory size will follow the disk file size.

Parameters:

  filename | The mapped memory disk file name.
  size | The new mapped memory size (bytes).
  keep_disk_file | if true, the file will not be deleted.
  enabled | Mapping enabled/disabled state.

Returns:
  true if OK. false on errors.

bool TeMappedMemory::reset | ( | unsigned long int | size,
|  | bool | enabled
| ) |  |

Reset the current instance to new size.

Note:
  The mapped memory file will be automatically created.

Parameters:

  size | The new mapped memory size (bytes).
  enabled | Mapping enabled/disabled state.

Returns:
  true if OK. false on errors.

bool TeMappedMemory::reset | ( | const std::string & | filename,
|  | bool | enabled
| ) |  |

Reset the current instance using an exising disk file.

Note:
  The mapped memory size will follow the disk file size.

Parameters:

  filename | The mapped memory disk file name.
  enabled | Mapping enabled/disabled state.

Returns:
  true if OK. false on errors.

unsigned long int TeMappedMemory::size | ( | void |  | ) | const

The current allocated mapped memory size (bytes).

Returns:
  The current allocated mapped memory size (bytes).

bool TeMappedMemory::toggle | ( | bool | enabled | ) |

Enable / disable the current mapping instance.

Returns:
  true if OK. false on errors.

## Member Data Documentation

unsigned long int TeMappedMemory::curr_size_`[protected]`

The current mapped memory size.

Note:
  Default value : 0.

std::string TeMappedMemory::disk_file_name_`[protected]`

The disk file name.

Note:
  Default value : empty string.

bool TeMappedMemory::mapping_is_active_`[protected]`

A flag indicating when this map is active.

Note:
  Default value : false.

bool TeMappedMemory::must_delete_file_`[protected]`

True if the mapped file must be deleted.

Note:
  Default value : false.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines