A base class for classes that handle asynchronous socket events. More...
#include <geventhandler.h>
Public Member Functions | |
virtual | ~EventHandler () |
Destructor. More... | |
virtual void | readEvent () |
Called for a read event. More... | |
virtual void | writeEvent () |
Called for a write event. More... | |
virtual void | exceptionEvent () |
Called for an exception event. More... | |
virtual void | onException (std::exception &)=0 |
Called when an exception is thrown out of readEvent(), writeEvent() or exceptionEvent(). More... | |
A base class for classes that handle asynchronous socket events.
An event handler object has its virtual methods called when an event is detected on the associated file descriptor.
If an event handler throws an exception which is caught by the event loop then the event loop calls the handler's onException() method.
A file descriptors and associated event handlers are typically kept in a EventHandlerList container within the EventLoop singleton.
Definition at line 54 of file geventhandler.h.
|
virtual |
Destructor.
Definition at line 31 of file geventhandler.cpp.
|
virtual |
Called for an exception event.
Overridable. The default implementation throws an exception resulting in a call to onException().
Definition at line 45 of file geventhandler.cpp.
|
pure virtual |
Called when an exception is thrown out of readEvent(), writeEvent() or exceptionEvent().
The implementation may just do a "throw" to throw the current exception out of the event loop, or a "delete this" for objects that manage themselves on the heap.
EventHandler objects or timer objects that are sub-objects of other EventHandler objects will normally have their implementation of onException() or onTimeoutException() delgate to the outer object's onException().
Implemented in GNet::ServerPeer, GNet::Server, Main::Run, GNet::ResolverImp, and GNet::HeapClient.
Referenced by GNet::FdSet::raiseEvent().
|
virtual |
Called for a read event.
Overridable. The default implementation does nothing.
Reimplemented in GNet::ServerPeer, GNet::SimpleClient, and GNet::Server.
Definition at line 35 of file geventhandler.cpp.
References G_DEBUG.
|
virtual |
Called for a write event.
Overrideable. The default implementation does nothing.
Reimplemented in GNet::ServerPeer, GNet::SimpleClient, and GNet::Server.
Definition at line 40 of file geventhandler.cpp.
References G_DEBUG.