#include <allocator.h>
Public Member Functions | |
PooledAllocator (int blocksize=BLOCKSIZE) | |
~PooledAllocator () | |
void * | allocateBytes (int size) |
template<typename T > | |
T * | allocate (size_t count=1) |
Public Attributes | |
int | usedMemory |
int | wastedMemory |
cvflann::PooledAllocator::PooledAllocator | ( | int | blocksize = BLOCKSIZE |
) |
Default constructor. Initializes a new pool.
cvflann::PooledAllocator::~PooledAllocator | ( | ) |
Destructor. Frees all the memory allocated in this pool.
void* cvflann::PooledAllocator::allocateBytes | ( | int | size | ) |
Returns a pointer to a piece of new memory of the given size in bytes allocated from the pool.
T* cvflann::PooledAllocator::allocate | ( | size_t | count = 1 |
) |
Allocates (using this pool) a generic type T.
Params: count = number of instances to allocate. Returns: pointer (of type T*) to memory buffer