asio::buffered_read_stream< Stream > Class Template Reference

Adds buffering to the read-related operations of a stream. More...

#include <buffered_read_stream.hpp>

Inherits asio::detail::noncopyable.

List of all members.

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

 BOOST_STATIC_CONSTANT (std::size_t, default_buffer_size=1024)
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_typenext_layer ()
 Get a reference to the next layer.
lowest_layer_typelowest_layer ()
 Get a reference to the lowest layer.
asio::io_serviceio_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)
template<typename ConstBufferSequence>
std::size_t write_some (const ConstBufferSequence &buffers, asio::error_code &ec)
template<typename ConstBufferSequence, typename WriteHandler>
void async_write_some (const ConstBufferSequence &buffers, WriteHandler handler)
std::size_t fill ()
std::size_t fill (asio::error_code &ec)
template<typename ReadHandler>
void async_fill (ReadHandler handler)
 Start an asynchronous fill.
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 MutableBufferSequence, typename ReadHandler>
void async_read_some (const MutableBufferSequence &buffers, ReadHandler handler)
template<typename MutableBufferSequence>
std::size_t peek (const MutableBufferSequence &buffers)
template<typename MutableBufferSequence>
std::size_t peek (const MutableBufferSequence &buffers, asio::error_code &ec)
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.

Private Member Functions

template<typename MutableBufferSequence>
std::size_t copy (const MutableBufferSequence &buffers)
template<typename MutableBufferSequence>
std::size_t peek_copy (const MutableBufferSequence &buffers)

Private Attributes

Stream next_layer_
 The next layer.
detail::buffered_stream_storage storage_

Classes

class  fill_handler
class  read_some_handler


Detailed Description

template<typename Stream>
class asio::buffered_read_stream< Stream >

Adds buffering to the read-related operations of a stream.

The buffered_read_stream class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.
Concepts:
AsyncReadStream, AsyncWriteStream, Stream, Sync_Read_Stream, SyncWriteStream.

Definition at line 51 of file buffered_read_stream.hpp.


Member Typedef Documentation

template<typename Stream>
typedef boost::remove_reference<Stream>::type asio::buffered_read_stream< Stream >::next_layer_type

The type of the next layer.

Definition at line 56 of file buffered_read_stream.hpp.

template<typename Stream>
typedef next_layer_type::lowest_layer_type asio::buffered_read_stream< Stream >::lowest_layer_type

The type of the lowest layer.

Definition at line 59 of file buffered_read_stream.hpp.


Constructor & Destructor Documentation

template<typename Stream>
template<typename Arg>
asio::buffered_read_stream< Stream >::buffered_read_stream ( Arg &  a  )  [inline, explicit]

Construct, passing the specified argument to initialise the next layer.

Definition at line 70 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename Arg>
asio::buffered_read_stream< Stream >::buffered_read_stream ( Arg &  a,
std::size_t  buffer_size 
) [inline]

Construct, passing the specified argument to initialise the next layer.

Definition at line 78 of file buffered_read_stream.hpp.


Member Function Documentation

template<typename Stream>
asio::buffered_read_stream< Stream >::BOOST_STATIC_CONSTANT ( std::size_t  ,
default_buffer_size  = 1024 
)

template<typename Stream>
next_layer_type& asio::buffered_read_stream< Stream >::next_layer (  )  [inline]

template<typename Stream>
lowest_layer_type& asio::buffered_read_stream< Stream >::lowest_layer (  )  [inline]

Get a reference to the lowest layer.

Definition at line 91 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::lowest_layer().

template<typename Stream>
asio::io_service& asio::buffered_read_stream< Stream >::io_service (  )  [inline]

template<typename Stream>
void asio::buffered_read_stream< Stream >::close (  )  [inline]

Close the stream.

Definition at line 103 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::close().

template<typename Stream>
asio::error_code asio::buffered_read_stream< Stream >::close ( asio::error_code ec  )  [inline]

Close the stream.

Definition at line 109 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename ConstBufferSequence>
std::size_t asio::buffered_read_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 117 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::write_some().

template<typename Stream>
template<typename ConstBufferSequence>
std::size_t asio::buffered_read_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.

Definition at line 125 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename ConstBufferSequence, typename WriteHandler>
void asio::buffered_read_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 134 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::async_write_some().

template<typename Stream>
std::size_t asio::buffered_read_stream< Stream >::fill (  )  [inline]

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.

Definition at line 142 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::fill(), asio::buffered_read_stream< asio::buffered_write_stream & >::peek(), and asio::buffered_read_stream< asio::buffered_write_stream & >::read_some().

template<typename Stream>
std::size_t asio::buffered_read_stream< Stream >::fill ( asio::error_code ec  )  [inline]

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.

Definition at line 157 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename ReadHandler>
void asio::buffered_read_stream< Stream >::async_fill ( ReadHandler  handler  )  [inline]

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_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 217 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::read_some().

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_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 227 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename MutableBufferSequence, typename ReadHandler>
void asio::buffered_read_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 292 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::async_read_some().

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_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 311 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::peek().

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_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 321 of file buffered_read_stream.hpp.

template<typename Stream>
std::size_t asio::buffered_read_stream< Stream >::in_avail (  )  [inline]

Determine the amount of data that may be read without blocking.

Definition at line 331 of file buffered_read_stream.hpp.

Referenced by asio::buffered_stream< Stream >::in_avail().

template<typename Stream>
std::size_t asio::buffered_read_stream< Stream >::in_avail ( asio::error_code ec  )  [inline]

Determine the amount of data that may be read without blocking.

Definition at line 337 of file buffered_read_stream.hpp.

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_stream< Stream >::copy ( const MutableBufferSequence &  buffers  )  [inline, private]

Copy data out of the internal buffer to the specified target buffer. Returns the number of bytes copied.

Definition at line 347 of file buffered_read_stream.hpp.

Referenced by asio::buffered_read_stream< asio::buffered_write_stream & >::async_read_some(), and asio::buffered_read_stream< asio::buffered_write_stream & >::read_some().

template<typename Stream>
template<typename MutableBufferSequence>
std::size_t asio::buffered_read_stream< Stream >::peek_copy ( const MutableBufferSequence &  buffers  )  [inline, 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.

Definition at line 374 of file buffered_read_stream.hpp.

Referenced by asio::buffered_read_stream< asio::buffered_write_stream & >::peek().


Member Data Documentation

template<typename Stream>
Stream asio::buffered_read_stream< Stream >::next_layer_ [private]

template<typename Stream>
detail::buffered_stream_storage asio::buffered_read_stream< Stream >::storage_ [private]


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

Generated on Sun May 25 00:21:28 2008 by  doxygen 1.5.6