TPProto::EventLoop Class Reference

Interface to the client's event loop. More...

#include <eventloop.h>

Inheritance diagram for TPProto::EventLoop:

TPProto::SimpleEventLoop List of all members.

Public Member Functions

virtual ~EventLoop ()
virtual void listenForSocketRead (TPSocket *sock)=0
 Gives a TPSocket to the event loop to be alerted when it's ready to read.
virtual void listenForSocketWrite (TPSocket *sock)=0
 Gives a TPSocket to the event loop to be alerted when it's ready to write.
virtual TimerConnection setTimer (uint32_t interval, const TimerSignal::slot_type &callback)=0
 Sets up a timer to call in a given interval.

Detailed Description

Interface to the client's event loop.

This class should be subclassed in every client to provide a way of integrating with the existing event loop, or a new event loop if required.


Constructor & Destructor Documentation

virtual TPProto::EventLoop::~EventLoop (  )  [inline, virtual]

Required virtual destructor.


Member Function Documentation

virtual void TPProto::EventLoop::listenForSocketRead ( TPSocket sock  )  [pure virtual]

Gives a TPSocket to the event loop to be alerted when it's ready to read.

This needs to be implemented to have the TPSocket::isReadyToRead() method called when there is data waiting for the socket.

The socket is removed when it is disconnected.

Parameters:
sock The TPSocket to check

Implemented in TPProto::SimpleEventLoop.

virtual void TPProto::EventLoop::listenForSocketWrite ( TPSocket sock  )  [pure virtual]

Gives a TPSocket to the event loop to be alerted when it's ready to write.

This needs to be implemented to have the TPSocket::isReadyToSend() method called when the socket is ready to send data.

This is a single shot, and should be disabled from from being triggered again <emph>before</emph> calling TPSocket::isReadyToSend().

Parameters:
sock The TPSocket to check

Implemented in TPProto::SimpleEventLoop.

virtual TimerConnection TPProto::EventLoop::setTimer ( uint32_t  interval,
const TimerSignal::slot_type &  callback 
) [pure virtual]

Sets up a timer to call in a given interval.

Parameters:
interval The time interval before calling, in seconds
callback The slot/callback to call when the timer expires.
Returns:
A TimerConnection to be managed by the caller.

Implemented in TPProto::SimpleEventLoop.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 01:30:47 2009 for libtpproto-cpp by  doxygen 1.5.1