Reference | Class Hierarchy | Class Index | Member Index |
The buffered_read_stream class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.
Public Types | |
typedef boost::remove_reference < Stream >::type | next_layer_type |
The type of the next layer. | |
typedef next_layer_type::lowest_layer_type | lowest_layer_type |
The type of the lowest layer. | |
Public Member Functions | |
template<typename Arg> | |
buffered_read_stream (Arg &a) | |
Construct, passing the specified argument to initialise the next layer. | |
template<typename Arg> | |
buffered_read_stream (Arg &a, std::size_t buffer_size) | |
Construct, passing the specified argument to initialise the next layer. | |
next_layer_type & | next_layer () |
Get a reference to the next layer. | |
lowest_layer_type & | lowest_layer () |
Get a reference to the lowest layer. | |
asio::io_service & | io_service () |
Get the io_service associated with the object. | |
void | close () |
Close the stream. | |
asio::error_code | close (asio::error_code &ec) |
Close the stream. | |
template<typename ConstBufferSequence> | |
std::size_t | write_some (const ConstBufferSequence &buffers) |
Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. | |
template<typename ConstBufferSequence> | |
std::size_t | write_some (const ConstBufferSequence &buffers, asio::error_code &ec) |
Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. | |
template<typename ConstBufferSequence, typename WriteHandler> | |
void | async_write_some (const ConstBufferSequence &buffers, WriteHandler handler) |
Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. | |
std::size_t | fill () |
Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. | |
std::size_t | fill (asio::error_code &ec) |
Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. | |
template<typename ReadHandler> | |
void | async_fill (ReadHandler handler) |
Start an asynchronous fill. | |
template<typename MutableBufferSequence> | |
std::size_t | read_some (const MutableBufferSequence &buffers) |
Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. | |
template<typename MutableBufferSequence> | |
std::size_t | read_some (const MutableBufferSequence &buffers, asio::error_code &ec) |
Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. | |
template<typename MutableBufferSequence, typename ReadHandler> | |
void | async_read_some (const MutableBufferSequence &buffers, ReadHandler handler) |
Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. | |
template<typename MutableBufferSequence> | |
std::size_t | peek (const MutableBufferSequence &buffers) |
Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. | |
template<typename MutableBufferSequence> | |
std::size_t | peek (const MutableBufferSequence &buffers, asio::error_code &ec) |
Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. | |
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. | |
Static Public Attributes | |
static const std::size_t | default_buffer_size = implementation_defined |
The default buffer size. | |
Private Member Functions | |
template<typename MutableBufferSequence> | |
std::size_t | copy (const MutableBufferSequence &buffers) |
Copy data out of the internal buffer to the specified target buffer. Returns the number of bytes copied. | |
template<typename MutableBufferSequence> | |
std::size_t | peek_copy (const MutableBufferSequence &buffers) |
Copy data from the internal buffer to the specified target buffer, without removing the data from the internal buffer. Returns the number of bytes copied. | |
Private Attributes | |
Stream | next_layer_ |
The next layer. |
typedef boost::remove_reference<Stream>::type asio::buffered_read_stream< Stream >::next_layer_type |
The type of the next layer.
typedef next_layer_type::lowest_layer_type asio::buffered_read_stream< Stream >::lowest_layer_type |
The type of the lowest layer.
asio::buffered_read_stream< Stream >::buffered_read_stream | ( | Arg & | a | ) | [explicit] |
Construct, passing the specified argument to initialise the next layer.
asio::buffered_read_stream< Stream >::buffered_read_stream | ( | Arg & | a, | |
std::size_t | buffer_size | |||
) |
Construct, passing the specified argument to initialise the next layer.
next_layer_type& asio::buffered_read_stream< Stream >::next_layer | ( | ) |
Get a reference to the next layer.
lowest_layer_type& asio::buffered_read_stream< Stream >::lowest_layer | ( | ) |
Get a reference to the lowest layer.
asio::io_service& asio::buffered_read_stream< Stream >::io_service | ( | ) |
Get the io_service associated with the object.
void asio::buffered_read_stream< Stream >::close | ( | ) |
Close the stream.
asio::error_code asio::buffered_read_stream< Stream >::close | ( | asio::error_code & | ec | ) |
Close the stream.
std::size_t asio::buffered_read_stream< Stream >::write_some | ( | const ConstBufferSequence & | buffers | ) |
Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
std::size_t asio::buffered_read_stream< Stream >::write_some | ( | const ConstBufferSequence & | buffers, | |
asio::error_code & | ec | |||
) |
Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
void asio::buffered_read_stream< Stream >::async_write_some | ( | const ConstBufferSequence & | buffers, | |
WriteHandler | handler | |||
) |
Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
std::size_t asio::buffered_read_stream< Stream >::fill | ( | ) |
Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
std::size_t asio::buffered_read_stream< Stream >::fill | ( | asio::error_code & | ec | ) |
Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
void asio::buffered_read_stream< Stream >::async_fill | ( | ReadHandler | handler | ) |
Start an asynchronous fill.
std::size_t asio::buffered_read_stream< Stream >::read_some | ( | const MutableBufferSequence & | buffers | ) |
Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
std::size_t asio::buffered_read_stream< Stream >::read_some | ( | const MutableBufferSequence & | buffers, | |
asio::error_code & | ec | |||
) |
Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
void asio::buffered_read_stream< Stream >::async_read_some | ( | const MutableBufferSequence & | buffers, | |
ReadHandler | handler | |||
) |
Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
std::size_t asio::buffered_read_stream< Stream >::peek | ( | const MutableBufferSequence & | buffers | ) |
Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
std::size_t asio::buffered_read_stream< Stream >::peek | ( | const MutableBufferSequence & | buffers, | |
asio::error_code & | ec | |||
) |
Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
std::size_t asio::buffered_read_stream< Stream >::in_avail | ( | ) |
Determine the amount of data that may be read without blocking.
std::size_t asio::buffered_read_stream< Stream >::in_avail | ( | asio::error_code & | ec | ) |
Determine the amount of data that may be read without blocking.
std::size_t asio::buffered_read_stream< Stream >::copy | ( | const MutableBufferSequence & | buffers | ) | [private] |
Copy data out of the internal buffer to the specified target buffer. Returns the number of bytes copied.
std::size_t asio::buffered_read_stream< Stream >::peek_copy | ( | const MutableBufferSequence & | buffers | ) | [private] |
Copy data from the internal buffer to the specified target buffer, without removing the data from the internal buffer. Returns the number of bytes copied.
const std::size_t asio::buffered_read_stream< Stream >::default_buffer_size = implementation_defined [static] |
The default buffer size.
Stream asio::buffered_read_stream< Stream >::next_layer_ [private] |
The next layer.