ucommon
|
An array of reusable types. More...
#include <vector.h>
Public Member Functions | |
array_reuse (unsigned count) | |
Create private heap of reusable objects of specified type. | |
array_reuse (unsigned count, void *memory) | |
Create reusable objects of specific type in preallocated memory. | |
T * | create (void) |
Create a typed object from the heap. | |
T * | create (timeout_t timeout) |
Create a typed object from the heap. | |
T * | get (void) |
Get a typed object from the heap. | |
T * | get (timeout_t timeout) |
Get a typed object from the heap. | |
operator bool () const | |
Test if typed objects available in heap or re-use list. | |
operator T * () | |
Get a typed object from the heap by type casting reference. | |
bool | operator! () const |
Test if the entire heap has been allocated. | |
T * | operator* () |
Get a typed object from the heap by pointer reference. | |
void | release (T *object) |
Release (return) a typed object back to the heap for re-use. | |
T * | request (void) |
Request immediately next available typed object from the heap. |
An array of reusable types.
A pool of typed objects is created which can be allocated as needed. Deallocated typed objects are returned to the pool so they can be reallocated later. This is a private fixed size heap.
ucommon::array_reuse< T >::array_reuse | ( | unsigned | count | ) | [inline] |
ucommon::array_reuse< T >::array_reuse | ( | unsigned | count, |
void * | memory | ||
) | [inline] |
T* ucommon::array_reuse< T >::create | ( | void | ) | [inline] |
T* ucommon::array_reuse< T >::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.
timeout | to wait for heap in milliseconds. |
Definition at line 561 of file vector.h.
T* ucommon::array_reuse< T >::get | ( | void | ) | [inline] |
Get a typed object from the heap.
This function blocks when the heap is empty until an object is returned to the heap.
Reimplemented from ucommon::ArrayReuse.
T* ucommon::array_reuse< T >::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::ArrayReuse.
Definition at line 552 of file vector.h.
ucommon::array_reuse< T >::operator bool | ( | ) | const [inline] |
ucommon::array_reuse< T >::operator T * | ( | ) | [inline] |
bool ucommon::array_reuse< T >::operator! | ( | ) | const [inline] |
T* ucommon::array_reuse< T >::operator* | ( | ) | [inline] |
void ucommon::array_reuse< T >::release | ( | T * | object | ) | [inline] |
T* ucommon::array_reuse< T >::request | ( | void | ) | [inline] |
Request immediately next available typed object from the heap.
Reimplemented from ucommon::ArrayReuse.