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

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

#include <thread.h>

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

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

Collaboration graph
[legend]

Public Member Functions

 stackof (size_t size=0)
 Create templated stack of typed objects.
bool remove (T *object)
 Remove a specific typed object pointer for the stack.
bool push (T *object, timeout_t timeout=0)
 Push a typed object into the stack by it's pointer.
T * pull (timeout_t timeout=0)
 Get and remove last typed object posted to the stack.

Detailed Description

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

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.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 2173 of file thread.h.


Constructor & Destructor Documentation

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

Create templated stack of typed objects.

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

Definition at line 2180 of file thread.h.


Member Function Documentation

template<class T , mempager * P = NULL>
T* ucc::stackof< T, P >::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.

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

Reimplemented from ucc::stack.

Definition at line 2210 of file thread.h.

Here is the call graph for this function:

template<class T , mempager * P = NULL>
bool ucc::stackof< T, P >::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.

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

Definition at line 2200 of file thread.h.

Here is the call graph for this function:

template<class T , mempager * P = NULL>
bool ucc::stackof< T, P >::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.

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

Definition at line 2189 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:36 2009 for UCommon by  doxygen 1.5.8