boost::asio::async_read_at

Start an asynchronous operation to read a certain amount of data at the specified offset.

Synopses

Declared in <boost/asio/read_at.hpp>

Start an asynchronous operation to read a certain amount of data at the specified offset.

template<
    typename AsyncRandomAccessReadDevice,
    typename Allocator,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<AsyncRandomAccessReadDevice::executor_type>>
decltype(async_initiate<ReadToken,
      void (boost::system::error_code, std::size_t)>(
        declval<detail::initiate_async_read_at_streambuf<
          AsyncRandomAccessReadDevice>>(),
        token, offset, &b, transfer_all()))
async_read_at(
    AsyncRandomAccessReadDevice& d,
    std::uint64_t offset,
    basic_streambuf<Allocator>& b,
    ReadToken&& token = default_completion_token_t<
      typename AsyncRandomAccessReadDevice::executor_type>(),
    int = 0);

Start an asynchronous operation to read a certain amount of data at the specified offset.

template<
    typename AsyncRandomAccessReadDevice,
    typename MutableBufferSequence,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<AsyncRandomAccessReadDevice::executor_type>>
decltype(async_initiate<ReadToken,
      void (boost::system::error_code, std::size_t)>(
        declval<detail::initiate_async_read_at<AsyncRandomAccessReadDevice>>(),
        token, offset, buffers, transfer_all()))
async_read_at(
    AsyncRandomAccessReadDevice& d,
    std::uint64_t offset,
    MutableBufferSequence const& buffers,
    ReadToken&& token = default_completion_token_t<
      typename AsyncRandomAccessReadDevice::executor_type>(),
    int = 0);

Start an asynchronous operation to read a certain amount of data at the specified offset.

template<
    typename AsyncRandomAccessReadDevice,
    typename Allocator,
    typename CompletionCondition,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<AsyncRandomAccessReadDevice::executor_type>>
decltype(async_initiate<ReadToken,
      void (boost::system::error_code, std::size_t)>(
        declval<detail::initiate_async_read_at_streambuf<
          AsyncRandomAccessReadDevice>>(),
        token, offset, &b,
        static_cast<CompletionCondition&&>(completion_condition)))
async_read_at(
    AsyncRandomAccessReadDevice& d,
    std::uint64_t offset,
    basic_streambuf<Allocator>& b,
    CompletionCondition completion_condition,
    ReadToken&& token = default_completion_token_t<
      typename AsyncRandomAccessReadDevice::executor_type>(),
    int = 0);

Start an asynchronous operation to read a certain amount of data at the specified offset.

template<
    typename AsyncRandomAccessReadDevice,
    typename MutableBufferSequence,
    typename CompletionCondition,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<AsyncRandomAccessReadDevice::executor_type>>
decltype(async_initiate<ReadToken,
      void (boost::system::error_code, std::size_t)>(
        declval<detail::initiate_async_read_at<AsyncRandomAccessReadDevice>>(),
        token, offset, buffers,
        static_cast<CompletionCondition&&>(completion_condition)))
async_read_at(
    AsyncRandomAccessReadDevice& d,
    std::uint64_t offset,
    MutableBufferSequence const& buffers,
    CompletionCondition completion_condition,
    ReadToken&& token = default_completion_token_t<
      typename AsyncRandomAccessReadDevice::executor_type>(),
    int = 0);

Parameters

Name

Description

d

The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.

offset

The offset at which the data will be read.

b

A basic_streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the completion handler is called.

token

The completion_token that will be used to produce a completion handler, which will be called when the read completes. Potential completion tokens include use_future, use_awaitable, yield_context, or a function object with the correct completion signature. The function signature of the completion handler must be:

buffers

One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the completion handler is called.

completion_condition

The function object to be called to determine whether the read operation is complete. The signature of the function object must be:

Created with MrDocs