UCommon
|
A reusable private pool of reusable types. More...
#include <vector.h>
Public Member Functions | |
T * | create (void) |
Get a typed object from the pager heap. | |
T * | create (timeout_t timeout) |
Create a typed object from the heap. | |
T * | get (void) |
Get a typed object from the pager heap. | |
T * | get (timeout_t timeout) |
Get a typed object from the heap. | |
operator bool () const | |
Test if typed objects available from the pager or re-use list. | |
operator T * () | |
Get a typed object from the pager heap by pointer reference. | |
bool | operator! () const |
Test if no objects are available for reuse or the pager. | |
T * | operator* () |
Get a typed object from the pager heap by type casting reference. | |
paged_reuse (mempager *pager, unsigned count) | |
Create a managed reusable typed object pool. | |
void | release (T *object) |
Release (return) a typed object back to the pager heap for re-use. | |
T * | request (void) |
Request immediately next available typed object from the pager heap. |
A reusable private pool of reusable types.
A pool of typed objects is created which can be allocated from a memory pager. Deallocated typed objects are also returned to this pool so they can be reallocated later.
ucommon::paged_reuse::paged_reuse | ( | mempager * | pager, |
unsigned | count | ||
) | [inline] |
Create a managed reusable typed object pool.
This manages a heap of typed objects that can either be reused from released objects or allocate from an existing memory pager pool.
pager | pool to allocate from. |
count | of objects of specified type to allocate. |
T* ucommon::paged_reuse::create | ( | void | ) | [inline] |
T* ucommon::paged_reuse::create | ( | timeout_t | timeout | ) | [inline] |
Create a typed object from the heap.
This function blocks until the the heap has an object to return or the timer has expired. The objects default constructor is used.
timeout | to wait for heap in milliseconds. |
T* ucommon::paged_reuse::get | ( | void | ) | [inline] |
Get a typed object from the pager heap.
This function blocks when the heap is empty until an object is returned to the heap.
Reimplemented from ucommon::PagerReuse.
T* ucommon::paged_reuse::get | ( | timeout_t | timeout | ) | [inline] |
Get a typed object from the heap.
This function blocks until the the heap has an object to return or the timer has expired.
timeout | to wait for heap in milliseconds. |
Reimplemented from ucommon::PagerReuse.
ucommon::paged_reuse::operator bool | ( | ) | const [inline] |
ucommon::paged_reuse::operator T * | ( | ) | [inline] |
bool ucommon::paged_reuse::operator! | ( | ) | const [inline] |
T* ucommon::paged_reuse::operator* | ( | ) | [inline] |
void ucommon::paged_reuse::release | ( | T * | object | ) | [inline] |
T* ucommon::paged_reuse::request | ( | void | ) | [inline] |
Request immediately next available typed object from the pager heap.
Reimplemented from ucommon::PagerReuse.