Template class to map typed reusable objects into shared memory heap.
More...
#include <mapped.h>
|
T * | get (void) |
| Request a typed reusable object from the free list or mapped space. More...
|
|
T * | getLocked (void) |
| Used to get a typed object from the reuse pool when the mutex lock is already held. More...
|
|
T * | getTimed (timeout_t timeout) |
| Request a typed reusable object from the free list or mapped space. More...
|
|
void | initialize (void) |
| Initialize typed data in mapped array. More...
|
|
| mapped_reuse (const char *name, unsigned number) |
| Construct mapped reuse array of typed objects. More...
|
|
| operator bool () const |
| Check whether there are typed objects available to be allocated. More...
|
|
| operator T * () |
| Request a typed reusable object from the free list or mapped space. More...
|
|
bool | operator! () const |
| Check whether there are typed objects available to be allocated. More...
|
|
T * | operator* () |
| Request a typed reusable object from the free list or mapped space by pointer reference. More...
|
|
T * | pos (size_t member) |
| Get typed object from a specific member offset within the mapped segment. More...
|
|
void | release (T *object) |
| Used to release a typed object back to the reuse typed object pool. More...
|
|
void | removeLocked (T *object) |
| Used to return a typed object to the reuse pool when the mutex lock is already held. More...
|
|
T * | request (void) |
| Request a typed reusable object from the free list or mapped space. More...
|
|
bool | avail (void) const |
| Check whether there are objects available to be allocated. More...
|
|
ReusableObject * | get (void) |
| Request a reusable object from the free list or mapped space. More...
|
|
ReusableObject * | getLocked (void) |
| Used to get an object from the reuse pool when the mutex lock is already held. More...
|
|
ReusableObject * | getTimed (timeout_t timeout) |
| Request a reusable object from the free list or mapped space. More...
|
|
| MappedReuse (const char *name, size_t size, unsigned count) |
| Construct a named memory segment for use with managed fixed size reusable objects. More...
|
|
void | removeLocked (ReusableObject *object) |
| Used to return an object to the reuse pool when the mutex lock is already held. More...
|
|
ReusableObject * | request (void) |
| Request a reusable object from the free list or mapped space. More...
|
|
|
void | create (const char *fname, unsigned count) |
|
| MappedReuse (size_t osize) |
|
static void | disable (void) |
| An API that allows "disabling" of publishing shared memory maps. More...
|
|
static void | remove (const char *name) |
| Destroy a previously existing memory segment under the specified name. More...
|
|
template<class T>
class ucommon::mapped_reuse< T >
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.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 347 of file mapped.h.
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.
- Parameters
-
name | of mapped segment to construct. |
number | of objects in the mapped vector. |
Definition at line 364 of file mapped.h.
Request a typed reusable object from the free list or mapped space.
This method blocks until an object becomes available.
- Returns
- free typed object.
Definition at line 417 of file mapped.h.
Used to get a typed object from the reuse pool when the mutex lock is already held.
- Returns
- typed object from pool or NULL if exhausted.
Definition at line 451 of file mapped.h.
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.
- Parameters
-
- Returns
- free typed object.
Definition at line 427 of file mapped.h.
Initialize typed data in mapped array.
Assumes default constructor for type.
Definition at line 371 of file mapped.h.
Check whether there are typed objects available to be allocated.
- Returns
- true if objects are available.
Definition at line 378 of file mapped.h.
Request a typed reusable object from the free list or mapped space.
This method blocks until an object becomes available.
- Returns
- free object.
Definition at line 393 of file mapped.h.
Check whether there are typed objects available to be allocated.
- Returns
- true if no more typed objects are available.
Definition at line 385 of file mapped.h.
Request a typed reusable object from the free list or mapped space by pointer reference.
This method blocks until an object becomes available.
- Returns
- free object.
Definition at line 401 of file mapped.h.
Get typed object from a specific member offset within the mapped segment.
- Parameters
-
member | offset from start of segment. Will fault if past end. |
- Returns
- typed object pointer.
Definition at line 409 of file mapped.h.
Used to release a typed object back to the reuse typed object pool.
- Parameters
-
Definition at line 458 of file mapped.h.
Used to return a typed object to the reuse pool when the mutex lock is already held.
- Parameters
-
Definition at line 443 of file mapped.h.
Request a typed reusable object from the free list or mapped space.
This method does not block or wait.
- Returns
- free typed object if available or NULL.
Definition at line 435 of file mapped.h.
The documentation for this class was generated from the following file: