ARToolKitPlus::MemoryManager Class Reference

MemoryManager defines a basic interface for a custom memory manager to be uses by ARToolKitPlus. More...

#include <MemoryManager.h>

List of all members.

Public Member Functions

virtual bool init (size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0
 The MemoryManager will allocate an initial amount of memory.
virtual bool deinit ()=0
 Releases all memory alloced previously.
virtual bool didInit ()=0
 Returns true if the MemoryManager was already initialized.
virtual void * getMemory (size_t nNumBytes)=0
 Reserves nNumBytes from previously allocated memory.
virtual void releaseMemory (void *nMemoryBlock)=0
 Releases a memory block that was allocated via getMemory().
virtual unsigned int getBytesAllocated ()=0
 Returns the number of bytes allocated alltogether.

Detailed Description

MemoryManager defines a basic interface for a custom memory manager to be uses by ARToolKitPlus.

In various situations it makes sense to have a custom memory manager rather than using the default new/delete functions provided by the c-runtime. To use a custom memory manager it has to be set using ARToolKitPlus::setMemoryManager() before ARToolKitPlus is instantiated. If no memory manager is set, ARToolKitPlus will use the default new/delete functions.


Member Function Documentation

virtual bool ARToolKitPlus::MemoryManager::deinit (  )  [pure virtual]

Releases all memory alloced previously.

After deinit() has been called getMemory() will not be able to reserve memory anymore. deinit( ) releases all memory allocated previously. It is not required to call releaseMemory() after deinit().

virtual void* ARToolKitPlus::MemoryManager::getMemory ( size_t  nNumBytes  )  [pure virtual]

Reserves nNumBytes from previously allocated memory.

init() hast to be called before getMemory can be invoked.

virtual bool ARToolKitPlus::MemoryManager::init ( size_t  nNumInitialBytes,
size_t  nNumGrowBytes = 0 
) [pure virtual]

The MemoryManager will allocate an initial amount of memory.

Each time the MemoryManager does not have enough memory left for a getMemory() request it will allocate another block of nNumGrowBytes bytes.


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

Generated on Fri Oct 9 12:35:33 2009 for ARToolKitPlus by  doxygen 1.6.1