libcaf  0.15.5
Public Types | Public Member Functions | List of all members
caf::io::network::asio_stream< Socket > Class Template Reference

A stream capable of both reading and writing. More...

#include <asio_multiplexer.hpp>

Public Types

using manager_ptr = intrusive_ptr< stream_manager >
 A smart pointer to a stream manager.
 
using buffer_type = std::vector< char >
 A buffer class providing a compatible interface to std::vector.
 

Public Member Functions

 asio_stream (asio_multiplexer &ref)
 
Socket & socket_handle ()
 Returns the IO socket.
 
const Socket & socket_handle () const
 Returns the IO socket.
 
void init (Socket fd)
 Initializes this stream, setting the socket handle to fd.
 
void start (stream_manager *mgr)
 Starts reading data from the socket, forwarding incoming data to mgr.
 
void configure_read (receive_policy::config config)
 Configures how much data will be provided for the next consume callback. More...
 
void ack_writes (bool enable)
 
void write (const void *buf, size_t num_bytes)
 Copies data to the write buffer. More...
 
buffer_typewr_buf ()
 Returns the write buffer of this stream. More...
 
buffer_typerd_buf ()
 
void flush (const manager_ptr &mgr)
 Sends the content of the write buffer, calling the io_failure member function of mgr in case of an error. More...
 
void stop ()
 Closes the network connection, thus stopping this stream.
 
void stop_reading ()
 
asio_multiplexerbackend ()
 
void activate (stream_manager *mgr)
 Activates the stream.
 
void passivate ()
 Stops activity of the stream.
 

Detailed Description

template<class Socket>
class caf::io::network::asio_stream< Socket >

A stream capable of both reading and writing.

The stream's input data is forwarded to its manager.

Member Function Documentation

template<class Socket >
void caf::io::network::asio_stream< Socket >::configure_read ( receive_policy::config  config)

Configures how much data will be provided for the next consume callback.

Warning
Must not be called outside the IO multiplexers event loop once the stream has been started.
template<class Socket >
void caf::io::network::asio_stream< Socket >::flush ( const manager_ptr mgr)

Sends the content of the write buffer, calling the io_failure member function of mgr in case of an error.

Warning
Must not be called outside the IO multiplexers event loop once the stream has been started.
template<class Socket >
buffer_type& caf::io::network::asio_stream< Socket >::wr_buf ( )

Returns the write buffer of this stream.

Warning
Must not be modified outside the IO multiplexers event loop once the stream has been started.
template<class Socket >
void caf::io::network::asio_stream< Socket >::write ( const void *  buf,
size_t  num_bytes 
)

Copies data to the write buffer.

Note
Not thread safe.

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