ionflux.org | Impressum

Ionflux::Tools::IOMultiplexer Class Reference
[I/O Multiplexing]

IO event multiplexer. More...

#include <IOMultiplexer.hpp>

Inheritance diagram for Ionflux::Tools::IOMultiplexer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 IOMultiplexer ()
 Constructor.
virtual ~IOMultiplexer ()
 Destructor.
virtual void registerEvent (IOHandler *handler, IOEvent event)=0
 Register IO event.
virtual void removeEvent (IOHandler *handler, IOEvent event)=0
 Remove IO event.
virtual void run ()=0
 Main loop.
virtual void quit ()=0
 Exit main loop.
virtual bool isRunning ()=0
 Get running state.
virtual int getType ()
 Get type.
virtual ReportergetLog ()=0
 Get Console output/logging facility.

Static Public Member Functions

static void shutdownHandler (int signum)
 Shutdown handler.

Static Public Attributes

static const int IOM_TYPE_UNDEFINED = 0
 IO multiplexer type ID: Undefined.
static const int IOM_TYPE_SELECT = 1
 IO multiplexer type ID: Select multiplexer.
static const int IOM_TYPE_GLIB = 2
 IO multiplexer type ID: Glib multiplexer.

Protected Attributes

int type
 IO multiplexer type ID.

Detailed Description

IO event multiplexer.

A multiplexer for IO events. If a specified event is ready to be processed, the IO multiplexer notifies the associated IO handler. For example, an IOHandler may be called if a file descriptor is ready for reading.

To register an event, you set a file descriptor and a mask of event types which the IO handler should be notified of. You then call IOMultiplexer::registerEvent() with a pointer to an IOHandler and the event object. To remove (unregister) an event, call IOMultiplexer::removeEvent() with the same handler and event object.


Constructor & Destructor Documentation

Ionflux::Tools::IOMultiplexer::IOMultiplexer  ) 
 

Constructor.

Construct new IOMultiplexer object.

virtual Ionflux::Tools::IOMultiplexer::~IOMultiplexer  )  [inline, virtual]
 

Destructor.

Destruct IOMultiplexer object.


Member Function Documentation

virtual Reporter& Ionflux::Tools::IOMultiplexer::getLog  )  [pure virtual]
 

Get Console output/logging facility.

Returns:
The console output/logging facility used by this object.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

int Ionflux::Tools::IOMultiplexer::getType  )  [virtual]
 

Get type.

Returns the IO multiplexer type ID.

Note:
The type ID may be used by applications to improve behaviour based on the type of multiplexer used, but each application should be able to handle any IO multiplexer type gracefully, regardless of whether its ID is recognized or not.
Returns:
The type ID of the IO multiplexer.

virtual bool Ionflux::Tools::IOMultiplexer::isRunning  )  [pure virtual]
 

Get running state.

Returns:
true if the main loop is running, false otherwise.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

virtual void Ionflux::Tools::IOMultiplexer::quit  )  [pure virtual]
 

Exit main loop.

Call this function to exit from the main loop.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

virtual void Ionflux::Tools::IOMultiplexer::registerEvent IOHandler handler,
IOEvent  event
[pure virtual]
 

Register IO event.

Register an IO event to be handled by the multiplexer.

Parameters:
handler IO handler to be notified if the event occurs.
event IO event.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

virtual void Ionflux::Tools::IOMultiplexer::removeEvent IOHandler handler,
IOEvent  event
[pure virtual]
 

Remove IO event.

Remove an IO event from the set of events handled by the multiplexer.

Parameters:
handler IO handler for which the event has been registered.
event IO event.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

virtual void Ionflux::Tools::IOMultiplexer::run  )  [pure virtual]
 

Main loop.

Start the main loop to watch for registered events.

Implemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.

void Ionflux::Tools::IOMultiplexer::shutdownHandler int  signum  )  [static]
 

Shutdown handler.

Signal handler for signals that will cause the main loop to exit.

Parameters:
signum Signal.

Reimplemented in Ionflux::Tools::GlibMultiplexer, and Ionflux::Tools::SelectMultiplexer.


Member Data Documentation

const int Ionflux::Tools::IOMultiplexer::IOM_TYPE_GLIB = 2 [static]
 

IO multiplexer type ID: Glib multiplexer.

const int Ionflux::Tools::IOMultiplexer::IOM_TYPE_SELECT = 1 [static]
 

IO multiplexer type ID: Select multiplexer.

const int Ionflux::Tools::IOMultiplexer::IOM_TYPE_UNDEFINED = 0 [static]
 

IO multiplexer type ID: Undefined.

int Ionflux::Tools::IOMultiplexer::type [protected]
 

IO multiplexer type ID.


The documentation for this class was generated from the following files:
Generated on Tue Mar 14 21:08:30 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6