ionflux.org | Impressum

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

Select based IO event multiplexer. More...

#include <SelectMultiplexer.hpp>

Inheritance diagram for Ionflux::Tools::SelectMultiplexer:

Inheritance graph
[legend]
Collaboration diagram for Ionflux::Tools::SelectMultiplexer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Static Public Member Functions

static void shutdownHandler (int signum)
 Shutdown handler.

Protected Member Functions

virtual void clearEvent (IOEventInfo *eventInfo)
 Clear event.
virtual void clearEvents ()
 Remove events flagged for removal.
virtual void addEvent (IOEventInfo *eventInfo)
 Add event.
virtual void addEvents ()
 Add events flagged for registration.

Protected Attributes

Ionflux::Tools::Reporter log
 Console output/logging.
std::vector< IOEventInfo * > events
 Vector of registered IO events.
std::vector< IOEventInfo * > trash
 Vector of IO events to be removed.
std::vector< IOEventInfo * > newEvents
 Vector of IO events to be added.
FDSet fds
 File descriptor set.
bool running
 Main loop flag.

Static Protected Attributes

static sig_atomic_t shutdown = 0
 Shutdown flag.

Detailed Description

Select based 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.

Note:
The SelectMultiplexer uses the select() method as its underlying IO multiplexing facility.


Constructor & Destructor Documentation

Ionflux::Tools::SelectMultiplexer::SelectMultiplexer  ) 
 

Constructor.

Construct new SelectMultiplexer object.

Ionflux::Tools::SelectMultiplexer::~SelectMultiplexer  )  [virtual]
 

Destructor.

Destruct SelectMultiplexer object.


Member Function Documentation

void Ionflux::Tools::SelectMultiplexer::addEvent IOEventInfo eventInfo  )  [protected, virtual]
 

Add event.

Add an event to the vector of registered events.

Parameters:
eventInfo Event to be added.

void Ionflux::Tools::SelectMultiplexer::addEvents  )  [protected, virtual]
 

Add events flagged for registration.

void Ionflux::Tools::SelectMultiplexer::clearEvent IOEventInfo eventInfo  )  [protected, virtual]
 

Clear event.

Removes an event from the vector of registered events.

Parameters:
eventInfo Event to be removed.

void Ionflux::Tools::SelectMultiplexer::clearEvents  )  [protected, virtual]
 

Remove events flagged for removal.

Reporter & Ionflux::Tools::SelectMultiplexer::getLog  )  [virtual]
 

Get Console output/logging facility.

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

Implements Ionflux::Tools::IOMultiplexer.

bool Ionflux::Tools::SelectMultiplexer::isRunning  )  [virtual]
 

Get running state.

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

Implements Ionflux::Tools::IOMultiplexer.

void Ionflux::Tools::SelectMultiplexer::quit  )  [virtual]
 

Exit main loop.

Call this function to exit from the main loop.

Implements Ionflux::Tools::IOMultiplexer.

void Ionflux::Tools::SelectMultiplexer::registerEvent IOHandler handler,
IOEvent  event
[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..

Implements Ionflux::Tools::IOMultiplexer.

void Ionflux::Tools::SelectMultiplexer::removeEvent IOHandler handler,
IOEvent  event
[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..

Implements Ionflux::Tools::IOMultiplexer.

void Ionflux::Tools::SelectMultiplexer::run  )  [virtual]
 

Main loop.

Watch for registered events.

Implements Ionflux::Tools::IOMultiplexer.

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

Shutdown handler.

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

Parameters:
signum Signal.

Reimplemented from Ionflux::Tools::IOMultiplexer.


Member Data Documentation

std::vector<IOEventInfo *> Ionflux::Tools::SelectMultiplexer::events [protected]
 

Vector of registered IO events.

FDSet Ionflux::Tools::SelectMultiplexer::fds [protected]
 

File descriptor set.

Ionflux::Tools::Reporter Ionflux::Tools::SelectMultiplexer::log [protected]
 

Console output/logging.

std::vector<IOEventInfo *> Ionflux::Tools::SelectMultiplexer::newEvents [protected]
 

Vector of IO events to be added.

bool Ionflux::Tools::SelectMultiplexer::running [protected]
 

Main loop flag.

sig_atomic_t Ionflux::Tools::SelectMultiplexer::shutdown = 0 [static, protected]
 

Shutdown flag.

std::vector<IOEventInfo *> Ionflux::Tools::SelectMultiplexer::trash [protected]
 

Vector of IO events to be removed.


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