class cvflann::PooledAllocator

Overview

#include <allocator.h>

class PooledAllocator
{
public:
    // fields

    int usedMemory;
    int wastedMemory;

    // construction

    PooledAllocator(int blockSize = BLOCKSIZE);

    // methods

    template <typename T>
    T*
    allocate(size_t count = 1);

    void*
    allocateMemory(int size);
};

Detailed Documentation

Construction

PooledAllocator(int blockSize = BLOCKSIZE)

Default constructor. Initializes a new pool.

Methods

template <typename T>
T*
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

void*
allocateMemory(int size)

Returns a pointer to a piece of new memory of the given size in bytes allocated from the pool.