ug4
|
Public Member Functions | |
void * | allocate (std::size_t blockSize) |
returns 0 if no more blocks are available. More... | |
void | deallocate (void *p, std::size_t blockSize) |
deallocates the given pointer. More... | |
void | free () |
call this method instead of a destructor More... | |
void | init (std::size_t blockSize, unsigned char numBlocks) |
be careful. numBlocks has to be <= 255. More... | |
Public Attributes | |
unsigned char | m_firstAvailableBlock |
unsigned char | m_numAvailableBlocks |
unsigned char * | m_pData |
The Chunk structure has to be used with great care. A represents is a block of memory, in which it allocates small objects. Be sure that the blockSize used in the calls is the same for all calls to an instance.
void * FixedAllocator::Chunk::allocate | ( | std::size_t | blockSize | ) |
returns 0 if no more blocks are available.
Referenced by FixedAllocator::allocate().
void FixedAllocator::Chunk::deallocate | ( | void * | p, |
std::size_t | blockSize | ||
) |
deallocates the given pointer.
Make sure that p was allocated by the same instance on which you call deallocate.
References p.
Referenced by FixedAllocator::deallocate().
void FixedAllocator::Chunk::free | ( | ) |
call this method instead of a destructor
void FixedAllocator::Chunk::init | ( | std::size_t | blockSize, |
unsigned char | numBlocks | ||
) |
be careful. numBlocks has to be <= 255.
References m_firstAvailableBlock, m_numAvailableBlocks, m_pData, and p.
Referenced by FixedAllocator::allocate().
unsigned char FixedAllocator::Chunk::m_firstAvailableBlock |
Referenced by init().
unsigned char FixedAllocator::Chunk::m_numAvailableBlocks |
Referenced by FixedAllocator::allocate(), FixedAllocator::deallocate(), and init().
unsigned char* FixedAllocator::Chunk::m_pData |
Referenced by init(), and FixedAllocator::pointer_is_in_chunk().