externals: Update boost to 1.72 and add Boost Context

This commit is contained in:
Fernando Sahmkow 2020-02-10 12:31:57 -04:00
parent 5e8300b76a
commit 77abe07b3b
618 changed files with 96299 additions and 14263 deletions

View file

@ -22,6 +22,7 @@
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/non_const_lvalue.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/push_options.hpp>
@ -140,11 +141,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_buffered_fill
template <typename Stream>
class initiate_async_buffered_fill
{
template <typename ReadHandler, typename Stream>
public:
typedef typename remove_reference<
Stream>::type::lowest_layer_type::executor_type executor_type;
explicit initiate_async_buffered_fill(Stream& next_layer)
: next_layer_(next_layer)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return next_layer_.lowest_layer().get_executor();
}
template <typename ReadHandler>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
buffered_stream_storage* storage, Stream* next_layer) const
buffered_stream_storage* storage) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a ReadHandler.
@ -153,13 +169,16 @@ namespace detail
non_const_lvalue<ReadHandler> handler2(handler);
std::size_t previous_size = storage->size();
storage->resize(storage->capacity());
next_layer->async_read_some(
next_layer_.async_read_some(
buffer(
storage->data() + previous_size,
storage->size() - previous_size),
buffered_fill_handler<typename decay<ReadHandler>::type>(
*storage, previous_size, handler2.value));
}
private:
Stream& next_layer_;
};
} // namespace detail
@ -194,15 +213,18 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
buffered_read_stream<Stream>::async_fill(
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_fill(), handler, &storage_, &next_layer_);
detail::initiate_async_buffered_fill<Stream>(next_layer_),
handler, &storage_);
}
template <typename Stream>
@ -336,12 +358,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_buffered_read_some
template <typename Stream>
class initiate_async_buffered_read_some
{
template <typename ReadHandler, typename Stream,
typename MutableBufferSequence>
public:
typedef typename remove_reference<
Stream>::type::lowest_layer_type::executor_type executor_type;
explicit initiate_async_buffered_read_some(Stream& next_layer)
: next_layer_(next_layer)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return next_layer_.lowest_layer().get_executor();
}
template <typename ReadHandler, typename MutableBufferSequence>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
buffered_stream_storage* storage, Stream* next_layer,
buffered_stream_storage* storage,
const MutableBufferSequence& buffers) const
{
// If you get an error on the following line it means that your handler
@ -352,20 +388,23 @@ namespace detail
non_const_lvalue<ReadHandler> handler2(handler);
if (buffer_size(buffers) == 0 || !storage->empty())
{
next_layer->async_read_some(BOOST_ASIO_MUTABLE_BUFFER(0, 0),
next_layer_.async_read_some(BOOST_ASIO_MUTABLE_BUFFER(0, 0),
buffered_read_some_handler<MutableBufferSequence,
typename decay<ReadHandler>::type>(
*storage, buffers, handler2.value));
}
else
{
initiate_async_buffered_fill()(
initiate_async_buffered_fill<Stream>(this->next_layer_)(
buffered_read_some_handler<MutableBufferSequence,
typename decay<ReadHandler>::type>(
*storage, buffers, handler2.value),
storage, next_layer);
storage);
}
}
private:
Stream& next_layer_;
};
} // namespace detail
@ -408,8 +447,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename MutableBufferSequence, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename MutableBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
buffered_read_stream<Stream>::async_read_some(
const MutableBufferSequence& buffers,
@ -417,8 +458,8 @@ buffered_read_stream<Stream>::async_read_some(
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_read_some(),
handler, &storage_, &next_layer_, buffers);
detail::initiate_async_buffered_read_some<Stream>(next_layer_),
handler, &storage_, buffers);
}
template <typename Stream>

View file

@ -126,21 +126,39 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_buffered_flush
template <typename Stream>
class initiate_async_buffered_flush
{
template <typename WriteHandler, typename Stream>
public:
typedef typename remove_reference<
Stream>::type::lowest_layer_type::executor_type executor_type;
explicit initiate_async_buffered_flush(Stream& next_layer)
: next_layer_(next_layer)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return next_layer_.lowest_layer().get_executor();
}
template <typename WriteHandler>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
buffered_stream_storage* storage, Stream* next_layer) const
buffered_stream_storage* storage) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
non_const_lvalue<WriteHandler> handler2(handler);
async_write(*next_layer, buffer(storage->data(), storage->size()),
async_write(next_layer_, buffer(storage->data(), storage->size()),
buffered_flush_handler<typename decay<WriteHandler>::type>(
*storage, handler2.value));
}
private:
Stream& next_layer_;
};
} // namespace detail
@ -175,16 +193,18 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename WriteHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
buffered_write_stream<Stream>::async_flush(
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_flush(),
handler, &storage_, &next_layer_);
detail::initiate_async_buffered_flush<Stream>(next_layer_),
handler, &storage_);
}
template <typename Stream>
@ -324,12 +344,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_buffered_write_some
template <typename Stream>
class initiate_async_buffered_write_some
{
template <typename WriteHandler, typename Stream,
typename ConstBufferSequence>
public:
typedef typename remove_reference<
Stream>::type::lowest_layer_type::executor_type executor_type;
explicit initiate_async_buffered_write_some(Stream& next_layer)
: next_layer_(next_layer)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return next_layer_.lowest_layer().get_executor();
}
template <typename WriteHandler, typename ConstBufferSequence>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
buffered_stream_storage* storage, Stream* next_layer,
buffered_stream_storage* storage,
const ConstBufferSequence& buffers) const
{
// If you get an error on the following line it means that your handler
@ -340,20 +374,23 @@ namespace detail
non_const_lvalue<WriteHandler> handler2(handler);
if (buffer_size(buffers) == 0 || storage->size() < storage->capacity())
{
next_layer->async_write_some(BOOST_ASIO_CONST_BUFFER(0, 0),
next_layer_.async_write_some(BOOST_ASIO_CONST_BUFFER(0, 0),
buffered_write_some_handler<ConstBufferSequence,
typename decay<WriteHandler>::type>(
*storage, buffers, handler2.value));
}
else
{
initiate_async_buffered_flush()(
initiate_async_buffered_flush<Stream>(this->next_layer_)(
buffered_write_some_handler<ConstBufferSequence,
typename decay<WriteHandler>::type>(
*storage, buffers, handler2.value),
storage, next_layer);
storage);
}
}
private:
Stream& next_layer_;
};
} // namespace detail
@ -396,8 +433,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Stream>
template <typename ConstBufferSequence, typename WriteHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename ConstBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
buffered_write_stream<Stream>::async_write_some(
const ConstBufferSequence& buffers,
@ -405,8 +444,8 @@ buffered_write_stream<Stream>::async_write_some(
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_buffered_write_some(),
handler, &storage_, &next_layer_, buffers);
detail::initiate_async_buffered_write_some<Stream>(next_layer_),
handler, &storage_, buffers);
}
template <typename Stream>

View file

@ -90,25 +90,43 @@ awaitable<void, Executor> co_spawn_entry_point(
});
}
struct initiate_co_spawn
template <typename Executor>
class initiate_co_spawn
{
template <typename Handler, typename Executor, typename F>
void operator()(Handler&& handler, const Executor& ex, F&& f) const
public:
typedef Executor executor_type;
template <typename OtherExecutor>
explicit initiate_co_spawn(const OtherExecutor& ex)
: ex_(ex)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return ex_;
}
template <typename Handler, typename F>
void operator()(Handler&& handler, F&& f) const
{
typedef typename result_of<F()>::type awaitable_type;
typedef typename awaitable_type::executor_type executor_type;
executor_type ex2(ex);
auto a = (co_spawn_entry_point)(static_cast<awaitable_type*>(nullptr),
ex2, std::forward<F>(f), std::forward<Handler>(handler));
awaitable_handler<executor_type, void>(std::move(a), ex2).launch();
ex_, std::forward<F>(f), std::forward<Handler>(handler));
awaitable_handler<executor_type, void>(std::move(a), ex_).launch();
}
private:
Executor ex_;
};
} // namespace detail
template <typename Executor, typename F, typename CompletionToken>
inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken,
template <typename Executor, typename F,
BOOST_ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
typename result_of<F()>::type>::type) CompletionToken>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
typename enable_if<
@ -117,11 +135,15 @@ co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
{
return async_initiate<CompletionToken,
typename detail::awaitable_signature<typename result_of<F()>::type>>(
detail::initiate_co_spawn(), token, ex, std::forward<F>(f));
detail::initiate_co_spawn<
typename result_of<F()>::type::executor_type>(ex),
token, std::forward<F>(f));
}
template <typename ExecutionContext, typename F, typename CompletionToken>
inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken,
template <typename ExecutionContext, typename F,
BOOST_ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
typename result_of<F()>::type>::type) CompletionToken>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token,
typename enable_if<

View file

@ -32,13 +32,123 @@ namespace asio {
namespace detail
{
template <typename>
struct composed_io_executors;
template <>
struct composed_io_executors<void()>
{
composed_io_executors() BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
typedef system_executor head_type;
system_executor head_;
};
inline composed_io_executors<void()> make_composed_io_executors()
{
return composed_io_executors<void()>();
}
template <typename Head>
struct composed_io_executors<void(Head)>
{
explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT
: head_(ex)
{
}
typedef Head head_type;
Head head_;
};
template <typename Head>
inline composed_io_executors<void(Head)>
make_composed_io_executors(const Head& head)
{
return composed_io_executors<void(Head)>(head);
}
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_io_executors<void(Head, Tail...)>
{
explicit composed_io_executors(const Head& head,
const Tail&... tail) BOOST_ASIO_NOEXCEPT
: head_(head),
tail_(tail...)
{
}
void reset()
{
head_.reset();
tail_.reset();
}
typedef Head head_type;
Head head_;
composed_io_executors<void(Tail...)> tail_;
};
template <typename Head, typename... Tail>
inline composed_io_executors<void(Head, Tail...)>
make_composed_io_executors(const Head& head, const Tail&... tail)
{
return composed_io_executors<void(Head, Tail...)>(head, tail...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
explicit composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \
: head_(head), \
tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \
{ \
} \
\
void reset() \
{ \
head_.reset(); \
tail_.reset(); \
} \
\
typedef Head head_type; \
Head head_; \
composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
\
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
make_composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
{ \
return composed_io_executors< \
void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \
head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename>
struct composed_work;
template <>
struct composed_work<void()>
{
composed_work() BOOST_ASIO_NOEXCEPT
typedef composed_io_executors<void()> executors_type;
composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
@ -52,16 +162,13 @@ namespace detail
executor_work_guard<system_executor> head_;
};
inline composed_work<void()> make_composed_work()
{
return composed_work<void()>();
}
template <typename Head>
struct composed_work<void(Head)>
{
explicit composed_work(const Head& ex) BOOST_ASIO_NOEXCEPT
: head_(ex)
typedef composed_io_executors<void(Head)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_)
{
}
@ -74,21 +181,16 @@ namespace detail
executor_work_guard<Head> head_;
};
template <typename Head>
inline composed_work<void(Head)> make_composed_work(const Head& head)
{
return composed_work<void(Head)>(head);
}
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_work<void(Head, Tail...)>
{
explicit composed_work(const Head& head,
const Tail&... tail) BOOST_ASIO_NOEXCEPT
: head_(head),
tail_(tail...)
typedef composed_io_executors<void(Head, Tail...)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_),
tail_(ex.tail_)
{
}
@ -103,23 +205,18 @@ namespace detail
composed_work<void(Tail...)> tail_;
};
template <typename Head, typename... Tail>
inline composed_work<void(Head, Tail...)>
make_composed_work(const Head& head, const Tail&... tail)
{
return composed_work<void(Head, Tail...)>(head, tail...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
explicit composed_work(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \
: head_(head), \
tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \
typedef composed_io_executors<void(Head, \
BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \
\
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \
: head_(ex.head_), \
tail_(ex.tail_) \
{ \
} \
\
@ -133,15 +230,6 @@ namespace detail
executor_work_guard<Head> head_; \
composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
\
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
inline composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
make_composed_work(const Head& head, BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
{ \
return composed_work< \
void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \
head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF
@ -299,21 +387,46 @@ namespace detail
function, this_handler->handler_);
}
template <typename Signature>
struct initiate_composed_op
template <typename Signature, typename Executors>
class initiate_composed_op
{
template <typename Handler, typename Impl, typename Work>
void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler,
BOOST_ASIO_MOVE_ARG(Impl) impl,
BOOST_ASIO_MOVE_ARG(Work) work) const
public:
typedef typename composed_io_executors<Executors>::head_type executor_type;
template <typename T>
explicit initiate_composed_op(BOOST_ASIO_MOVE_ARG(T) executors)
: executors_(BOOST_ASIO_MOVE_CAST(T)(executors))
{
composed_op<typename decay<Impl>::type, typename decay<Work>::type,
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return executors_.head_;
}
template <typename Handler, typename Impl>
void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler,
BOOST_ASIO_MOVE_ARG(Impl) impl) const
{
composed_op<typename decay<Impl>::type, composed_work<Executors>,
typename decay<Handler>::type, Signature>(
BOOST_ASIO_MOVE_CAST(Impl)(impl), BOOST_ASIO_MOVE_CAST(Work)(work),
BOOST_ASIO_MOVE_CAST(Impl)(impl),
composed_work<Executors>(executors_),
BOOST_ASIO_MOVE_CAST(Handler)(handler))();
}
private:
composed_io_executors<Executors> executors_;
};
template <typename Signature, typename Executors>
inline initiate_composed_op<Signature, Executors> make_initiate_composed_op(
BOOST_ASIO_MOVE_ARG(composed_io_executors<Executors>) executors)
{
return initiate_composed_op<Signature, Executors>(
BOOST_ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors));
}
template <typename IoObject>
inline typename IoObject::executor_type
get_composed_io_executor(IoObject& io_object)
@ -334,31 +447,31 @@ namespace detail
template <typename CompletionToken, typename Signature,
typename Implementation, typename... IoObjectsOrExecutors>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation,
BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token,
BOOST_ASIO_MOVE_ARG(IoObjectsOrExecutors)... io_objects_or_executors)
{
return async_initiate<CompletionToken, Signature>(
detail::initiate_composed_op<Signature>(), token,
BOOST_ASIO_MOVE_CAST(Implementation)(implementation),
detail::make_composed_work(
detail::get_composed_io_executor(
BOOST_ASIO_MOVE_CAST(IoObjectsOrExecutors)(
io_objects_or_executors))...));
detail::make_initiate_composed_op<Signature>(
detail::make_composed_io_executors(
detail::get_composed_io_executor(
BOOST_ASIO_MOVE_CAST(IoObjectsOrExecutors)(
io_objects_or_executors))...)),
token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation));
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename CompletionToken, typename Signature, typename Implementation>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation,
BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token)
{
return async_initiate<CompletionToken, Signature>(
detail::initiate_composed_op<Signature>(), token,
BOOST_ASIO_MOVE_CAST(Implementation)(implementation),
detail::make_composed_work());
detail::make_initiate_composed_op<Signature>(
detail::make_composed_io_executors()),
token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation));
}
# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n) \
@ -388,16 +501,16 @@ async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation,
#define BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF(n) \
template <typename CompletionToken, typename Signature, \
typename Implementation, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature) \
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) \
async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation, \
BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
{ \
return async_initiate<CompletionToken, Signature>( \
detail::initiate_composed_op<Signature>(), token, \
BOOST_ASIO_MOVE_CAST(Implementation)(implementation), \
detail::make_composed_work( \
BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))); \
detail::make_initiate_composed_op<Signature>( \
detail::make_composed_io_executors( \
BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))), \
token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF)

View file

@ -455,12 +455,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_range_connect
template <typename Protocol, typename Executor>
class initiate_async_range_connect
{
template <typename RangeConnectHandler, typename Protocol,
typename Executor, typename EndpointSequence, typename ConnectCondition>
public:
typedef Executor executor_type;
explicit initiate_async_range_connect(basic_socket<Protocol, Executor>& s)
: socket_(s)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return socket_.get_executor();
}
template <typename RangeConnectHandler,
typename EndpointSequence, typename ConnectCondition>
void operator()(BOOST_ASIO_MOVE_ARG(RangeConnectHandler) handler,
basic_socket<Protocol, Executor>* s, const EndpointSequence& endpoints,
const EndpointSequence& endpoints,
const ConnectCondition& connect_condition) const
{
// If you get an error on the following line it means that your
@ -471,9 +485,12 @@ namespace detail
non_const_lvalue<RangeConnectHandler> handler2(handler);
range_connect_op<Protocol, Executor, EndpointSequence, ConnectCondition,
typename decay<RangeConnectHandler>::type>(*s, endpoints,
typename decay<RangeConnectHandler>::type>(socket_, endpoints,
connect_condition, handler2.value)(boost::system::error_code(), 1);
}
private:
basic_socket<Protocol, Executor>& socket_;
};
template <typename Protocol, typename Executor, typename Iterator,
@ -624,13 +641,28 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_iterator_connect
template <typename Protocol, typename Executor>
class initiate_async_iterator_connect
{
template <typename IteratorConnectHandler, typename Protocol,
typename Executor, typename Iterator, typename ConnectCondition>
public:
typedef Executor executor_type;
explicit initiate_async_iterator_connect(
basic_socket<Protocol, Executor>& s)
: socket_(s)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return socket_.get_executor();
}
template <typename IteratorConnectHandler,
typename Iterator, typename ConnectCondition>
void operator()(BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler,
basic_socket<Protocol, Executor>* s, Iterator begin,
Iterator end, const ConnectCondition& connect_condition) const
Iterator begin, Iterator end,
const ConnectCondition& connect_condition) const
{
// If you get an error on the following line it means that your
// handler does not meet the documented type requirements for an
@ -640,9 +672,12 @@ namespace detail
non_const_lvalue<IteratorConnectHandler> handler2(handler);
iterator_connect_op<Protocol, Executor, Iterator, ConnectCondition,
typename decay<IteratorConnectHandler>::type>(*s, begin, end,
typename decay<IteratorConnectHandler>::type>(socket_, begin, end,
connect_condition, handler2.value)(boost::system::error_code(), 1);
}
private:
basic_socket<Protocol, Executor>& socket_;
};
} // namespace detail
@ -730,9 +765,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename Protocol, typename Executor,
typename EndpointSequence, typename RangeConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
template <typename Protocol, typename Executor, typename EndpointSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::endpoint)) RangeConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
void (boost::system::error_code, typename Protocol::endpoint))
async_connect(basic_socket<Protocol, Executor>& s,
const EndpointSequence& endpoints,
@ -742,14 +778,15 @@ async_connect(basic_socket<Protocol, Executor>& s,
{
return async_initiate<RangeConnectHandler,
void (boost::system::error_code, typename Protocol::endpoint)>(
detail::initiate_async_range_connect(), handler,
&s, endpoints, detail::default_connect_condition());
detail::initiate_async_range_connect<Protocol, Executor>(s),
handler, endpoints, detail::default_connect_condition());
}
#if !defined(BOOST_ASIO_NO_DEPRECATED)
template <typename Protocol, typename Executor,
typename Iterator, typename IteratorConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
template <typename Protocol, typename Executor, typename Iterator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
Iterator)) IteratorConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
void (boost::system::error_code, Iterator))
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler,
@ -757,27 +794,30 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
{
return async_initiate<IteratorConnectHandler,
void (boost::system::error_code, Iterator)>(
detail::initiate_async_iterator_connect(), handler,
&s, begin, Iterator(), detail::default_connect_condition());
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
handler, begin, Iterator(), detail::default_connect_condition());
}
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
template <typename Protocol, typename Executor,
typename Iterator, typename IteratorConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
template <typename Protocol, typename Executor, typename Iterator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
Iterator)) IteratorConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
void (boost::system::error_code, Iterator))
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end,
BOOST_ASIO_MOVE_ARG(IteratorConnectHandler) handler)
{
return async_initiate<IteratorConnectHandler,
void (boost::system::error_code, Iterator)>(
detail::initiate_async_iterator_connect(), handler,
&s, begin, end, detail::default_connect_condition());
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
handler, begin, end, detail::default_connect_condition());
}
template <typename Protocol, typename Executor, typename EndpointSequence,
typename ConnectCondition, typename RangeConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
template <typename Protocol, typename Executor,
typename EndpointSequence, typename ConnectCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::endpoint)) RangeConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
void (boost::system::error_code, typename Protocol::endpoint))
async_connect(basic_socket<Protocol, Executor>& s,
const EndpointSequence& endpoints, ConnectCondition connect_condition,
@ -787,14 +827,16 @@ async_connect(basic_socket<Protocol, Executor>& s,
{
return async_initiate<RangeConnectHandler,
void (boost::system::error_code, typename Protocol::endpoint)>(
detail::initiate_async_range_connect(),
handler, &s, endpoints, connect_condition);
detail::initiate_async_range_connect<Protocol, Executor>(s),
handler, endpoints, connect_condition);
}
#if !defined(BOOST_ASIO_NO_DEPRECATED)
template <typename Protocol, typename Executor, typename Iterator,
typename ConnectCondition, typename IteratorConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
template <typename Protocol, typename Executor,
typename Iterator, typename ConnectCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
Iterator)) IteratorConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
void (boost::system::error_code, Iterator))
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
ConnectCondition connect_condition,
@ -803,14 +845,16 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
{
return async_initiate<IteratorConnectHandler,
void (boost::system::error_code, Iterator)>(
detail::initiate_async_iterator_connect(),
handler, &s, begin, Iterator(), connect_condition);
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
handler, begin, Iterator(), connect_condition);
}
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
template <typename Protocol, typename Executor, typename Iterator,
typename ConnectCondition, typename IteratorConnectHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
template <typename Protocol, typename Executor,
typename Iterator, typename ConnectCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
Iterator)) IteratorConnectHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
void (boost::system::error_code, Iterator))
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
Iterator end, ConnectCondition connect_condition,
@ -818,8 +862,8 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
{
return async_initiate<IteratorConnectHandler,
void (boost::system::error_code, Iterator)>(
detail::initiate_async_iterator_connect(),
handler, &s, begin, end, connect_condition);
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
handler, begin, end, connect_condition);
}
} // namespace asio

View file

@ -26,8 +26,9 @@ namespace boost {
namespace asio {
namespace detail {
struct initiate_defer
class initiate_defer
{
public:
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
@ -41,42 +42,63 @@ struct initiate_defer
ex.defer(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
}
};
template <typename CompletionHandler, typename Executor>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler,
BOOST_ASIO_MOVE_ARG(Executor) ex) const
template <typename Executor>
class initiate_defer_with_executor
{
public:
typedef Executor executor_type;
explicit initiate_defer_with_executor(const Executor& ex)
: ex_(ex)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return ex_;
}
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
typedef typename decay<CompletionHandler>::type DecayedHandler;
typename associated_allocator<DecayedHandler>::type alloc(
(get_associated_allocator)(handler));
ex.defer(detail::work_dispatcher<DecayedHandler>(
ex_.defer(detail::work_dispatcher<DecayedHandler>(
BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
}
private:
Executor ex_;
};
} // namespace detail
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
BOOST_ASIO_MOVE_ARG(CompletionToken) token)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_defer(), token);
}
template <typename Executor, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
template <typename Executor,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_executor<Executor>::value>::type*)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_defer(), token, ex);
detail::initiate_defer_with_executor<Executor>(ex), token);
}
template <typename ExecutionContext, typename CompletionToken>
inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
template <typename ExecutionContext,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_convertible<
ExecutionContext&, execution_context&>::value>::type*)

View file

@ -26,8 +26,9 @@ namespace boost {
namespace asio {
namespace detail {
struct initiate_dispatch
class initiate_dispatch
{
public:
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
@ -41,42 +42,63 @@ struct initiate_dispatch
ex.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
}
};
template <typename CompletionHandler, typename Executor>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler,
BOOST_ASIO_MOVE_ARG(Executor) ex) const
template <typename Executor>
class initiate_dispatch_with_executor
{
public:
typedef Executor executor_type;
explicit initiate_dispatch_with_executor(const Executor& ex)
: ex_(ex)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return ex_;
}
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
typedef typename decay<CompletionHandler>::type DecayedHandler;
typename associated_allocator<DecayedHandler>::type alloc(
(get_associated_allocator)(handler));
ex.dispatch(detail::work_dispatcher<DecayedHandler>(
ex_.dispatch(detail::work_dispatcher<DecayedHandler>(
BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
}
private:
Executor ex_;
};
} // namespace detail
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
BOOST_ASIO_MOVE_ARG(CompletionToken) token)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_dispatch(), token);
}
template <typename Executor, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
template <typename Executor,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_executor<Executor>::value>::type*)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_dispatch(), token, ex);
detail::initiate_dispatch_with_executor<Executor>(ex), token);
}
template <typename ExecutionContext, typename CompletionToken>
inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
template <typename ExecutionContext,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_convertible<
ExecutionContext&, execution_context&>::value>::type*)

View file

@ -172,7 +172,7 @@ struct io_context::initiate_dispatch
};
template <typename LegacyCompletionHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
io_context::dispatch(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
{
return async_initiate<LegacyCompletionHandler, void ()>(
@ -211,7 +211,7 @@ struct io_context::initiate_post
};
template <typename LegacyCompletionHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
io_context::post(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
{
return async_initiate<LegacyCompletionHandler, void ()>(

View file

@ -26,8 +26,9 @@ namespace boost {
namespace asio {
namespace detail {
struct initiate_post
class initiate_post
{
public:
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
@ -41,42 +42,63 @@ struct initiate_post
ex.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
}
};
template <typename CompletionHandler, typename Executor>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler,
BOOST_ASIO_MOVE_ARG(Executor) ex) const
template <typename Executor>
class initiate_post_with_executor
{
public:
typedef Executor executor_type;
explicit initiate_post_with_executor(const Executor& ex)
: ex_(ex)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return ex_;
}
template <typename CompletionHandler>
void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const
{
typedef typename decay<CompletionHandler>::type DecayedHandler;
typename associated_allocator<DecayedHandler>::type alloc(
(get_associated_allocator)(handler));
ex.post(detail::work_dispatcher<DecayedHandler>(
ex_.post(detail::work_dispatcher<DecayedHandler>(
BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
}
private:
Executor ex_;
};
} // namespace detail
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
BOOST_ASIO_MOVE_ARG(CompletionToken) token)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_post(), token);
}
template <typename Executor, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
template <typename Executor,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_executor<Executor>::value>::type*)
{
return async_initiate<CompletionToken, void()>(
detail::initiate_post(), token, ex);
detail::initiate_post_with_executor<Executor>(ex), token);
}
template <typename ExecutionContext, typename CompletionToken>
inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
template <typename ExecutionContext,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
typename enable_if<is_convertible<
ExecutionContext&, execution_context&>::value>::type*)

View file

@ -453,12 +453,26 @@ namespace detail
boost::system::error_code(), 0, 1);
}
struct initiate_async_read_buffer_sequence
template <typename AsyncReadStream>
class initiate_async_read_buffer_sequence
{
template <typename ReadHandler, typename AsyncReadStream,
typename MutableBufferSequence, typename CompletionCondition>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_buffer_sequence(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename MutableBufferSequence,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, const MutableBufferSequence& buffers,
const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -467,10 +481,13 @@ namespace detail
non_const_lvalue<ReadHandler> handler2(handler);
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
start_read_buffer_sequence_op(*s, buffers,
start_read_buffer_sequence_op(stream_, buffers,
boost::asio::buffer_sequence_begin(buffers),
completion_cond2.value, handler2.value);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -516,9 +533,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename MutableBufferSequence, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
@ -529,13 +548,14 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_buffer_sequence(), handler, &s, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
detail::initiate_async_read_buffer_sequence<AsyncReadStream>(s), handler,
buffers, BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncReadStream, typename MutableBufferSequence,
typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
@ -545,8 +565,8 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_buffer_sequence(),
handler, &s, buffers, transfer_all());
detail::initiate_async_read_buffer_sequence<AsyncReadStream>(s),
handler, buffers, transfer_all());
}
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
@ -692,12 +712,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_dynbuf_v1
template <typename AsyncReadStream>
class initiate_async_read_dynbuf_v1
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v1, typename CompletionCondition>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_dynbuf_v1(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v1,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -708,10 +742,13 @@ namespace detail
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
read_dynbuf_v1_op<AsyncReadStream, typename decay<DynamicBuffer_v1>::type,
CompletionCondition, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -755,9 +792,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -772,9 +810,11 @@ async_read(AsyncReadStream& s,
transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
template <typename AsyncReadStream, typename DynamicBuffer_v1,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -791,16 +831,18 @@ async_read(AsyncReadStream& s,
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_dynbuf_v1(), handler, &s,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@ -809,9 +851,11 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename Allocator, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
@ -973,12 +1017,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_dynbuf_v2
template <typename AsyncReadStream>
class initiate_async_read_dynbuf_v2
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v2, typename CompletionCondition>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_dynbuf_v2(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v2,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -989,10 +1047,13 @@ namespace detail
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
read_dynbuf_v2_op<AsyncReadStream, typename decay<DynamicBuffer_v2>::type,
CompletionCondition, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -1036,9 +1097,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
@ -1051,9 +1113,11 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
template <typename AsyncReadStream, typename DynamicBuffer_v2,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition,
@ -1068,8 +1132,8 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_dynbuf_v2(), handler, &s,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
detail::initiate_async_read_dynbuf_v2<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}

View file

@ -321,13 +321,27 @@ namespace detail
boost::system::error_code(), 0, 1);
}
struct initiate_async_read_at_buffer_sequence
template <typename AsyncRandomAccessReadDevice>
class initiate_async_read_at_buffer_sequence
{
template <typename ReadHandler, typename AsyncRandomAccessReadDevice,
typename MutableBufferSequence, typename CompletionCondition>
public:
typedef typename AsyncRandomAccessReadDevice::executor_type executor_type;
explicit initiate_async_read_at_buffer_sequence(
AsyncRandomAccessReadDevice& device)
: device_(device)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return device_.get_executor();
}
template <typename ReadHandler, typename MutableBufferSequence,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncRandomAccessReadDevice* d, uint64_t offset,
const MutableBufferSequence& buffers,
uint64_t offset, const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -336,10 +350,13 @@ namespace detail
non_const_lvalue<ReadHandler> handler2(handler);
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
start_read_at_buffer_sequence_op(*d, offset, buffers,
start_read_at_buffer_sequence_op(device_, offset, buffers,
boost::asio::buffer_sequence_begin(buffers),
completion_cond2.value, handler2.value);
}
private:
AsyncRandomAccessReadDevice& device_;
};
} // namespace detail
@ -387,9 +404,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncRandomAccessReadDevice,
typename MutableBufferSequence, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_at(AsyncRandomAccessReadDevice& d,
uint64_t offset, const MutableBufferSequence& buffers,
@ -398,13 +417,16 @@ async_read_at(AsyncRandomAccessReadDevice& d,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_at_buffer_sequence(), handler, &d, offset,
buffers, BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
detail::initiate_async_read_at_buffer_sequence<
AsyncRandomAccessReadDevice>(d),
handler, offset, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_at(AsyncRandomAccessReadDevice& d,
uint64_t offset, const MutableBufferSequence& buffers,
@ -412,8 +434,9 @@ async_read_at(AsyncRandomAccessReadDevice& d,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_at_buffer_sequence(),
handler, &d, offset, buffers, transfer_all());
detail::initiate_async_read_at_buffer_sequence<
AsyncRandomAccessReadDevice>(d),
handler, offset, buffers, transfer_all());
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
@ -554,13 +577,27 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_at_streambuf
template <typename AsyncRandomAccessReadDevice>
class initiate_async_read_at_streambuf
{
template <typename ReadHandler, typename AsyncRandomAccessReadDevice,
public:
typedef typename AsyncRandomAccessReadDevice::executor_type executor_type;
explicit initiate_async_read_at_streambuf(
AsyncRandomAccessReadDevice& device)
: device_(device)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return device_.get_executor();
}
template <typename ReadHandler,
typename Allocator, typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncRandomAccessReadDevice* d, uint64_t offset,
basic_streambuf<Allocator>* b,
uint64_t offset, basic_streambuf<Allocator>* b,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -571,9 +608,12 @@ namespace detail
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
CompletionCondition, typename decay<ReadHandler>::type>(
*d, offset, *b, completion_cond2.value, handler2.value)(
device_, offset, *b, completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
private:
AsyncRandomAccessReadDevice& device_;
};
} // namespace detail
@ -617,9 +657,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncRandomAccessReadDevice, typename Allocator,
typename CompletionCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncRandomAccessReadDevice,
typename Allocator, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_at(AsyncRandomAccessReadDevice& d,
uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
@ -628,13 +670,15 @@ async_read_at(AsyncRandomAccessReadDevice& d,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_at_streambuf(), handler, &d, offset,
&b, BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d),
handler, offset, &b,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncRandomAccessReadDevice, typename Allocator,
typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_at(AsyncRandomAccessReadDevice& d,
uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
@ -642,8 +686,8 @@ async_read_at(AsyncRandomAccessReadDevice& d,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_at_streambuf(),
handler, &d, offset, &b, transfer_all());
detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d),
handler, offset, &b, transfer_all());
}
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)

View file

@ -952,12 +952,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_delim_v1
template <typename AsyncReadStream>
class initiate_async_read_until_delim_v1
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v1>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_delim_v1(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v1>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
char delim) const
{
// If you get an error on the following line it means that your handler
@ -968,9 +981,12 @@ namespace detail
read_until_delim_op_v1<AsyncReadStream,
typename decay<DynamicBuffer_v1>::type,
typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
delim, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -1014,9 +1030,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -1028,8 +1045,8 @@ async_read_until(AsyncReadStream& s,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_delim_v1(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), delim);
detail::initiate_async_read_until_delim_v1<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), delim);
}
namespace detail
@ -1219,12 +1236,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_delim_string_v1
template <typename AsyncReadStream>
class initiate_async_read_until_delim_string_v1
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v1>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_delim_string_v1(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v1>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
const std::string& delim) const
{
// If you get an error on the following line it means that your handler
@ -1235,9 +1265,12 @@ namespace detail
read_until_delim_string_op_v1<AsyncReadStream,
typename decay<DynamicBuffer_v1>::type,
typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
delim, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -1281,9 +1314,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -1296,8 +1330,8 @@ async_read_until(AsyncReadStream& s,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_delim_string_v1(),
handler, &s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
detail::initiate_async_read_until_delim_string_v1<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
static_cast<std::string>(delim));
}
@ -1494,13 +1528,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_expr_v1
template <typename AsyncReadStream>
class initiate_async_read_until_expr_v1
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v1, typename RegEx>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_expr_v1(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v1, typename RegEx>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
const RegEx& expr) const
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers, const RegEx& expr) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a ReadHandler.
@ -1510,9 +1556,12 @@ namespace detail
read_until_expr_op_v1<AsyncReadStream,
typename decay<DynamicBuffer_v1>::type,
RegEx, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
expr, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -1556,9 +1605,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -1571,8 +1621,8 @@ async_read_until(AsyncReadStream& s,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_expr_v1(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), expr);
detail::initiate_async_read_until_expr_v1<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), expr);
}
#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX)
@ -1765,12 +1815,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_match_v1
template <typename AsyncReadStream>
class initiate_async_read_until_match_v1
{
template <typename ReadHandler, typename AsyncReadStream,
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_match_v1(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler,
typename DynamicBuffer_v1, typename MatchCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
MatchCondition match_condition) const
{
// If you get an error on the following line it means that your handler
@ -1781,9 +1845,12 @@ namespace detail
read_until_match_op_v1<AsyncReadStream,
typename decay<DynamicBuffer_v1>::type,
MatchCondition, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
match_condition, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -1827,9 +1894,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream, typename DynamicBuffer_v1,
typename MatchCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename MatchCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -1842,14 +1911,16 @@ async_read_until(AsyncReadStream& s,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_match_v1(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), match_condition);
detail::initiate_async_read_until_match_v1<AsyncReadStream>(s), handler,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), match_condition);
}
#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
@ -1859,8 +1930,10 @@ async_read_until(AsyncReadStream& s,
delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
@ -1873,8 +1946,10 @@ async_read_until(AsyncReadStream& s,
#if defined(BOOST_ASIO_HAS_BOOST_REGEX)
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
@ -1886,9 +1961,10 @@ async_read_until(AsyncReadStream& s,
#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX)
template <typename AsyncReadStream, typename Allocator,
typename MatchCondition, typename ReadHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator, typename MatchCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
@ -2087,13 +2163,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_delim_v2
template <typename AsyncReadStream>
class initiate_async_read_until_delim_v2
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v2>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_delim_v2(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v2>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
char delim) const
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers, char delim) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a ReadHandler.
@ -2103,9 +2191,12 @@ namespace detail
read_until_delim_op_v2<AsyncReadStream,
typename decay<DynamicBuffer_v2>::type,
typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
delim, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -2149,9 +2240,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
@ -2161,8 +2253,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_delim_v2(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), delim);
detail::initiate_async_read_until_delim_v2<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), delim);
}
namespace detail
@ -2360,12 +2452,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_delim_string_v2
template <typename AsyncReadStream>
class initiate_async_read_until_delim_string_v2
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v2>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_delim_string_v2(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v2>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
const std::string& delim) const
{
// If you get an error on the following line it means that your handler
@ -2376,9 +2481,12 @@ namespace detail
read_until_delim_string_op_v2<AsyncReadStream,
typename decay<DynamicBuffer_v2>::type,
typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
delim, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -2423,8 +2531,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s,
DynamicBuffer_v2 buffers, BOOST_ASIO_STRING_VIEW_PARAM delim,
@ -2435,8 +2545,8 @@ async_read_until(AsyncReadStream& s,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_delim_string_v2(),
handler, &s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
detail::initiate_async_read_until_delim_string_v2<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
static_cast<std::string>(delim));
}
@ -2641,12 +2751,25 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_expr_v2
template <typename AsyncReadStream>
class initiate_async_read_until_expr_v2
{
template <typename ReadHandler, typename AsyncReadStream,
typename DynamicBuffer_v2, typename RegEx>
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_expr_v2(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler, typename DynamicBuffer_v2, typename RegEx>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
const RegEx& expr) const
{
// If you get an error on the following line it means that your handler
@ -2657,9 +2780,12 @@ namespace detail
read_until_expr_op_v2<AsyncReadStream,
typename decay<DynamicBuffer_v2>::type,
RegEx, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
expr, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -2703,9 +2829,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
const boost::regex& expr, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
@ -2715,8 +2842,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_expr_v2(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), expr);
detail::initiate_async_read_until_expr_v2<AsyncReadStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), expr);
}
#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX)
@ -2917,12 +3044,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_read_until_match_v2
template <typename AsyncReadStream>
class initiate_async_read_until_match_v2
{
template <typename ReadHandler, typename AsyncReadStream,
public:
typedef typename AsyncReadStream::executor_type executor_type;
explicit initiate_async_read_until_match_v2(AsyncReadStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename ReadHandler,
typename DynamicBuffer_v2, typename MatchCondition>
void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
AsyncReadStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
MatchCondition match_condition) const
{
// If you get an error on the following line it means that your handler
@ -2933,9 +3074,12 @@ namespace detail
read_until_match_op_v2<AsyncReadStream,
typename decay<DynamicBuffer_v2>::type,
MatchCondition, typename decay<ReadHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
match_condition, handler2.value)(boost::system::error_code(), 0, 1);
}
private:
AsyncReadStream& stream_;
};
} // namespace detail
@ -2979,9 +3123,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncReadStream, typename DynamicBuffer_v2,
typename MatchCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename MatchCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
void (boost::system::error_code, std::size_t))
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
@ -2992,8 +3138,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
{
return async_initiate<ReadHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_read_until_match_v2(), handler,
&s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), match_condition);
detail::initiate_async_read_until_match_v2<AsyncReadStream>(s), handler,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), match_condition);
}
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)

View file

@ -418,12 +418,26 @@ namespace detail
boost::system::error_code(), 0, 1);
}
struct initiate_async_write_buffer_sequence
template <typename AsyncWriteStream>
class initiate_async_write_buffer_sequence
{
template <typename WriteHandler, typename AsyncWriteStream,
typename ConstBufferSequence, typename CompletionCondition>
public:
typedef typename AsyncWriteStream::executor_type executor_type;
explicit initiate_async_write_buffer_sequence(AsyncWriteStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename WriteHandler, typename ConstBufferSequence,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
AsyncWriteStream* s, const ConstBufferSequence& buffers,
const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -432,10 +446,13 @@ namespace detail
non_const_lvalue<WriteHandler> handler2(handler);
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
start_write_buffer_sequence_op(*s, buffers,
start_write_buffer_sequence_op(stream_, buffers,
boost::asio::buffer_sequence_begin(buffers),
completion_cond2.value, handler2.value);
}
private:
AsyncWriteStream& stream_;
};
} // namespace detail
@ -481,9 +498,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream,
typename ConstBufferSequence, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
CompletionCondition completion_condition,
@ -494,13 +513,15 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_buffer_sequence(), handler, &s, buffers,
detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
handler, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
@ -510,8 +531,8 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_buffer_sequence(),
handler, &s, buffers, transfer_all());
detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
handler, buffers, transfer_all());
}
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
@ -629,12 +650,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_write_dynbuf_v1
template <typename AsyncWriteStream>
class initiate_async_write_dynbuf_v1
{
template <typename WriteHandler, typename AsyncWriteStream,
typename DynamicBuffer_v1, typename CompletionCondition>
public:
typedef typename AsyncWriteStream::executor_type executor_type;
explicit initiate_async_write_dynbuf_v1(AsyncWriteStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename WriteHandler, typename DynamicBuffer_v1,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
AsyncWriteStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -646,10 +681,13 @@ namespace detail
write_dynbuf_v1_op<AsyncWriteStream,
typename decay<DynamicBuffer_v1>::type,
CompletionCondition, typename decay<WriteHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
private:
AsyncWriteStream& stream_;
};
} // namespace detail
@ -693,9 +731,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncWriteStream,
typename DynamicBuffer_v1, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -710,9 +749,11 @@ async_write(AsyncWriteStream& s,
transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream,
typename DynamicBuffer_v1, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
@ -725,16 +766,18 @@ async_write(AsyncWriteStream& s,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_dynbuf_v1(), handler, &s,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
detail::initiate_async_write_dynbuf_v1<AsyncWriteStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
@ -744,9 +787,11 @@ async_write(AsyncWriteStream& s,
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
template <typename AsyncWriteStream, typename Allocator,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream,
typename Allocator, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
@ -875,12 +920,26 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_write_dynbuf_v2
template <typename AsyncWriteStream>
class initiate_async_write_dynbuf_v2
{
template <typename WriteHandler, typename AsyncWriteStream,
typename DynamicBuffer_v2, typename CompletionCondition>
public:
typedef typename AsyncWriteStream::executor_type executor_type;
explicit initiate_async_write_dynbuf_v2(AsyncWriteStream& stream)
: stream_(stream)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return stream_.get_executor();
}
template <typename WriteHandler, typename DynamicBuffer_v2,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
AsyncWriteStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -892,10 +951,13 @@ namespace detail
write_dynbuf_v2_op<AsyncWriteStream,
typename decay<DynamicBuffer_v2>::type,
CompletionCondition, typename decay<WriteHandler>::type>(
*s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
private:
AsyncWriteStream& stream_;
};
} // namespace detail
@ -939,9 +1001,10 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncWriteStream,
typename DynamicBuffer_v2, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
@ -954,9 +1017,11 @@ async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncWriteStream,
typename DynamicBuffer_v2, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition,
@ -967,8 +1032,8 @@ async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_dynbuf_v2(), handler, &s,
BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
detail::initiate_async_write_dynbuf_v2<AsyncWriteStream>(s),
handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}

View file

@ -306,13 +306,27 @@ namespace detail
boost::system::error_code(), 0, 1);
}
struct initiate_async_write_at_buffer_sequence
template <typename AsyncRandomAccessWriteDevice>
class initiate_async_write_at_buffer_sequence
{
template <typename WriteHandler, typename AsyncRandomAccessWriteDevice,
typename ConstBufferSequence, typename CompletionCondition>
public:
typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type;
explicit initiate_async_write_at_buffer_sequence(
AsyncRandomAccessWriteDevice& device)
: device_(device)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return device_.get_executor();
}
template <typename WriteHandler, typename ConstBufferSequence,
typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
AsyncRandomAccessWriteDevice* d, uint64_t offset,
const ConstBufferSequence& buffers,
uint64_t offset, const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
@ -321,10 +335,13 @@ namespace detail
non_const_lvalue<WriteHandler> handler2(handler);
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
start_write_at_buffer_sequence_op(*d, offset, buffers,
start_write_at_buffer_sequence_op(device_, offset, buffers,
boost::asio::buffer_sequence_begin(buffers),
completion_cond2.value, handler2.value);
}
private:
AsyncRandomAccessWriteDevice& device_;
};
} // namespace detail
@ -372,9 +389,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncRandomAccessWriteDevice,
typename ConstBufferSequence, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write_at(AsyncRandomAccessWriteDevice& d,
uint64_t offset, const ConstBufferSequence& buffers,
@ -383,13 +402,16 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_at_buffer_sequence(), handler, &d, offset,
buffers, BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
detail::initiate_async_write_at_buffer_sequence<
AsyncRandomAccessWriteDevice>(d),
handler, offset, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write_at(AsyncRandomAccessWriteDevice& d,
uint64_t offset, const ConstBufferSequence& buffers,
@ -397,8 +419,9 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_at_buffer_sequence(),
handler, &d, offset, buffers, transfer_all());
detail::initiate_async_write_at_buffer_sequence<
AsyncRandomAccessWriteDevice>(d),
handler, offset, buffers, transfer_all());
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
@ -484,13 +507,27 @@ namespace detail
function, this_handler->handler_);
}
struct initiate_async_write_at_streambuf
template <typename AsyncRandomAccessWriteDevice>
class initiate_async_write_at_streambuf
{
template <typename WriteHandler, typename AsyncRandomAccessWriteDevice,
public:
typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type;
explicit initiate_async_write_at_streambuf(
AsyncRandomAccessWriteDevice& device)
: device_(device)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return device_.get_executor();
}
template <typename WriteHandler,
typename Allocator, typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
AsyncRandomAccessWriteDevice* d, uint64_t offset,
basic_streambuf<Allocator>* b,
uint64_t offset, basic_streambuf<Allocator>* b,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_condition) const
{
// If you get an error on the following line it means that your handler
@ -498,11 +535,14 @@ namespace detail
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
non_const_lvalue<WriteHandler> handler2(handler);
async_write_at(*d, offset, b->data(),
async_write_at(device_, offset, b->data(),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition),
write_at_streambuf_op<Allocator, typename decay<WriteHandler>::type>(
*b, handler2.value));
}
private:
AsyncRandomAccessWriteDevice& device_;
};
} // namespace detail
@ -540,9 +580,11 @@ struct associated_executor<
#endif // !defined(GENERATING_DOCUMENTATION)
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
typename CompletionCondition, typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
template <typename AsyncRandomAccessWriteDevice,
typename Allocator, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write_at(AsyncRandomAccessWriteDevice& d,
uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
@ -551,13 +593,16 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_at_streambuf(), handler, &d, offset,
&b, BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
detail::initiate_async_write_at_streambuf<
AsyncRandomAccessWriteDevice>(d),
handler, offset, &b,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
typename WriteHandler>
inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) WriteHandler>
inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write_at(AsyncRandomAccessWriteDevice& d,
uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
@ -565,8 +610,9 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
detail::initiate_async_write_at_streambuf(),
handler, &d, offset, &b, transfer_all());
detail::initiate_async_write_at_streambuf<
AsyncRandomAccessWriteDevice>(d),
handler, offset, &b, transfer_all());
}
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)