libassa
3.5.1
|
EventHandler class. More...
#include <EventHandler.h>
Public Member Functions | |
EventHandler () | |
Constructor. More... | |
virtual | ~EventHandler () |
Virtual destructor. More... | |
virtual int | handle_read (int fd) |
Read event callback. More... | |
virtual int | handle_write (int fd) |
Write handler callback. More... | |
virtual int | handle_except (int fd) |
Exception handler callback. More... | |
virtual int | handle_timeout (TimerId tid) |
Timeout handler callback. More... | |
virtual int | handle_signal (int signum_) |
Signal handler callback. More... | |
virtual int | handle_close (int fd) |
EOF on peer socket handler callback. More... | |
virtual void | resetState (void) |
A hook for derived class to reset internal state as needed. More... | |
void | set_id (const std::string &id_) |
Set EventHandler ID. More... | |
std::string | get_id () const |
Retrieve EventHandler ID. More... | |
Protected Attributes | |
std::string | m_id |
EventHandler class.
EventHandler is a pure virtual class. It is an interface class to the Event Handlers. These events are processed by Reactor. The supported events are signals, timers, and I/O pipes such as file descriptors, sockets and such.
Definition at line 102 of file EventHandler.h.
|
inline |
Constructor.
Definition at line 164 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
|
inlinevirtual |
|
inline |
Retrieve EventHandler ID.
Definition at line 157 of file EventHandler.h.
References m_id.
Referenced by ASSA::Reactor::dispatchHandler(), ASSA::Timer::dump(), ASSA::Reactor::registerIOHandler(), ASSA::Reactor::removeHandler(), and ASSA::Reactor::removeIOHandler().
|
inlinevirtual |
EOF on peer socket handler callback.
There is no corresponding EventType. One is not needed because detecting EOF is a part of handle_read () data processing.
Reimplemented in ASSA::RemoteLogger, and ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >.
Definition at line 211 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::removeHandler(), and ASSA::Reactor::removeIOHandler().
|
inlinevirtual |
Exception handler callback.
Definition at line 187 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
|
inlinevirtual |
Read event callback.
If reader detects EOF, it must return error to the Reactor. (See Reactor for details).
Reimplemented in ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >.
Definition at line 171 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
|
inlinevirtual |
Signal handler callback.
Reimplemented in ASSA::CFUNC_Handler, ASSA::SIGPOLLHandler, ASSA::SIGALRMHandler, ASSA::SIGCHLDHandler, ASSA::SIGUSR2Handler, ASSA::SIGUSR1Handler, ASSA::SIGINTHandler, ASSA::GenServer, and ASSA::ChildStatusHandler.
Definition at line 203 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::SigHandler::dispatch(), and ASSA::SigHandlers::dispatch().
|
inlinevirtual |
Timeout handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >.
Definition at line 195 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::TimerQueue::expire().
|
inlinevirtual |
Write handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >.
Definition at line 179 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
|
inlinevirtual |
A hook for derived class to reset internal state as needed.
Reimplemented in ASSA::SIGALRMHandler, ASSA::SIGCHLDHandler, ASSA::SIGUSR2Handler, ASSA::SIGUSR1Handler, and ASSA::SIGINTHandler.
Definition at line 219 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
|
inline |
Set EventHandler ID.
ID allows Reactor and application-level code describe intelligently the kind of the EventHandler.
Definition at line 153 of file EventHandler.h.
References m_id.
Referenced by ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::Connector().
|
protected |
Definition at line 160 of file EventHandler.h.