ucommon
|
Template class to map typed reusable objects into shared memory heap. More...
#include <mapped.h>
Public Member Functions | |
T * | get (void) |
Request a typed reusable object from the free list or mapped space. | |
T * | getLocked (void) |
Used to get a typed object from the reuse pool when the mutex lock is already held. | |
T * | getTimed (timeout_t timeout) |
Request a typed reusable object from the free list or mapped space. | |
void | initialize (void) |
Initialize typed data in mapped array. | |
mapped_reuse (char *name, unsigned number) | |
Construct mapped reuse array of typed objects. | |
operator bool () | |
Check whether there are typed objects available to be allocated. | |
operator T * () | |
Request a typed reusable object from the free list or mapped space. | |
bool | operator! () |
Check whether there are typed objects available to be allocated. | |
T * | operator* () |
Request a typed reusable object from the free list or mapped space by pointer reference. | |
T * | pos (size_t member) |
Get typed object from a specific member offset within the mapped segment. | |
void | release (T *object) |
Used to release a typed object back to the reuse typed object pool. | |
void | removeLocked (T *object) |
Used to return a typed object to the reuse pool when the mutex lock is already held. | |
T * | request (void) |
Request a typed reusable object from the free list or mapped space. |
Template class to map typed reusable objects into shared memory heap.
This is used to construct a read/write heap of objects that are held in a named shared memory segment. Member objects are allocated from a reusable heap but are stored in the shared memory segment as a vector.
ucommon::mapped_reuse< T >::mapped_reuse | ( | char * | name, |
unsigned | number | ||
) | [inline] |
Construct mapped reuse array of typed objects.
This is constructed for read/write access. mapped_view is used in all cases for read-only access to mapped data.
name | of mapped segment to construct. |
number | of objects in the mapped vector. |
T* ucommon::mapped_reuse< T >::get | ( | void | ) | [inline] |
Request a typed reusable object from the free list or mapped space.
This method blocks until an object becomes available.
Reimplemented from ucommon::MappedReuse.
T* ucommon::mapped_reuse< T >::getLocked | ( | void | ) | [inline] |
Used to get a typed object from the reuse pool when the mutex lock is already held.
Reimplemented from ucommon::MappedReuse.
T* ucommon::mapped_reuse< T >::getTimed | ( | timeout_t | timeout | ) | [inline] |
Request a typed reusable object from the free list or mapped space.
This method blocks until an object becomes available from another thread or the timeout expires.
timeout | in milliseconds. |
Reimplemented from ucommon::MappedReuse.
void ucommon::mapped_reuse< T >::initialize | ( | void | ) | [inline] |
ucommon::mapped_reuse< T >::operator bool | ( | ) | [inline] |
Check whether there are typed objects available to be allocated.
Reimplemented from ucommon::MappedMemory.
ucommon::mapped_reuse< T >::operator T * | ( | ) | [inline] |
bool ucommon::mapped_reuse< T >::operator! | ( | ) | [inline] |
Check whether there are typed objects available to be allocated.
Reimplemented from ucommon::MappedMemory.
T* ucommon::mapped_reuse< T >::operator* | ( | ) | [inline] |
T* ucommon::mapped_reuse< T >::pos | ( | size_t | member | ) | [inline] |
void ucommon::mapped_reuse< T >::release | ( | T * | object | ) | [inline] |
void ucommon::mapped_reuse< T >::removeLocked | ( | T * | object | ) | [inline] |
T* ucommon::mapped_reuse< T >::request | ( | void | ) | [inline] |
Request a typed reusable object from the free list or mapped space.
This method does not block or wait.
Reimplemented from ucommon::MappedReuse.