PLearn 0.1
|
A PObjectPool is a thin wrapper around PMemPool that provides typed pointers on the allocated memory. More...
#include <PMemPool.h>
Public Member Functions | |
PObjectPool (size_t initial_arena_size, float growth_factor=1.5, bool use_fast_deallocator=true) | |
T * | allocate () |
Allocate raw memory for one object. The object is not constructed. | |
void | deallocate (T *p) |
Deallocate raw memory from the pool. | |
Private Types | |
typedef PMemPool | inherited |
A PObjectPool is a thin wrapper around PMemPool that provides typed pointers on the allocated memory.
Note that NO CONSTRUCTORS OR DESTRUCTORS are ever called on the memory; this remains the responsibility of the caller.
Definition at line 201 of file PMemPool.h.
typedef PMemPool PLearn::PObjectPool< T >::inherited [private] |
Definition at line 203 of file PMemPool.h.
PLearn::PObjectPool< T >::PObjectPool | ( | size_t | initial_arena_size, |
float | growth_factor = 1.5 , |
||
bool | use_fast_deallocator = true |
||
) | [inline] |
Definition at line 206 of file PMemPool.h.
: inherited(sizeof(T), initial_arena_size, growth_factor, use_fast_deallocator) { }
T* PLearn::PObjectPool< T >::allocate | ( | ) | [inline] |
Allocate raw memory for one object. The object is not constructed.
Reimplemented from PLearn::PMemPool.
Definition at line 213 of file PMemPool.h.
Referenced by alloc_from_pool(), PLearn::PythonCodeSnippet::inject(), PLearn::PythonCodeSnippet::injectInternal(), and PLearn::injectPLearnGlobalFunctions().
{ return static_cast<T*>(inherited::allocate()); }
void PLearn::PObjectPool< T >::deallocate | ( | T * | p | ) | [inline] |
Deallocate raw memory from the pool.
The object must have been destroyed prior to calling this function.
Definition at line 217 of file PMemPool.h.
Referenced by alloc_from_pool().
{ inherited::deallocate(p); }