]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/test/archetypes/async_result.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / asio / test / archetypes / async_result.hpp
CommitLineData
7c673cae
FG
1//
2// async_result.hpp
3// ~~~~~~~~~~~~~~~~
4//
92f5a8d4 5// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef ARCHETYPES_ASYNC_RESULT_HPP
12#define ARCHETYPES_ASYNC_RESULT_HPP
13
14#include <boost/asio/async_result.hpp>
7c673cae
FG
15
16namespace archetypes {
17
18struct lazy_handler
19{
20};
21
92f5a8d4
TL
22template <typename Signature>
23struct concrete_handler;
24
25template <typename R, typename Arg1>
26struct concrete_handler<R(Arg1)>
7c673cae
FG
27{
28 concrete_handler(lazy_handler)
29 {
30 }
31
92f5a8d4
TL
32 void operator()(typename boost::asio::decay<Arg1>::type)
33 {
34 }
35
36#if defined(BOOST_ASIO_HAS_MOVE)
37 concrete_handler(concrete_handler&&) {}
38private:
39 concrete_handler(const concrete_handler&);
40#endif // defined(BOOST_ASIO_HAS_MOVE)
41};
42
43template <typename R, typename Arg1, typename Arg2>
44struct concrete_handler<R(Arg1, Arg2)>
45{
46 concrete_handler(lazy_handler)
7c673cae
FG
47 {
48 }
49
92f5a8d4 50 void operator()(typename boost::asio::decay<Arg1>::type, typename boost::asio::decay<Arg2>::type)
7c673cae
FG
51 {
52 }
b32b8144
FG
53
54#if defined(BOOST_ASIO_HAS_MOVE)
55 concrete_handler(concrete_handler&&) {}
56private:
57 concrete_handler(const concrete_handler&);
58#endif // defined(BOOST_ASIO_HAS_MOVE)
7c673cae
FG
59};
60
61} // namespace archetypes
62
63namespace boost {
64namespace asio {
65
66template <typename Signature>
b32b8144 67class async_result<archetypes::lazy_handler, Signature>
7c673cae
FG
68{
69public:
b32b8144 70 // The concrete completion handler type.
92f5a8d4 71 typedef archetypes::concrete_handler<Signature> completion_handler_type;
b32b8144 72
7c673cae 73 // The return type of the initiating function.
b32b8144 74 typedef int return_type;
7c673cae
FG
75
76 // Construct an async_result from a given handler.
b32b8144 77 explicit async_result(completion_handler_type&)
7c673cae
FG
78 {
79 }
80
81 // Obtain the value to be returned from the initiating function.
b32b8144 82 return_type get()
7c673cae
FG
83 {
84 return 42;
85 }
b32b8144
FG
86
87private:
88 // Disallow copying and assignment.
89 async_result(const async_result&) BOOST_ASIO_DELETED;
90 async_result& operator=(const async_result&) BOOST_ASIO_DELETED;
7c673cae
FG
91};
92
93} // namespace asio
94} // namespace boost
95
96#endif // ARCHETYPES_ASYNC_RESULT_HPP