From: Christian P. <cp...@us...> - 2005-06-03 09:55:59
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28075/include/pclasses/IO Modified Files: IODevice.h IOListener.h Log Message: - More work on asynchronous I/O Index: IOListener.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IOListener.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IOListener.h 29 May 2005 17:48:31 -0000 1.1 +++ IOListener.h 3 Jun 2005 09:55:44 -0000 1.2 @@ -22,6 +22,7 @@ #define P_IO_IOListener_h #include <pclasses/Export.h> +#include <pclasses/Signal.h> #include <pclasses/IO/IODevice.h> namespace P { @@ -30,22 +31,28 @@ class PIO_EXPORT IOListener { public: - - //! Notify flags - enum NotifyFlags { - NotifyNone = 0x0, - NotifyRead = 0x1, - NotifyWrite = 0x2 + enum EventMask { + NotifyRead = 0x01, + NotifyWrite = 0x02, + NotifyError = 0x04 }; - IOListener(IODevice& dev, int flags = 0); + IOListener(IODevice& dev); virtual ~IOListener(); - virtual int flags() const = 0; - virtual void setFlags(int flags) = 0; + IODevice& device() const throw(); - virtual void onRead() = 0; - virtual void onWrite() = 0; + virtual void setEventMask(int mask) = 0; + virtual int eventMask() const throw() = 0; + + Signal0<void> sigRead; + Signal0<void> sigWrite; + Signal0<void> sigError; + + protected: + virtual void onRead(); + virtual void onWrite(); + virtual void onError(); private: IODevice& _dev; Index: IODevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IODevice.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IODevice.h 29 May 2005 17:48:31 -0000 1.8 +++ IODevice.h 3 Jun 2005 09:55:44 -0000 1.9 @@ -31,7 +31,6 @@ // forward declaration class IOFilter; -class IOListener; //! I/O Device base class /*! @@ -198,14 +197,9 @@ IOFilter* filter() const throw(); protected: - friend class IOListener; - IODevice(const IODevice& dev) throw(); IODevice& operator=(const IODevice& dev) throw(); - virtual void addListener(IOListener*) throw(IOError); - virtual void removeListener(IOListener*) throw(); - //! Called when device should be closed /*! precondition: valid()==true |