#include <EventHandler.h>
Inheritance diagram for ASSA::EventHandler:
Public Member Functions | |
EventHandler () | |
Constructor. | |
virtual | ~EventHandler () |
Virtual destructor. | |
virtual int | handle_read (int fd) |
Read event callback. | |
virtual int | handle_write (int fd) |
Write handler callback. | |
virtual int | handle_except (int fd) |
Exception handler callback. | |
virtual int | handle_timeout (TimerId tid) |
Timeout handler callback. | |
virtual int | handle_signal (int signum_) |
Signal handler callback. | |
virtual int | handle_close (int fd) |
EOF on peer socket handler callback. | |
virtual void | resetState (void) |
A hook for derived class to reset internal state as needed. | |
void | set_id (const std::string &id_) |
Set EventHandler ID. | |
std::string | get_id () const |
Retrieve EventHandler ID. | |
Protected Attributes | |
std::string | m_id |
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.
ASSA::EventHandler::EventHandler | ( | ) | [inline] |
Constructor.
Definition at line 165 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
00165 : m_id ("EventHandler") 00166 { 00167 trace_with_mask("EventHandler::EventHandler",REACTTRACE); 00168 }
virtual ASSA::EventHandler::~EventHandler | ( | ) | [inline, virtual] |
std::string ASSA::EventHandler::get_id | ( | ) | const [inline] |
Retrieve EventHandler ID.
Definition at line 157 of file EventHandler.h.
References m_id.
Referenced by ASSA::Reactor::dispatchHandler(), ASSA::Timer::dump(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_close(), ASSA::Reactor::registerIOHandler(), ASSA::Reactor::removeHandler(), and ASSA::Reactor::removeIOHandler().
00157 { return m_id; }
int ASSA::EventHandler::handle_close | ( | int | fd | ) | [inline, virtual] |
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::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >, and ASSA::RemoteLogger.
Definition at line 212 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::removeHandler(), and ASSA::Reactor::removeIOHandler().
00213 { 00214 trace_with_mask("EventHandler::handle_close",REACTTRACE); 00215 return -1; 00216 }
int ASSA::EventHandler::handle_except | ( | int | fd | ) | [inline, virtual] |
Exception handler callback.
Definition at line 188 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
00189 { 00190 trace_with_mask("EventHandler::handle_except",REACTTRACE); 00191 return -1; 00192 }
int ASSA::EventHandler::handle_read | ( | int | fd | ) | [inline, virtual] |
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 172 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
00173 { 00174 trace_with_mask("EventHandler::handle_read",REACTTRACE); 00175 return -1; 00176 }
int ASSA::EventHandler::handle_signal | ( | int | signum_ | ) | [inline, virtual] |
Signal handler callback.
Reimplemented in ASSA::ChildStatusHandler, ASSA::GenServer, ASSA::SIGINTHandler, ASSA::SIGUSR1Handler, ASSA::SIGUSR2Handler, ASSA::SIGCHLDHandler, ASSA::SIGALRMHandler, ASSA::SIGPOLLHandler, and ASSA::CFUNC_Handler.
Definition at line 204 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::SigHandlers::dispatch(), and ASSA::SigHandler::dispatch().
00205 { 00206 trace_with_mask("EventHandler::handle_signal",REACTTRACE); 00207 return -1; 00208 }
int ASSA::EventHandler::handle_timeout | ( | TimerId | tid | ) | [inline, virtual] |
Timeout handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >.
Definition at line 196 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::TimerQueue::expire().
00197 { 00198 trace_with_mask("EventHandler::handle_timeout",REACTTRACE); 00199 return -1; 00200 }
int ASSA::EventHandler::handle_write | ( | int | fd | ) | [inline, virtual] |
Write handler callback.
Reimplemented in ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >.
Definition at line 180 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
Referenced by ASSA::Reactor::dispatch().
00181 { 00182 trace_with_mask("EventHandler::handle_write",REACTTRACE); 00183 return -1; 00184 }
void ASSA::EventHandler::resetState | ( | void | ) | [inline, virtual] |
A hook for derived class to reset internal state as needed.
Reimplemented in ASSA::SIGINTHandler, ASSA::SIGUSR1Handler, ASSA::SIGUSR2Handler, ASSA::SIGCHLDHandler, and ASSA::SIGALRMHandler.
Definition at line 220 of file EventHandler.h.
References ASSA::REACTTRACE, and trace_with_mask.
00221 { 00222 trace_with_mask("EventHandler::reset",REACTTRACE); 00223 }
void ASSA::EventHandler::set_id | ( | const std::string & | id_ | ) | [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().
00153 { m_id = id_; }
std::string ASSA::EventHandler::m_id [protected] |