MemoryManager defines a basic interface for a custom memory manager to be uses by ARToolKitPlus. More...
#include <MemoryManager.h>
Public Member Functions | |
virtual bool | deinit ()=0 |
Releases all memory alloced previously. | |
virtual bool | didInit ()=0 |
Returns true if the MemoryManager was already initialized. | |
virtual unsigned int | getBytesAllocated ()=0 |
Returns the number of bytes allocated alltogether. | |
virtual void * | getMemory (size_t nNumBytes)=0 |
Reserves nNumBytes from previously allocated memory. | |
virtual bool | init (size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0 |
The MemoryManager will allocate an initial amount of memory. | |
virtual void | releaseMemory (void *nMemoryBlock)=0 |
Releases a memory block that was allocated via getMemory() | |
virtual | ~MemoryManager () |
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.
Definition at line 60 of file MemoryManager.h.
virtual ARToolKitPlus::MemoryManager::~MemoryManager | ( | ) | [inline, virtual] |
Definition at line 63 of file MemoryManager.h.
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 bool ARToolKitPlus::MemoryManager::didInit | ( | ) | [pure virtual] |
Returns true if the MemoryManager was already initialized.
virtual unsigned int ARToolKitPlus::MemoryManager::getBytesAllocated | ( | ) | [pure virtual] |
Returns the number of bytes allocated alltogether.
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.
virtual void ARToolKitPlus::MemoryManager::releaseMemory | ( | void * | nMemoryBlock | ) | [pure virtual] |
Releases a memory block that was allocated via getMemory()