UCommon
|
A templated typed class for thread-safe queue of object pointers. More...
#include <containers.h>
Public Member Functions | |
T * | fifo (timeout_t timeout=0) |
Get and remove first typed object posted to the queue. | |
T * | lifo (timeout_t timeout=0) |
Get and remove last typed object posted to the queue. | |
T * | operator[] (unsigned offset) |
Examine past item in the queue. | |
T * | peek (unsigned offset=0) |
Examine past item in the queue. | |
bool | post (T *object, timeout_t timeout=0) |
Post a typed object into the queue by it's pointer. | |
queueof (mempager *memory, size_t size=0) | |
Create templated queue of typed objects. | |
bool | remove (T *object) |
Remove a specific typed object pointer for the queue. | |
![]() | |
size_t | getCount (void) |
Get number of object points currently in the queue. | |
bool | post (ObjectProtocol *object, timeout_t timeout=0) |
Post an object into the queue by it's pointer. | |
queue (mempager *pager=((void *) 0), size_t number=0) | |
Create a queue that uses a memory pager for internally managed member objects for a specified maximum number of object pointers. | |
bool | remove (ObjectProtocol *object) |
Remove a specific object pointer for the queue. | |
~queue () | |
Destroy queue. |
Additional Inherited Members | |
![]() | |
static size_t | count (queue &queue) |
Convenience function to get count of objects in the queue. | |
static ObjectProtocol * | fifo (queue &queue, timeout_t timeout=0) |
Convenience function get first object from the queue. | |
static ObjectProtocol * | lifo (queue &queue, timeout_t timeout=0) |
Convenience function get last object from the queue. | |
static bool | post (queue &queue, ObjectProtocol *object, timeout_t timeout=0) |
Convenience function to post object into the queue. | |
static bool | remove (queue &queue, ObjectProtocol *object) |
Convenience function to remove an object from the queue. | |
![]() | |
void | add (OrderedObject *ordered) |
Add an object into the ordered index. | |
LinkedObject * | begin (void) const |
Return first object in list for iterators. | |
unsigned | count (void) const |
Count of objects this list manages. | |
LinkedObject * | end (void) const |
Return last object in list for iterators. | |
LinkedObject * | find (unsigned offset) const |
Find a specific member in the ordered list. | |
LinkedObject * | get (void) |
Get (pull) object off the list. | |
LinkedObject * | getIndexed (unsigned index) const |
Get an indexed member from the ordered index. | |
LinkedObject ** | index (void) const |
Return a pointer to the head of the list. | |
virtual void | lock_index (void) |
Used to synchronize lists managed by multiple threads. | |
LinkedObject * | operator* () const |
Return head object pointer. | |
void | operator*= (OrderedObject *object) |
Add object to our list. | |
OrderedIndex () | |
Create and initialize an empty index. | |
void | purge (void) |
Purge the linked list and then set the index to empty. | |
void | reset (void) |
Reset linked list to empty without purging. | |
virtual void | unlock_index (void) |
Used to synchronize lists managed by multiple threads. | |
virtual | ~OrderedIndex () |
Destroy index. | |
![]() | |
static void | gettimeout (timeout_t timeout, struct timespec *hires) |
Convert a millisecond timeout into use for high resolution conditional timers. | |
static pthread_condattr_t * | initializer (void) |
Support function for getting conditional attributes for realtime scheduling. | |
![]() | |
size_t | limit |
A templated typed class for thread-safe queue of object pointers.
This allows one to use the queue class in a typesafe manner for a specific object type derived from Object rather than generically for any derived object class.
Definition at line 669 of file containers.h.
|
inline |
Create templated queue of typed objects.
memory | pool for internal use by queue. |
size | of queue to construct. Uses 0 if no size limit. |
Definition at line 677 of file containers.h.
|
inline |
Get and remove first typed object posted to the queue.
This can wait for a specified timeut of the queue 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::queue.
Definition at line 707 of file containers.h.
|
inline |
Get and remove last typed object posted to the queue.
This can wait for a specified timeout of the queue 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::queue.
Definition at line 717 of file containers.h.
|
inline |
Examine past item in the queue.
This is a typecast of the peek operation.
offset | in queue. |
Reimplemented from ucommon::queue.
Definition at line 735 of file containers.h.
|
inline |
Examine past item in the queue.
This is a typecast of the peek operation.
offset | in queue. |
Reimplemented from ucommon::queue.
Definition at line 726 of file containers.h.
|
inline |
Post a typed object into the queue 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 post. |
timeout | to wait if queue is full in milliseconds. |
Definition at line 697 of file containers.h.
|
inline |
Remove a specific typed object pointer for the queue.
This can remove a member from any location in the queue, whether beginning, end, or somewhere in the middle. This releases the object.
object | to remove. |
Definition at line 686 of file containers.h.