irccd  3.0.3
Public Member Functions | List of all members
irccd::basic_socket_stream< Socket > Class Template Reference

Complete implementation for basic sockets. More...

#include <stream.hpp>

Inheritance diagram for irccd::basic_socket_stream< Socket >:
irccd::stream

Public Member Functions

template<typename... Args>
 basic_socket_stream (Args &&... args)
 
auto get_socket () const noexcept -> const Socket &
 
auto get_socket () noexcept -> Socket &
 
void recv (recv_handler handler) override
 
void send (const nlohmann::json &json, send_handler handler) override
 
- Public Member Functions inherited from irccd::stream
 stream ()=default
 
virtual ~stream ()=default
 

Additional Inherited Members

- Public Types inherited from irccd::stream
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...
 

Detailed Description

template<typename Socket>
class irccd::basic_socket_stream< Socket >

Complete implementation for basic sockets.

Template Parameters
SocketBoost.Asio socket (e.g. boost::asio::ip::tcp::socket)

Constructor & Destructor Documentation

◆ basic_socket_stream()

template<typename Socket >
template<typename... Args>
irccd::basic_socket_stream< Socket >::basic_socket_stream ( Args &&...  args)
inline

Construct a socket stream.

Parameters
argsthe arguments to pass to the constructor

Member Function Documentation

◆ get_socket() [1/2]

template<typename Socket >
auto irccd::basic_socket_stream< Socket >::get_socket
inlinenoexcept

Get the underlying socket.

Returns
the socket

◆ get_socket() [2/2]

template<typename Socket >
auto irccd::basic_socket_stream< Socket >::get_socket
inlinenoexcept

Overloaded function.

Returns
the socket

◆ recv()

template<typename Socket >
void irccd::basic_socket_stream< Socket >::recv ( recv_handler  handler)
inlineoverridevirtual

Default implementation for Boost.Asio sockets.

Precondition
another read operation must not be running
handler != nullptr
Parameters
handlerthe handler

Implements irccd::stream.

◆ send()

template<typename Socket >
void irccd::basic_socket_stream< Socket >::send ( const nlohmann::json &  json,
send_handler  handler 
)
inlineoverridevirtual

Default implementation for Boost.Asio sockets.

Precondition
json.is_object()
another write operation must not be running
handler != nullptr
Parameters
jsonthe JSON message
handlerthe handler

Implements irccd::stream.


The documentation for this class was generated from the following file: