A templated typed class for thread-safe stack of object pointers. More...
#include <containers.h>
Public Member Functions | |
T * | pull (timeout_t timeout=0) |
Get and remove last typed object posted to the stack. | |
bool | push (T *object, timeout_t timeout=0) |
Push a typed object into the stack by it's pointer. | |
bool | remove (T *object) |
Remove a specific typed object pointer for the stack. | |
stackof (mempager *memory, size_t size=0) | |
Create templated stack of typed objects. |
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 552 of file containers.h.
ucommon::stackof< T >::stackof | ( | mempager * | memory, | |
size_t | size = 0 | |||
) | [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 560 of file containers.h.
T* ucommon::stackof< T >::pull | ( | timeout_t | timeout = 0 |
) | [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. |
Reimplemented from ucommon::stack.
Definition at line 590 of file containers.h.
bool ucommon::stackof< T >::push | ( | T * | object, | |
timeout_t | timeout = 0 | |||
) | [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 580 of file containers.h.
bool ucommon::stackof< T >::remove | ( | T * | object | ) | [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 569 of file containers.h.