matador::handler Class Referenceabstract

#include <handler.hpp>

Inherits std::enable_shared_from_this< handler >.

Inherited by matador::acceptor, matador::connector, and matador::stream_handler.

Public Member Functions

virtual ~handler ()=default
 
virtual void open ()=0
 
virtual socket_type handle () const =0
 
virtual void on_input ()=0
 
virtual void on_output ()=0
 
virtual void on_except ()=0
 
virtual void on_timeout ()=0
 
virtual void on_close ()=0
 
virtual void close ()=0
 
virtual bool is_ready_write () const =0
 
virtual bool is_ready_read () const =0
 
time_t next_timeout () const
 
time_t interval () const
 
virtual std::string name () const =0
 

Protected Member Functions

reactorget_reactor () const
 

Friends

class reactor
 

Detailed Description

Base class for all handlers used with the reactor. The handler must implement its interface to handle input, output, exceptional and timeout data.

Constructor & Destructor Documentation

◆ ~handler()

virtual matador::handler::~handler ( )
virtualdefault

Virtual destructor

Member Function Documentation

◆ close()

virtual void matador::handler::close ( )
pure virtual

Interface implementation should close the handle gracefully

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ get_reactor()

reactor * matador::handler::get_reactor ( ) const
protected

Gets the underlying reactor

Returns
The underlying reactor

◆ handle()

virtual socket_type matador::handler::handle ( ) const
pure virtual

Interface to returns the socket handle of the concrete handler implementation.

Returns
The socket fd

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ interval()

time_t matador::handler::interval ( ) const

Returns the timeout interval in seconds

Returns
Timeout interval

◆ is_ready_read()

virtual bool matador::handler::is_ready_read ( ) const
pure virtual

Interface should return true if there is incoming data

Returns
True if there is incoming data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ is_ready_write()

virtual bool matador::handler::is_ready_write ( ) const
pure virtual

Interface should return true if there is outgoing data

Returns
True if there is outgoing data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ name()

virtual std::string matador::handler::name ( ) const
pure virtual

Get the name of the handler. The name don't need to be unique. It has only an informational purpose.

Returns
The name of the handler

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ next_timeout()

time_t matador::handler::next_timeout ( ) const

Returns the next timeout scheduled in the reactor

Returns
Next timeout

◆ on_close()

virtual void matador::handler::on_close ( )
pure virtual

Interface called when the handler is closed

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ on_except()

virtual void matador::handler::on_except ( )
pure virtual

Interface handling exceptional data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ on_input()

virtual void matador::handler::on_input ( )
pure virtual

Interface handling incoming data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ on_output()

virtual void matador::handler::on_output ( )
pure virtual

Interface handling outgoing data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ on_timeout()

virtual void matador::handler::on_timeout ( )
pure virtual

Interface handling timout data

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.

◆ open()

virtual void matador::handler::open ( )
pure virtual

Interface to open a handler. This is called when a handler is registered within the reactor

Implemented in matador::acceptor, matador::connector, and matador::stream_handler.


The documentation for this class was generated from the following file:
  • matador/net/handler.hpp