11 #ifndef ASIO_BUFFERED_STREAM_HPP 12 #define ASIO_BUFFERED_STREAM_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 44 template <
typename Stream>
56 template <
typename Arg>
58 : inner_stream_impl_(a),
59 stream_impl_(inner_stream_impl_)
64 template <
typename Arg>
66 std::size_t write_buffer_size)
67 : inner_stream_impl_(a, write_buffer_size),
68 stream_impl_(inner_stream_impl_, read_buffer_size)
105 return stream_impl_.
close(ec);
125 template <
typename WriteHandler>
136 template <
typename ConstBufferSequence>
144 template <
typename ConstBufferSequence>
153 template <
typename ConstBufferSequence,
typename WriteHandler>
156 async_write_some(
const ConstBufferSequence&
buffers,
159 return stream_impl_.async_write_some(buffers,
167 return stream_impl_.
fill();
174 return stream_impl_.
fill(ec);
178 template <
typename ReadHandler>
183 return stream_impl_.async_fill(
ASIO_MOVE_CAST(ReadHandler)(handler));
188 template <
typename MutableBufferSequence>
189 std::size_t
read_some(
const MutableBufferSequence& buffers)
196 template <
typename MutableBufferSequence>
197 std::size_t
read_some(
const MutableBufferSequence& buffers,
200 return stream_impl_.
read_some(buffers, ec);
205 template <
typename MutableBufferSequence,
typename ReadHandler>
208 async_read_some(
const MutableBufferSequence& buffers,
211 return stream_impl_.async_read_some(buffers,
217 template <
typename MutableBufferSequence>
218 std::size_t
peek(
const MutableBufferSequence& buffers)
220 return stream_impl_.
peek(buffers);
225 template <
typename MutableBufferSequence>
226 std::size_t
peek(
const MutableBufferSequence& buffers,
229 return stream_impl_.
peek(buffers, ec);
247 write_stream_type inner_stream_impl_;
251 read_stream_type stream_impl_;
258 #endif // ASIO_BUFFERED_STREAM_HPP std::size_t in_avail(asio::error_code &ec)
Determine the amount of data that may be read without blocking.
std::size_t in_avail()
Determine the amount of data that may be read without blocking.
buffered_stream(Arg &a, std::size_t read_buffer_size, std::size_t write_buffer_size)
Construct, passing the specified argument to initialise the next layer.
buffered_stream(Arg &a)
Construct, passing the specified argument to initialise the next layer.
ASIO_MOVE_ARG(WriteHandler) handler)
Provides core I/O functionality.
void close()
Close the stream.
ASIO_INITFN_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_flush(ASIO_MOVE_ARG(WriteHandler) handler)
Start an asynchronous flush.
lowest_layer_type & lowest_layer()
Get a reference to the lowest layer.
std::size_t flush(asio::error_code &ec)
next_layer_type & next_layer()
Get a reference to the next layer.
next_layer_type & next_layer()
Get a reference to the next layer.
ASIO_MOVE_ARG(ReadHandler) handler)
Adds buffering to the read- and write-related operations of a stream.
std::size_t write_some(const ConstBufferSequence &buffers, asio::error_code &ec)
remove_reference< Stream >::type next_layer_type
The type of the next layer.
std::size_t write_some(const ConstBufferSequence &buffers)
asio::io_service & get_io_service()
Get the io_service associated with the object.
const MutableBufferSequence & buffers
std::size_t in_avail()
Determine the amount of data that may be read without blocking.
const lowest_layer_type & lowest_layer() const
Get a const reference to the lowest layer.
std::size_t read_some(const MutableBufferSequence &buffers)
std::size_t peek(const MutableBufferSequence &buffers)
std::size_t peek(const MutableBufferSequence &buffers, asio::error_code &ec)
Class to represent an error code value.
lowest_layer_type & lowest_layer()
Get a reference to the lowest layer.
asio::io_service & get_io_service()
Get the io_service associated with the object.
std::size_t peek(const MutableBufferSequence &buffers)
std::size_t fill(asio::error_code &ec)
next_layer_type::lowest_layer_type lowest_layer_type
The type of the lowest layer.
std::size_t write_some(const ConstBufferSequence &buffers)
std::size_t read_some(const MutableBufferSequence &buffers, asio::error_code &ec)
#define ASIO_MOVE_CAST(type)
std::size_t read_some(const MutableBufferSequence &buffers)
void close()
Close the stream.
asio::error_code close(asio::error_code &ec)
Close the stream.
ASIO_INITFN_RESULT_TYPE(ReadHandler, void(asio::error_code, std::size_t)) async_fill(ASIO_MOVE_ARG(ReadHandler) handler)
Start an asynchronous fill.
Adds buffering to the write-related operations of a stream.