X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FIOEvent.hh;h=f4b2e77d857d98a7373a71389c07c605ae0d6b16;hb=9bfe0b87be0926193b5baf13865cf045f0de0b0d;hp=a61dec521e002f39e12d160f07f1e13375d16e4d;hpb=9e64a6d6a4840325f74502ba959ebd56fbb8441c;p=senf.git diff --git a/PPI/IOEvent.hh b/PPI/IOEvent.hh index a61dec5..f4b2e77 100644 --- a/PPI/IOEvent.hh +++ b/PPI/IOEvent.hh @@ -27,8 +27,8 @@ #define HH_IOEvent_ 1 // Custom includes +#include "../Scheduler/Scheduler.hh" #include "Events.hh" -#include "Scheduler/Scheduler.hh" //#include "IOEvent.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -36,14 +36,34 @@ namespace senf { namespace ppi { + /** \brief IOEvent event information + + Information passed to the IOEvent event handler + */ struct IOEventInfo { - unsigned events; + unsigned events; ///< Type of event signaled + /**< The value is a combination of the flags from + IOEvent::EventFlags */ }; - /** \brief + /** \brief FileHandle based I/O read/write event + + 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 - \fixme Implement error/EOF handling + \ingroup event_group */ class IOEvent : public EventImplementation @@ -52,8 +72,16 @@ namespace ppi { /////////////////////////////////////////////////////////////////////////// // Types - enum EventFlags { Read = Scheduler::EV_READ, - Write = Scheduler::EV_WRITE }; + // 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 /**< 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 @@ -65,11 +93,21 @@ namespace ppi { ///@} /////////////////////////////////////////////////////////////////////////// + /** \brief Unhandled error condition */ + struct ErrorException : public std::exception + { virtual char const * what() const throw() + { return "senf::ppi::IOEvent::ErrorException"; } }; + + /** \brief Unhandled hangup condition */ + struct HangupException : public std::exception + { virtual char const * what() const throw() + { return "senf::ppi::IOEvent::HangupException"; } }; + protected: private: virtual void v_enable(); - virtual void v_disable(); + virtual void v_disable(); void cb(int, Scheduler::EventId event);