]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/experimental/detail/channel_handler.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / experimental / detail / channel_handler.hpp
1 //
2 // experimental/detail/channel_handler.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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 BOOST_ASIO_EXPERIMENTAL_DETAIL_CHANNEL_HANDLER_HPP
12 #define BOOST_ASIO_EXPERIMENTAL_DETAIL_CHANNEL_HANDLER_HPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/associator.hpp>
20 #include <boost/asio/experimental/detail/channel_payload.hpp>
21
22 #include <boost/asio/detail/push_options.hpp>
23
24 namespace boost {
25 namespace asio {
26 namespace experimental {
27 namespace detail {
28
29 template <typename Payload, typename Handler>
30 class channel_handler
31 {
32 public:
33 channel_handler(BOOST_ASIO_MOVE_ARG(Payload) p, Handler& h)
34 : payload_(BOOST_ASIO_MOVE_CAST(Payload)(p)),
35 handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
36 {
37 }
38
39 void operator()()
40 {
41 payload_.receive(handler_);
42 }
43
44 //private:
45 Payload payload_;
46 Handler handler_;
47 };
48
49 } // namespace detail
50 } // namespace experimental
51
52 template <template <typename, typename> class Associator,
53 typename Payload, typename Handler, typename DefaultCandidate>
54 struct associator<Associator,
55 experimental::detail::channel_handler<Payload, Handler>,
56 DefaultCandidate>
57 : Associator<Handler, DefaultCandidate>
58 {
59 static typename Associator<Handler, DefaultCandidate>::type get(
60 const experimental::detail::channel_handler<Payload, Handler>& h,
61 const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
62 {
63 return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
64 }
65 };
66
67 } // namespace asio
68 } // namespace boost
69
70 #include <boost/asio/detail/pop_options.hpp>
71
72 #endif // BOOST_ASIO_EXPERIMENTAL_DETAIL_CHANNEL_HANDLER_HPP