Adds buffering to the write-related operations of a stream. More...
#include <buffered_write_stream.hpp>
Classes | |
class | flush_handler |
class | write_some_handler |
Public Types | |
typedef next_layer_type::lowest_layer_type | lowest_layer_type |
The type of the lowest layer. | |
typedef boost::remove_reference < Stream >::type | next_layer_type |
The type of the next layer. | |
Public Member Functions | |
template<typename WriteHandler > | |
void | async_flush (WriteHandler handler) |
Start an asynchronous flush. | |
template<typename MutableBufferSequence , typename ReadHandler > | |
void | async_read_some (const MutableBufferSequence &buffers, ReadHandler handler) |
template<typename ConstBufferSequence , typename WriteHandler > | |
void | async_write_some (const ConstBufferSequence &buffers, WriteHandler handler) |
BOOST_STATIC_CONSTANT (std::size_t, default_buffer_size=1024) | |
template<typename Arg > | |
buffered_write_stream (Arg &a) | |
Construct, passing the specified argument to initialise the next layer. | |
template<typename Arg > | |
buffered_write_stream (Arg &a, std::size_t buffer_size) | |
Construct, passing the specified argument to initialise the next layer. | |
void | close () |
Close the stream. | |
asio::error_code | close (asio::error_code &ec) |
Close the stream. | |
std::size_t | flush () |
std::size_t | flush (asio::error_code &ec) |
asio::io_service & | get_io_service () |
Get the io_service associated with the object. | |
std::size_t | in_avail () |
Determine the amount of data that may be read without blocking. | |
std::size_t | in_avail (asio::error_code &ec) |
Determine the amount of data that may be read without blocking. | |
asio::io_service & | io_service () |
lowest_layer_type & | lowest_layer () |
Get a reference to the lowest layer. | |
next_layer_type & | next_layer () |
Get a reference to the next layer. | |
template<typename MutableBufferSequence > | |
std::size_t | peek (const MutableBufferSequence &buffers) |
template<typename MutableBufferSequence > | |
std::size_t | peek (const MutableBufferSequence &buffers, asio::error_code &ec) |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers) |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers, asio::error_code &ec) |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers) |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers, asio::error_code &ec) |
Private Member Functions | |
template<typename ConstBufferSequence > | |
std::size_t | copy (const ConstBufferSequence &buffers) |
Private Attributes | |
Stream | next_layer_ |
The next layer. | |
detail::buffered_stream_storage | storage_ |
Adds buffering to the write-related operations of a stream.
The buffered_write_stream class template can be used to add buffering to the synchronous and asynchronous write operations of a stream.
Definition at line 52 of file buffered_write_stream.hpp.
typedef next_layer_type::lowest_layer_type asio::buffered_write_stream< Stream >::lowest_layer_type |
The type of the lowest layer.
Definition at line 60 of file buffered_write_stream.hpp.
typedef boost::remove_reference<Stream>::type asio::buffered_write_stream< Stream >::next_layer_type |
The type of the next layer.
Definition at line 57 of file buffered_write_stream.hpp.
asio::buffered_write_stream< Stream >::buffered_write_stream | ( | Arg & | a | ) | [inline, explicit] |
Construct, passing the specified argument to initialise the next layer.
Definition at line 71 of file buffered_write_stream.hpp.
asio::buffered_write_stream< Stream >::buffered_write_stream | ( | Arg & | a, |
std::size_t | buffer_size | ||
) | [inline] |
Construct, passing the specified argument to initialise the next layer.
Definition at line 79 of file buffered_write_stream.hpp.
void asio::buffered_write_stream< Stream >::async_flush | ( | WriteHandler | handler | ) | [inline] |
Start an asynchronous flush.
Definition at line 172 of file buffered_write_stream.hpp.
void asio::buffered_write_stream< Stream >::async_read_some | ( | const MutableBufferSequence & | buffers, |
ReadHandler | handler | ||
) | [inline] |
Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
Definition at line 293 of file buffered_write_stream.hpp.
void asio::buffered_write_stream< Stream >::async_write_some | ( | const ConstBufferSequence & | buffers, |
WriteHandler | handler | ||
) | [inline] |
Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
Definition at line 257 of file buffered_write_stream.hpp.
asio::buffered_write_stream< Stream >::BOOST_STATIC_CONSTANT | ( | std::size_t | , |
default_buffer_size | = 1024 |
||
) |
void asio::buffered_write_stream< Stream >::close | ( | ) | [inline] |
Close the stream.
Definition at line 111 of file buffered_write_stream.hpp.
asio::error_code asio::buffered_write_stream< Stream >::close | ( | asio::error_code & | ec | ) | [inline] |
Close the stream.
Definition at line 117 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::copy | ( | const ConstBufferSequence & | buffers | ) | [inline, private] |
Copy data into the internal buffer from the specified source buffer. Returns the number of bytes copied.
Definition at line 332 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::flush | ( | ) | [inline] |
Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
Definition at line 125 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::flush | ( | asio::error_code & | ec | ) | [inline] |
Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
Definition at line 136 of file buffered_write_stream.hpp.
asio::io_service& asio::buffered_write_stream< Stream >::get_io_service | ( | ) | [inline] |
Get the io_service associated with the object.
Definition at line 105 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::in_avail | ( | ) | [inline] |
Determine the amount of data that may be read without blocking.
Definition at line 317 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::in_avail | ( | asio::error_code & | ec | ) | [inline] |
Determine the amount of data that may be read without blocking.
Definition at line 323 of file buffered_write_stream.hpp.
asio::io_service& asio::buffered_write_stream< Stream >::io_service | ( | ) | [inline] |
(Deprecated: use get_io_service().) Get the io_service associated with the object.
Definition at line 99 of file buffered_write_stream.hpp.
lowest_layer_type& asio::buffered_write_stream< Stream >::lowest_layer | ( | ) | [inline] |
Get a reference to the lowest layer.
Definition at line 92 of file buffered_write_stream.hpp.
next_layer_type& asio::buffered_write_stream< Stream >::next_layer | ( | ) | [inline] |
Get a reference to the next layer.
Definition at line 86 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::peek | ( | const MutableBufferSequence & | buffers | ) | [inline] |
Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
Definition at line 302 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::peek | ( | const MutableBufferSequence & | buffers, |
asio::error_code & | ec | ||
) | [inline] |
Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
Definition at line 310 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::read_some | ( | const MutableBufferSequence & | buffers | ) | [inline] |
Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
Definition at line 276 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::read_some | ( | const MutableBufferSequence & | buffers, |
asio::error_code & | ec | ||
) | [inline] |
Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
Definition at line 284 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::write_some | ( | const ConstBufferSequence & | buffers | ) | [inline] |
Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
Definition at line 181 of file buffered_write_stream.hpp.
std::size_t asio::buffered_write_stream< Stream >::write_some | ( | const ConstBufferSequence & | buffers, |
asio::error_code & | ec | ||
) | [inline] |
Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw.
Definition at line 191 of file buffered_write_stream.hpp.
Stream asio::buffered_write_stream< Stream >::next_layer_ [private] |
The next layer.
Definition at line 358 of file buffered_write_stream.hpp.
detail::buffered_stream_storage asio::buffered_write_stream< Stream >::storage_ [private] |
Definition at line 361 of file buffered_write_stream.hpp.