irccd
3.0.3
|
Abstract stream interface. More...
#include <stream.hpp>
Public Types | |
using | recv_handler = std::function< void(std::error_code, nlohmann::json)> |
Read completion handler. More... | |
using | send_handler = std::function< void(std::error_code)> |
Write completion handler. More... | |
Public Member Functions | |
stream ()=default | |
virtual | ~stream ()=default |
virtual void | recv (recv_handler handler)=0 |
virtual void | send (const nlohmann::json &json, send_handler handler)=0 |
Abstract stream interface.
Abstract I/O interface that allows reading/writing from a stream in an asynchronous manner.
The derived classes must implement non-blocking recv and send operations.
using irccd::stream::recv_handler = std::function<void (std::error_code, nlohmann::json)> |
Read completion handler.
using irccd::stream::send_handler = std::function<void (std::error_code)> |
Write completion handler.
|
default |
Default constructor.
|
virtualdefault |
Virtual destructor defaulted.
|
pure virtual |
Start asynchronous read.
handler | the handler |
Implemented in irccd::basic_socket_stream< Socket >, irccd::basic_socket_stream< boost::asio::ssl::stream< Socket > >, and irccd::test::mock_stream.
|
pure virtual |
Start asynchronous write.
json | the JSON message |
handler | the handler |
Implemented in irccd::basic_socket_stream< Socket >, irccd::basic_socket_stream< boost::asio::ssl::stream< Socket > >, and irccd::test::mock_stream.