ucc::queueof< T, P > Class Template Reference

A templated typed class for thread-safe queue of object pointers. More...

#include <thread.h>

Inheritance diagram for ucc::queueof< T, P >:

Inheritance graph
[legend]
Collaboration diagram for ucc::queueof< T, P >:

Collaboration graph
[legend]

Public Member Functions

 queueof (size_t size=0)
 Create templated queue of typed objects.
bool remove (T *object)
 Remove a specific typed object pointer for the queue.
bool post (T *object, timeout_t timeout=0)
 Post a typed object into the queue by it's pointer.
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.

Detailed Description

template<class T, mempager * P = NULL>
class ucc::queueof< T, P >

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.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 2114 of file thread.h.


Constructor & Destructor Documentation

template<class T , mempager * P = NULL>
ucc::queueof< T, P >::queueof ( size_t  size = 0  )  [inline]

Create templated queue of typed objects.

Parameters:
size of queue to construct. Uses 0 if no size limit.

Definition at line 2121 of file thread.h.


Member Function Documentation

template<class T , mempager * P = NULL>
T* ucc::queueof< T, P >::fifo ( timeout_t  timeout = 0  )  [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.

Parameters:
timeout to wait if empty in milliseconds.
Returns:
object from queue or NULL if empty and timed out.

Reimplemented from ucc::queue.

Definition at line 2151 of file thread.h.

template<class T , mempager * P = NULL>
T* ucc::queueof< T, P >::lifo ( timeout_t  timeout = 0  )  [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.

Parameters:
timeout to wait if empty in milliseconds.
Returns:
object from queue or NULL if empty and timed out.

Reimplemented from ucc::queue.

Definition at line 2161 of file thread.h.

template<class T , mempager * P = NULL>
bool ucc::queueof< T, P >::post ( T *  object,
timeout_t  timeout = 0 
) [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.

Parameters:
object to post.
timeout to wait if queue is full in milliseconds.
Returns:
true if object posted, false if queue full and timeout expired.

Definition at line 2141 of file thread.h.

template<class T , mempager * P = NULL>
bool ucc::queueof< T, P >::remove ( T *  object  )  [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.

Parameters:
object to remove.
Returns:
true if object was removed, false if not found.

Definition at line 2130 of file thread.h.

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Wed May 13 09:18:35 2009 for UCommon by  doxygen 1.5.8