E-MailRelay
|
An EventHandler and ExceptionSink tuple, with methods to raise an event and handle any exceptions. More...
#include <geventemitter.h>
Public Member Functions | |
EventEmitter () noexcept | |
Default constructor. More... | |
EventEmitter (EventHandler *, ExceptionSink) noexcept | |
Constructor. More... | |
void | raiseReadEvent (Descriptor) |
Calls the EventHandler readEvent() method. More... | |
void | raiseWriteEvent (Descriptor) |
Calls the EventHandler writeEvent() method. More... | |
void | raiseOtherEvent (Descriptor, EventHandler::Reason) |
Calls the EventHandler otherEvent() method. More... | |
EventHandler * | handler () const |
Returns the handler, as passed to the ctor. More... | |
ExceptionSink | es () const |
Returns the exception sink, as passed to the ctor. More... | |
void | update (EventHandler *, ExceptionSink) noexcept |
Sets the event handler and the exception sink. More... | |
void | reset () noexcept |
Resets the EventHandler so that the raise methods do nothing. More... | |
void | disarm (ExceptionHandler *) noexcept |
If the exception handler matches then reset it so that it is not called. More... | |
An EventHandler and ExceptionSink tuple, with methods to raise an event and handle any exceptions.
Used in EventLoop implementations. Also sets an appropriate G::LogOutput context while events are being handled.
The event loop should normally instantiate a read emitter and a write emitter for each new file descriptor; any existing emitters should be update()d rather than destructed and constructed, with garbage collection once all the events have been handled.
Definition at line 45 of file geventemitter.h.
|
defaultnoexcept |
Default constructor.
The raise methods do nothing and consequently the exception sink is not used. Postcondition: !handler()
|
noexcept |
Constructor.
Definition at line 31 of file geventemitter.cpp.
|
noexcept |
If the exception handler matches then reset it so that it is not called.
Any exceptions will be thrown out of of the event loop and back to main().
Definition at line 116 of file geventemitter.cpp.
|
inline |
Returns the exception sink, as passed to the ctor.
Definition at line 102 of file geventemitter.h.
|
inline |
Returns the handler, as passed to the ctor.
Definition at line 96 of file geventemitter.h.
void GNet::EventEmitter::raiseOtherEvent | ( | Descriptor | fd, |
EventHandler::Reason | reason | ||
) |
Calls the EventHandler otherEvent() method.
Definition at line 53 of file geventemitter.cpp.
void GNet::EventEmitter::raiseReadEvent | ( | Descriptor | fd | ) |
Calls the EventHandler readEvent() method.
Definition at line 43 of file geventemitter.cpp.
void GNet::EventEmitter::raiseWriteEvent | ( | Descriptor | fd | ) |
Calls the EventHandler writeEvent() method.
Definition at line 48 of file geventemitter.cpp.
|
noexcept |
Resets the EventHandler so that the raise methods do nothing.
Postcondition: !handler()
Definition at line 111 of file geventemitter.cpp.
|
noexcept |
Sets the event handler and the exception sink.
Definition at line 37 of file geventemitter.cpp.