OpenDDS::DCPS::QueueTaskBase< T > Class Template Reference

A simple ACE task that manages a queue of request. More...

#include <QueueTaskBase_T.h>

Inheritance diagram for OpenDDS::DCPS::QueueTaskBase< T >:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::QueueTaskBase< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QueueTaskBase ()
 Constructor.
virtual ~QueueTaskBase ()
 Virtual Destructor.
int add (T &req)
virtual int open (void *=0)
 Activate the worker threads.
virtual int svc ()
 The "mainline" executed by the worker thread.
virtual int close (u_long flag=0)
 Called when the thread exits.
virtual void execute (T &req)=0

Private Types

typedef ACE_SYNCH_MUTEX LockType
typedef ACE_Guard< LockTypeGuardType
typedef ACE_Condition< LockTypeConditionType
typedef ACE_Unbounded_Queue<
T > 
Queue

Private Attributes

LockType lock_
 Lock to protect the "state" (all of the data members) of this object.
Queue queue_
 The request queue.
ConditionType work_available_
bool shutdown_initiated_
 Flag used to initiate a shutdown request to all worker threads.
bool opened_
 Flag used to avoid multiple open() calls.
ACE_thread_t thr_id_
 The id of the thread created by this task.

Detailed Description

template<typename T>
class OpenDDS::DCPS::QueueTaskBase< T >

A simple ACE task that manages a queue of request.


Member Typedef Documentation

template<typename T>
typedef ACE_Condition<LockType> OpenDDS::DCPS::QueueTaskBase< T >::ConditionType [private]

template<typename T>
typedef ACE_Guard<LockType> OpenDDS::DCPS::QueueTaskBase< T >::GuardType [private]

template<typename T>
typedef ACE_SYNCH_MUTEX OpenDDS::DCPS::QueueTaskBase< T >::LockType [private]

template<typename T>
typedef ACE_Unbounded_Queue<T> OpenDDS::DCPS::QueueTaskBase< T >::Queue [private]


Constructor & Destructor Documentation

template<typename T>
OpenDDS::DCPS::QueueTaskBase< T >::QueueTaskBase (  )  [inline]

Constructor.

template<typename T>
virtual OpenDDS::DCPS::QueueTaskBase< T >::~QueueTaskBase (  )  [inline, virtual]

Virtual Destructor.


Member Function Documentation

template<typename T>
int OpenDDS::DCPS::QueueTaskBase< T >::add ( T &  req  )  [inline]

Put the request to the request queue. Returns 0 if successful, -1 otherwise (it has been "rejected" or this task is shutdown).

template<typename T>
virtual int OpenDDS::DCPS::QueueTaskBase< T >::close ( u_long  flag = 0  )  [inline, virtual]

Called when the thread exits.

template<typename T>
virtual void OpenDDS::DCPS::QueueTaskBase< T >::execute ( T &  req  )  [pure virtual]

The subclass should implement this function to handle the dequeued request.

Implemented in OpenDDS::DCPS::SimpleTcpReconnectTask.

template<typename T>
virtual int OpenDDS::DCPS::QueueTaskBase< T >::open ( void *  = 0  )  [inline, virtual]

Activate the worker threads.

template<typename T>
virtual int OpenDDS::DCPS::QueueTaskBase< T >::svc (  )  [inline, virtual]

The "mainline" executed by the worker thread.


Member Data Documentation

template<typename T>
LockType OpenDDS::DCPS::QueueTaskBase< T >::lock_ [private]

Lock to protect the "state" (all of the data members) of this object.

template<typename T>
bool OpenDDS::DCPS::QueueTaskBase< T >::opened_ [private]

Flag used to avoid multiple open() calls.

template<typename T>
Queue OpenDDS::DCPS::QueueTaskBase< T >::queue_ [private]

The request queue.

template<typename T>
bool OpenDDS::DCPS::QueueTaskBase< T >::shutdown_initiated_ [private]

Flag used to initiate a shutdown request to all worker threads.

template<typename T>
ACE_thread_t OpenDDS::DCPS::QueueTaskBase< T >::thr_id_ [private]

The id of the thread created by this task.

template<typename T>
ConditionType OpenDDS::DCPS::QueueTaskBase< T >::work_available_ [private]

Condition used to signal the worker threads that they may be able to find a request in the queue_ that needs to be executed. This condition will be signal()'ed each time a request is added to the queue_, and also when this task is shutdown.


The documentation for this class was generated from the following file:
Generated on Fri Nov 7 09:37:42 2008 for OpenDDS by  doxygen 1.4.7