matador::io_stream Class Referenceabstract

#include <io_stream.hpp>

Inherited by matador::stream_handler.

Public Types

typedef std::function< void(int ec, long nread)> t_read_handler
 
typedef std::function< void(int ec, long nwrite)> t_write_handler
 

Public Member Functions

virtual void read (buffer_view buf, t_read_handler read_handler)=0
 
virtual void write (std::list< buffer_view > buffers, t_write_handler write_handler)=0
 
virtual void close_stream ()=0
 
virtual tcp::socketstream ()=0
 
virtual std::string name () const =0
 

Detailed Description

The io stream class is proposed to be used with the io_service class and provides therefore an interface which is used by the io_service

Member Typedef Documentation

◆ t_read_handler

typedef std::function<void(int ec, long nread)> matador::io_stream::t_read_handler

Short for function to process read data

◆ t_write_handler

typedef std::function<void(int ec, long nwrite)> matador::io_stream::t_write_handler

Short for function to prepare data to write

Member Function Documentation

◆ close_stream()

virtual void matador::io_stream::close_stream ( )
pure virtual

Closes the stream

Implemented in matador::stream_handler.

◆ name()

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

Returns a name for the io stream.

Returns
Name of the io stream

Implemented in matador::stream_handler.

◆ read()

virtual void matador::io_stream::read ( buffer_view  buf,
t_read_handler  read_handler 
)
pure virtual

This interface is called when data should be read from a socket. Once the date was read the given read handler is called.

Parameters
bufBuffer to read the data in
read_handlerHandler to be called when data was read

Implemented in matador::stream_handler.

◆ stream()

virtual tcp::socket & matador::io_stream::stream ( )
pure virtual

Returns the underlying stream socket

Returns

Implemented in matador::stream_handler.

◆ write()

virtual void matador::io_stream::write ( std::list< buffer_view buffers,
t_write_handler  write_handler 
)
pure virtual

This interface is called when data should be written to a socket. Once the data was written the given write handler is called.

Parameters
buffersList of buffers containing the data to write
write_handlerHandler to be called when the data was written

Implemented in matador::stream_handler.


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