X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FIOEvent.hh;h=d2f952819a3fb89806b3ddecef3663066e5b47c7;hb=6ba573a99f93543ee32292f79865751b3e9b89a4;hp=ad239b864d623093eead5d4a46c59ae6345318fd;hpb=53a3d02e7fde841badf42555eba87ccef4566073;p=senf.git diff --git a/PPI/IOEvent.hh b/PPI/IOEvent.hh index ad239b8..d2f9528 100644 --- a/PPI/IOEvent.hh +++ b/PPI/IOEvent.hh @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -27,8 +27,9 @@ #define HH_IOEvent_ 1 // Custom includes -#include "Scheduler/Scheduler.hh" +#include "../Scheduler/Scheduler.hh" #include "Events.hh" +#include "../Utils/Exception.hh" //#include "IOEvent.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -52,6 +53,15 @@ namespace ppi { An IOEvent is signaled, whenever the FileHandle \a handle becomes readable or writable. The type of event is specified using the \a events mask with values from EventFlags. + There are two types of flags: + + \li Event flags (\ref Read, \ref Prio, \ref Write) specify the type of event. The + callback will be called whenever one of the specified events occurs on the filehandle + \li Error flags (\ref Hup, \ref Err) specify some type of error condition on the + filehandle. If you specify an error flag when registering the event, the error condition + will be passed to the callback, otherwise an ErrorException or HangupException will be + thrown. + \see IOEventInfo \ingroup event_group @@ -66,11 +76,13 @@ namespace ppi { // This is stupid, however there is no way to import the Scheduler::EventId enum together // with the enumeration symbols - enum EventFlags { Read = Scheduler::EV_READ, - Prio = Scheduler::EV_PRIO, - Write = Scheduler::EV_WRITE, - Hup = Scheduler::EV_HUP, - Err = Scheduler::EV_ERR }; + enum EventFlags { + Read = Scheduler::EV_READ /**< FileHandle is readable */ + , Prio = Scheduler::EV_PRIO /**< FileHandle priority data is readable */ + , Write = Scheduler::EV_WRITE /**< FileHandle is writable */ + , Hup = Scheduler::EV_HUP /**< Hangup condition on FileHandle */ + , Err = Scheduler::EV_ERR /**< Some other error condition on FileHandle */ + }; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -83,14 +95,12 @@ namespace ppi { /////////////////////////////////////////////////////////////////////////// /** \brief Unhandled error condition */ - struct ErrorException : public std::exception - { virtual char const * what() const throw() - { return "senf::ppi::IOEvent::ErrorException"; } }; + struct ErrorException : public senf::Exception + { ErrorException() : senf::Exception("senf::ppi::IOEvent::ErrorException"){} }; /** \brief Unhandled hangup condition */ - struct HangupException : public std::exception - { virtual char const * what() const throw() - { return "senf::ppi::IOEvent::HangupException"; } }; + struct HangupException : public senf::Exception + { HangupException() : senf::Exception("senf::ppi::IOEvent::HangupException"){} }; protected: @@ -98,7 +108,7 @@ namespace ppi { virtual void v_enable(); virtual void v_disable(); - void cb(int, Scheduler::EventId event); + void cb(Scheduler::EventId event); int fd_; unsigned events_;