]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/process/detail/async_handler.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / process / detail / async_handler.hpp
CommitLineData
b32b8144
FG
1/*
2 * async_handler.hpp
3 *
4 * Created on: 12.06.2016
5 * Author: Klemens
6 */
7
8#ifndef BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
9#define BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
10
11#include <type_traits>
12
13#if defined(BOOST_POSIX_API)
14#include <boost/process/posix.hpp>
15#include <boost/process/detail/posix/async_handler.hpp>
16#include <boost/process/detail/posix/asio_fwd.hpp>
17#else
18#include <boost/process/detail/windows/async_handler.hpp>
19#include <boost/process/detail/windows/asio_fwd.hpp>
20#endif
21
22namespace boost {
23
24namespace process {
25
26namespace detail {
27
28#if defined(BOOST_POSIX_API)
29using ::boost::process::detail::posix::is_async_handler;
30using ::boost::process::detail::posix::does_require_io_context;
31#else
32using ::boost::process::detail::windows::is_async_handler;
33using ::boost::process::detail::windows::does_require_io_context;
34#endif
35
36template<typename ...Args>
37struct has_io_context;
38
39template<typename T, typename ...Args>
40struct has_io_context<T, Args...>
41{
42 typedef typename has_io_context<Args...>::type next;
43 typedef typename std::is_same<
44 typename std::remove_reference<T>::type,
45 boost::asio::io_context>::type is_ios;
46 typedef typename std::conditional<is_ios::value,
47 std::true_type,
48 next>::type type;
49};
50
51template<typename T>
52struct has_io_context<T>
53{
54 typedef typename std::is_same<
55 typename std::remove_reference<T>::type,
56 boost::asio::io_context>::type type;
57};
58
59template<typename ...Args>
60using has_io_context_t = typename has_io_context<Args...>::type;
61
62template<typename ...Args>
63struct has_async_handler;
64
65template<typename T, typename ...Args>
66struct has_async_handler<T, Args...>
67{
68 typedef typename has_async_handler<Args...>::type next;
69 typedef typename is_async_handler<T>::type is_ios;
70 typedef typename std::conditional<is_ios::value,
71 std::true_type,
72 next>::type type;
73};
74
75template<typename T>
76struct has_async_handler<T>
77{
78 typedef typename is_async_handler<T>::type type;
79};
80
81template<typename ...Args>
82struct needs_io_context;
83
84template<typename T, typename ...Args>
85struct needs_io_context<T, Args...>
86{
87 typedef typename needs_io_context<Args...>::type next;
88 typedef typename does_require_io_context<T>::type is_ios;
89 typedef typename std::conditional<is_ios::value,
90 std::true_type,
91 next>::type type;
92};
93
94template<typename T>
95struct needs_io_context<T>
96{
97 typedef typename does_require_io_context<T>::type type;
98};
99
100template<typename ...Args>
101boost::asio::io_context &get_io_context_var(boost::asio::io_context & f, Args&...)
102{
103 return f;
104}
105
106template<typename First, typename ...Args>
107boost::asio::io_context &get_io_context_var(First&, Args&...args)
108{
109 return get_io_context_var(args...);
110}
111
112}
113}
114}
115
116
117#endif /* BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_ */