4 #ifndef _libiqnet_reactor_h_
5 #define _libiqnet_reactor_h_
8 #include "net_except.h"
24 virtual void handle_input(
bool& ) {}
25 virtual void handle_output(
bool& ) {}
38 virtual Socket::Handler get_handler()
const = 0;
49 network_error(
"iqnet::Reactor: no handlers given.",
false ) {}
52 enum Event_mask { INPUT=1, OUTPUT=2 };
60 fd(fd_), mask(0), revents(0) {}
63 fd(fd_), mask(m), revents(0) {}
71 typedef std::list<HandlerState> HandlerStateList;
76 virtual void register_handler(
Event_handler*, Event_mask ) = 0;
77 virtual void unregister_handler(
Event_handler*, Event_mask ) = 0;
83 virtual bool handle_events( Timeout ms = -1 ) = 0;
Base class for event-driven communication classes.
Definition: reactor.h:17
Exception class to wrap a network's subsystem errors.
Definition: net_except.h:21
virtual bool is_stopper() const
If this handler used as Reactor stopper.
Definition: reactor.h:22
virtual void log_unknown_exception()
Log its exception catched in an external object.
Definition: reactor.h:36
virtual void log_exception(const std::exception &)
Log its exception catched in an external object.
Definition: reactor.h:34
virtual void finish()
Definition: reactor.h:29
virtual bool catch_in_reactor() const
Whether reactor should catch its exceptions.
Definition: reactor.h:32