matador::io_service Class Reference

#include <io_service.hpp>

Public Member Functions

 io_service ()
 
void run ()
 
bool is_running () const
 
void shutdown ()
 
template<typename AcceptCallback >
void accept (const std::shared_ptr< acceptor > &ac, const tcp::peer &ep, AcceptCallback accept_callback)
 
template<typename AcceptCallback >
void accept (const std::shared_ptr< acceptor > &ac, AcceptCallback accept_callback)
 
template<typename ConnectCallback >
void connect (const std::shared_ptr< connector > &co, const std::string &port, ConnectCallback connect_callback)
 

Detailed Description

IO Service is used to encapsulate the an instance of the reactor class.

Constructor & Destructor Documentation

◆ io_service()

matador::io_service::io_service ( )

Creates a io_service

Member Function Documentation

◆ accept() [1/2]

template<typename AcceptCallback >
void matador::io_service::accept ( const std::shared_ptr< acceptor > &  ac,
AcceptCallback  accept_callback 
)

Adds the given acceptor for the given callback.

The callback is called, when a new connection was accepted.

Template Parameters
AcceptCallbackType of callback
Parameters
acAcceptor used to accept connections
accept_callbackCallback when connection was accepted

◆ accept() [2/2]

template<typename AcceptCallback >
void matador::io_service::accept ( const std::shared_ptr< acceptor > &  ac,
const tcp::peer ep,
AcceptCallback  accept_callback 
)

Adds the given acceptor for the given peer endpoint and callback.

The callback is called, when a new connection was accepted.

Template Parameters
AcceptCallbackType of callback
Parameters
acAcceptor used to accept connections
epEndpoint on which the acceptor will listen
accept_callbackCallback when connection was accepted

◆ connect()

template<typename ConnectCallback >
void matador::io_service::connect ( const std::shared_ptr< connector > &  co,
const std::string &  port,
ConnectCallback  connect_callback 
)

Add the given connector for the given port and execute callback.

Once a connection is established the callback is called.

Template Parameters
ConnectCallbackType of the callback
Parameters
coConnector Used to establish the connection
portPort to execute to
connect_callbackCallback when connection was established

◆ is_running()

bool matador::io_service::is_running ( ) const

Returns true if the io service is running

Returns
True if service is running

◆ run()

void matador::io_service::run ( )

Starts the io_service with the underlying reactor

◆ shutdown()

void matador::io_service::shutdown ( )

Shuts down a running service


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