Simple pool class.
More...
#include <stl_pool.h>
|
| | Pool (size_t granularity, size_t size) |
| | Allocates a pool with size elements each of granularity bytes. More...
|
| |
| | ~Pool () |
| | Checks for emptiness before destructing. More...
|
| |
| size_t | GetGranularity () const |
| | Gets the pool granularity. More...
|
| |
| size_t | GetSize () const |
| | Gets the pool size in elements. More...
|
| |
| size_t | GetUsed () const |
| | Gets the number of elements allocated from pooled storage. More...
|
| |
| size_t | GetOverflow () const |
| | Gets the number of elements allocated from non-pooled storage. More...
|
| |
| void * | Allocate () |
| | Allocates memory from the pool without construction. More...
|
| |
| void | Deallocate (void *block) |
| | Deallocates memory from the pool without destruction. More...
|
| |
| template<typename T > |
| T * | Construct () |
| | Constructs an object from the pool. More...
|
| |
| template<typename T > |
| void | Destroy (T *instance) |
| | Destructs an object back into the pool. More...
|
| |
|
| bool | IsFromPool (void const *instance) const |
| | Returns true if the given instance is from pooled storage. More...
|
| |
§ Pool()
| Pool::Pool |
( |
size_t |
granularity, |
|
|
size_t |
size |
|
) |
| |
Allocates a pool with size elements each of granularity bytes.
§ ~Pool()
Checks for emptiness before destructing.
§ Allocate()
| void * Pool::Allocate |
( |
| ) |
|
Allocates memory from the pool without construction.
§ Construct()
Constructs an object from the pool.
§ Deallocate()
| void Pool::Deallocate |
( |
void * |
block | ) |
|
Deallocates memory from the pool without destruction.
§ Destroy()
template<typename T >
| void Pool::Destroy |
( |
T * |
instance | ) |
|
|
inline |
Destructs an object back into the pool.
§ GetGranularity()
| size_t Pool::GetGranularity |
( |
| ) |
const |
|
inline |
Gets the pool granularity.
§ GetOverflow()
| size_t Pool::GetOverflow |
( |
| ) |
const |
|
inline |
Gets the number of elements allocated from non-pooled storage.
§ GetSize()
| size_t Pool::GetSize |
( |
| ) |
const |
|
inline |
Gets the pool size in elements.
§ GetUsed()
| size_t Pool::GetUsed |
( |
| ) |
const |
|
inline |
Gets the number of elements allocated from pooled storage.
§ IsFromPool()
| bool Pool::IsFromPool |
( |
void const * |
instance | ) |
const |
|
inlineprivate |
Returns true if the given instance is from pooled storage.
§ m_granularity
| size_t Pool::m_granularity |
|
private |
The size of each element in the pool in bytes.
§ m_overflow
| size_t volatile Pool::m_overflow |
|
private |
The number of non-pooled allocations.
§ m_size
The number of elements in pooled storage.
§ m_slots
§ m_storage
§ m_used
| size_t volatile Pool::m_used |
|
private |
The number of pooled allocations.
The documentation for this class was generated from the following files: