ionflux.org | Impressum

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

Glib based IO event multiplexer. More...

#include <GlibMultiplexer.hpp>

Inheritance diagram for Ionflux::Tools::GlibMultiplexer:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GlibMultiplexer ()
 Constructor.
 GlibMultiplexer (int initArgc, char **initArgv)
 Constructor.
 GlibMultiplexer (int initArgc, char **initArgv, Gtk::Window *initMainWin)
 Constructor.
virtual ~GlibMultiplexer ()
 Destructor.
virtual void registerEvent (IOHandler *handler, IOEvent event)
 Register IO event.
virtual void removeEvent (IOHandler *handler, IOEvent event)
 Remove IO event.
virtual bool processEvent (GlibIOEventInfo *eventInfo, Glib::IOCondition ioCond)
 Process IO event.
virtual void run ()
 Main loop.
virtual void quit ()
 Exit main loop.
virtual bool isRunning ()
 Get running state.
virtual void runHandler ()
 Run handler.
virtual bool quitHandler ()
 Quit handler.
virtual ReportergetLog ()
 Get Console output/logging facility.
virtual void setMainWindow (Gtk::Window *newMainWindow)
 Set application main window.
virtual Gtk::Window * getMainWindow ()
 Get application main window.

Static Public Member Functions

static void shutdownHandler (int signum)
 Shutdown handler.

Protected Member Functions

virtual void clearEvent (GlibIOEventInfo *eventInfo)
 Clear IO event.
virtual void clearEvents ()
 Clear IO events.
virtual void addEvent (GlibIOEventInfo *eventInfo)
 Add IO event.
virtual void addEvents ()
 Add IO events.

Protected Attributes

Ionflux::Tools::Reporter log
 Console output/logging.
std::vector< GlibIOEventInfo * > events
 Vector of registered IO events.
std::vector< GlibIOEventInfo * > trash
 Vector of IO events to be removed.
std::vector< GlibIOEventInfo * > newEvents
 Vector of IO events to be added.
bool running
 Main loop flag.
Gtk::Main * kit
 Gtk Main object.
int argc
 Argument count.
char ** argv
 Argument vector.
Gtk::Window * mainWindow
 Application main window.

Static Protected Attributes

static sig_atomic_t shutdown = 0
 Shutdown flag.

Detailed Description

Glib 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 GlibMultiplexer uses Glib signals as its underlying IO multiplexing facility.


Constructor & Destructor Documentation

Ionflux::Tools::GlibMultiplexer::GlibMultiplexer  ) 
 

Constructor.

Construct new GlibMultiplexer object.

Ionflux::Tools::GlibMultiplexer::GlibMultiplexer int  initArgc,
char **  initArgv
 

Constructor.

Construct new GlibMultiplexer object.

Parameters:
initArgc Argument count.
initArgv Argument vector.

Ionflux::Tools::GlibMultiplexer::GlibMultiplexer int  initArgc,
char **  initArgv,
Gtk::Window *  initMainWin
 

Constructor.

Construct new GlibMultiplexer object.

Parameters:
initArgc Argument count.
initArgv Argument vector.
initMainWin Application main window.

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

Destructor.

Destruct GlibMultiplexer object.


Member Function Documentation

void Ionflux::Tools::GlibMultiplexer::addEvent GlibIOEventInfo eventInfo  )  [protected, virtual]
 

Add IO event.

Adds an event to the vector of registered events.

Parameters:
eventInfo Event to be added.

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

Add IO events.

Adds events flagged for addition to the vector of registered events.

void Ionflux::Tools::GlibMultiplexer::clearEvent GlibIOEventInfo eventInfo  )  [protected, virtual]
 

Clear IO event.

Removes an event from the vector of registered events.

Parameters:
eventInfo Event to be removed.

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

Clear IO events.

Removes events flagged for removal from from the vector of registered events.

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

Get Console output/logging facility.

The console output/logging facility used by this object

Implements Ionflux::Tools::IOMultiplexer.

Gtk::Window * Ionflux::Tools::GlibMultiplexer::getMainWindow  )  [virtual]
 

Get application main window.

return Current value of application main window.

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

Get running state.

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

Implements Ionflux::Tools::IOMultiplexer.

bool Ionflux::Tools::GlibMultiplexer::processEvent GlibIOEventInfo eventInfo,
Glib::IOCondition  ioCond
[virtual]
 

Process IO event.

Processes the event referenced by the specified IO event record.

Note:
This is used by GlibIOEventInfo to propagate event signals. You should not have to use this in any other way.
Parameters:
eventInfo IO event record.
ioCond IO condition.
Returns:
true on success, false otherwise.

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

Exit main loop.

Call this function to exit from the main loop.

Implements Ionflux::Tools::IOMultiplexer.

bool Ionflux::Tools::GlibMultiplexer::quitHandler  )  [virtual]
 

Quit handler.

Event handler for 'quit' signals.

Returns:
true on success, false otherwise.

void Ionflux::Tools::GlibMultiplexer::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::GlibMultiplexer::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::GlibMultiplexer::run  )  [virtual]
 

Main loop.

Start the main loop to watch for registered events.

Implements Ionflux::Tools::IOMultiplexer.

void Ionflux::Tools::GlibMultiplexer::runHandler  )  [virtual]
 

Run handler.

Event handler for 'run' signals.

Returns:
true on success, false otherwise.

void Ionflux::Tools::GlibMultiplexer::setMainWindow Gtk::Window *  newMainWindow  )  [virtual]
 

Set application main window.

Set new value of application main window.

Parameters:
newMainWindow New value of application main window.

void Ionflux::Tools::GlibMultiplexer::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

int Ionflux::Tools::GlibMultiplexer::argc [protected]
 

Argument count.

char** Ionflux::Tools::GlibMultiplexer::argv [protected]
 

Argument vector.

std::vector<GlibIOEventInfo *> Ionflux::Tools::GlibMultiplexer::events [protected]
 

Vector of registered IO events.

Gtk::Main* Ionflux::Tools::GlibMultiplexer::kit [protected]
 

Gtk Main object.

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

Console output/logging.

Gtk::Window* Ionflux::Tools::GlibMultiplexer::mainWindow [protected]
 

Application main window.

std::vector<GlibIOEventInfo *> Ionflux::Tools::GlibMultiplexer::newEvents [protected]
 

Vector of IO events to be added.

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

Main loop flag.

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

Shutdown flag.

std::vector<GlibIOEventInfo *> Ionflux::Tools::GlibMultiplexer::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:08:18 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6