ucommon
|
A templated typed class for thread-safe stack of object pointers. More...
#include <containers.h>
Public Member Functions | |
const T & | at (unsigned offset=0) |
Examine past item in the stack. More... | |
T * | operator() (unsigned offset=0) |
const T & | operator[] (unsigned offset) |
Examine past item in the stack. More... | |
const T * | peek (timeout_t timeout=0) |
Examine last typed object posted to the stack. More... | |
T * | pull (timeout_t timeout=0) |
Get and remove last typed object posted to the stack. More... | |
bool | push (T *object, timeout_t timeout=0) |
Push a typed object into the stack by it's pointer. More... | |
bool | remove (T *object) |
Remove a specific typed object pointer for the stack. More... | |
stackof (mempager *memory, size_t size=0) | |
Create templated stack of typed objects. More... | |
![]() | |
size_t | count (void) |
Get number of object points currently in the stack. More... | |
ObjectProtocol * | get (unsigned offset=0) |
Examine an existing object on the stack. More... | |
const ObjectProtocol * | peek (timeout_t timeout=0) |
ObjectProtocol * | pull (timeout_t timeout=0) |
Get and remove last object pushed on the stack. More... | |
bool | push (ObjectProtocol *object, timeout_t timeout=0) |
Push an object into the stack by it's pointer. More... | |
bool | remove (ObjectProtocol *object) |
Remove a specific object pointer for the queue. More... | |
Stack (mempager *pager=((void *) 0), size_t number=0) | |
Create a stack that uses a memory pager for internally managed member objects for a specified maximum number of object pointers. More... | |
virtual | ~Stack () |
Destroy queue. More... | |
Additional Inherited Members | |
![]() | |
virtual ObjectProtocol * | invalid (void) const |
![]() | |
void | broadcast (void) |
Signal the conditional to release all waiting threads. | |
Conditional () | |
Initialize and construct conditional. | |
void | lock (void) |
Lock the conditional's supporting mutex. | |
void | signal (void) |
Signal the conditional to release one waiting thread. | |
void | unlock (void) |
Unlock the conditional's supporting mutex. | |
bool | wait (timeout_t timeout) |
Conditional wait for signal on millisecond timeout. More... | |
bool | wait (struct timespec *timeout) |
Conditional wait for signal on timespec timeout. More... | |
void | wait (void) |
Wait (block) until signalled. | |
~Conditional () | |
Destroy conditional, release any blocked threads. | |
![]() | |
static pthread_condattr_t * | initializer (void) |
Support function for getting conditional attributes for realtime scheduling. More... | |
static void | set (struct timespec *hires, timeout_t timeout) |
Convert a millisecond timeout into use for high resolution conditional timers. More... | |
![]() | |
size_t | limit |
A templated typed class for thread-safe stack of object pointers.
This allows one to use the stack class in a typesafe manner for a specific object type derived from Object rather than generically for any derived object class.
Definition at line 524 of file containers.h.
|
inline |
Create templated stack of typed objects.
memory | pool for internal use of stack. |
size | of stack to construct. Uses 0 if no size limit. |
Definition at line 532 of file containers.h.
|
inline |
Examine past item in the stack.
This is a typecast of the peek operation.
offset | in stack. |
Definition at line 583 of file containers.h.
|
inline |
Examine past item in the stack.
This is a typecast of the peek operation.
offset | in stack. |
Definition at line 592 of file containers.h.
|
inline |
Examine last typed object posted to the stack.
This can wait for a specified timeout of the stack is empty.
timeout | to wait if empty in milliseconds. |
Definition at line 571 of file containers.h.
|
inline |
Get and remove last typed object posted to the stack.
This can wait for a specified timeout of the stack is empty. The object is still retained and must be released or deleted by the receiving function.
timeout | to wait if empty in milliseconds. |
Definition at line 562 of file containers.h.
|
inline |
Push a typed object into the stack by it's pointer.
This can wait for a specified timeout if the queue is full, for example, for another thread to remove an object pointer. This retains the object.
object | to push. |
timeout | to wait if queue is full in milliseconds. |
Definition at line 552 of file containers.h.
|
inline |
Remove a specific typed object pointer for the stack.
This can remove a member from any location in the stack, whether beginning, end, or somewhere in the middle. This releases the object.
object | to remove. |
Definition at line 541 of file containers.h.