qpid::sys::DispatchHandle Class Reference

In order to have your own handle (file descriptor on Unix) watched by the poller you need to:. More...

#include <Dispatcher.h>

Inherits qpid::sys::PollerHandle.

Inherited by qpid::sys::AsynchConnector [private], and qpid::sys::AsynchIO [private].

Collaboration diagram for qpid::sys::DispatchHandle:

Collaboration graph
[legend]

List of all members.

Public Types

typedef boost::function1< void,
DispatchHandle & > 
Callback

Public Member Functions

 DispatchHandle (const IOHandle &h, Callback rCb, Callback wCb, Callback dCb)
 Provide a handle to poll and a set of callbacks.
void startWatch (Poller::shared_ptr poller)
 Add this DispatchHandle to the poller to be watched.
void rewatch ()
 Resume watchingn for all non-0 callbacks.
void rewatchRead ()
 Resume watchingn for read only.
void rewatchWrite ()
 Resume watchingn for write only.
void unwatch ()
 Stop watching temporarily.
void unwatchRead ()
 Stop watching for read.
void unwatchWrite ()
 Stop watching for write.
void stopWatch ()
 Stop watching permanently.

Protected Member Functions

void doDelete ()
 Override to get extra processing done when the DispatchHandle is deleted.


Detailed Description

In order to have your own handle (file descriptor on Unix) watched by the poller you need to:.

When an event occurs on the handle, the poller calls the relevant callback and stops watching that handle. Your callback can call rewatch() or related functions to re-enable polling.

Definition at line 57 of file Dispatcher.h.


Constructor & Destructor Documentation

qpid::sys::DispatchHandle::DispatchHandle ( const IOHandle &  h,
Callback  rCb,
Callback  wCb,
Callback  dCb 
) [inline]

Provide a handle to poll and a set of callbacks.

Note callbacks can be 0, meaning you are not interested in that event.

Parameters:
h,: the handle to watch. The IOHandle encapsulates a platfrom-specific handle to an IO object (e.g. a file descriptor on Unix.)
rCb Callback called when the handle is readable.
wCb Callback called when the handle is writable.
dCb Callback called when the handle is disconnected.

Definition at line 87 of file Dispatcher.h.


Member Function Documentation

void qpid::sys::DispatchHandle::startWatch ( Poller::shared_ptr  poller  ) 

Add this DispatchHandle to the poller to be watched.

Referenced by qpid::sys::PollableQueue< T >::PollableQueue().

void qpid::sys::DispatchHandle::rewatch (  ) 

Resume watchingn for all non-0 callbacks.

Referenced by qpid::sys::PollableQueue< T >::start().

void qpid::sys::DispatchHandle::rewatchRead (  ) 

Resume watchingn for read only.

void qpid::sys::DispatchHandle::rewatchWrite (  ) 

Resume watchingn for write only.

void qpid::sys::DispatchHandle::unwatch (  ) 

Stop watching temporarily.

The DispatchHandle remains associated with the poller and can be re-activated using rewatch.

Referenced by qpid::sys::PollableQueue< T >::PollableQueue(), and qpid::sys::PollableQueue< T >::stop().

void qpid::sys::DispatchHandle::stopWatch (  ) 

Stop watching permanently.

Disassociates from the poller.

void qpid::sys::DispatchHandle::doDelete (  )  [protected]

Override to get extra processing done when the DispatchHandle is deleted.


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

Generated on Thu Oct 16 13:38:39 2008 for Qpid by  doxygen 1.5.6