Planeshift
Classes | Public Member Functions

PoolAllocator< TEMPLATE_CLASS > Class Template Reference

#include <poolallocator.h>

List of all members.

Classes

struct  st_freelist_member
 A structure used to track free blocks.
struct  st_pool_entry
 A structure used as a header for each allocation "pool".

Public Member Functions

void CallFromDelete (TEMPLATE_CLASS *obj)
 Places a block back on the list of available blocks. Does NOT release memory back to the heap - ever.
TEMPLATE_CLASS * CallFromNew ()
 Returns a new block from the list of available blocks. Allocates another pool if necessary.
bool PointerCameFromPool (void *ptr)
 PoolAllocator (int items_per_pool=POOLALLOC_DEFAULT_ALLOCATION_OBJECTS)
 PoolAllocator constructor. Sets list heads to NULL and the per-pool object count to the passed value (or default).
 ~PoolAllocator ()
 PoolAllocator destructor. Releases the memory assigned to the pools back to the heap and clears the pool and free lists.

Detailed Description

template<class TEMPLATE_CLASS>
class PoolAllocator< TEMPLATE_CLASS >

Definition at line 80 of file poolallocator.h.


Constructor & Destructor Documentation

template<class TEMPLATE_CLASS>
PoolAllocator< TEMPLATE_CLASS >::PoolAllocator ( int  items_per_pool = POOLALLOC_DEFAULT_ALLOCATION_OBJECTS) [inline]

PoolAllocator constructor. Sets list heads to NULL and the per-pool object count to the passed value (or default).

Definition at line 114 of file poolallocator.h.

template<class TEMPLATE_CLASS>
PoolAllocator< TEMPLATE_CLASS >::~PoolAllocator ( ) [inline]

PoolAllocator destructor. Releases the memory assigned to the pools back to the heap and clears the pool and free lists.

Definition at line 122 of file poolallocator.h.


Member Function Documentation

template<class TEMPLATE_CLASS>
void PoolAllocator< TEMPLATE_CLASS >::CallFromDelete ( TEMPLATE_CLASS *  obj) [inline]

Places a block back on the list of available blocks. Does NOT release memory back to the heap - ever.

Definition at line 164 of file poolallocator.h.

template<class TEMPLATE_CLASS>
TEMPLATE_CLASS* PoolAllocator< TEMPLATE_CLASS >::CallFromNew ( ) [inline]

Returns a new block from the list of available blocks. Allocates another pool if necessary.

Definition at line 139 of file poolallocator.h.

template<class TEMPLATE_CLASS>
bool PoolAllocator< TEMPLATE_CLASS >::PointerCameFromPool ( void *  ptr) [inline]

Definition at line 187 of file poolallocator.h.


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