4 * Created on: 12.06.2016
8 #ifndef BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
9 #define BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
11 #include <type_traits>
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>
18 #include <boost/process/detail/windows/async_handler.hpp>
19 #include <boost/process/detail/windows/asio_fwd.hpp>
28 #if defined(BOOST_POSIX_API)
29 using ::boost::process::detail::posix::is_async_handler;
30 using ::boost::process::detail::posix::does_require_io_context;
32 using ::boost::process::detail::windows::is_async_handler;
33 using ::boost::process::detail::windows::does_require_io_context;
36 template<typename ...Args>
37 struct has_io_context;
39 template<typename T, typename ...Args>
40 struct has_io_context<T, Args...>
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,
52 struct has_io_context<T>
54 typedef typename std::is_same<
55 typename std::remove_reference<T>::type,
56 boost::asio::io_context>::type type;
59 template<typename ...Args>
60 using has_io_context_t = typename has_io_context<Args...>::type;
62 template<typename ...Args>
63 struct has_async_handler;
65 template<typename T, typename ...Args>
66 struct has_async_handler<T, Args...>
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,
76 struct has_async_handler<T>
78 typedef typename is_async_handler<T>::type type;
81 template<typename ...Args>
82 struct needs_io_context;
84 template<typename T, typename ...Args>
85 struct needs_io_context<T, Args...>
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,
95 struct needs_io_context<T>
97 typedef typename does_require_io_context<T>::type type;
100 template<typename ...Args>
101 boost::asio::io_context &get_io_context_var(boost::asio::io_context & f, Args&...)
106 template<typename First, typename ...Args>
107 boost::asio::io_context &get_io_context_var(First&, Args&...args)
109 return get_io_context_var(args...);
117 #endif /* BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_ */