Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:08

0001 /*
0002  * async_handler.hpp
0003  *
0004  *  Created on: 12.06.2016
0005  *      Author: Klemens
0006  */
0007 
0008 #ifndef BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
0009 #define BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
0010 
0011 #include <type_traits>
0012 
0013 #if defined(BOOST_POSIX_API)
0014 #include <boost/process/posix.hpp>
0015 #include <boost/process/detail/posix/async_handler.hpp>
0016 #include <boost/process/detail/posix/asio_fwd.hpp>
0017 #else
0018 #include <boost/process/detail/windows/async_handler.hpp>
0019 #include <boost/process/detail/windows/asio_fwd.hpp>
0020 #endif
0021 
0022 namespace boost {
0023 
0024 namespace process {
0025 
0026 namespace detail {
0027 
0028 #if defined(BOOST_POSIX_API)
0029 using ::boost::process::detail::posix::is_async_handler;
0030 using ::boost::process::detail::posix::does_require_io_context;
0031 #else
0032 using ::boost::process::detail::windows::is_async_handler;
0033 using ::boost::process::detail::windows::does_require_io_context;
0034 #endif
0035 
0036 template<typename ...Args>
0037 struct has_io_context;
0038 
0039 template<typename T, typename ...Args>
0040 struct has_io_context<T, Args...>
0041 {
0042     typedef typename has_io_context<Args...>::type next;
0043     typedef typename std::is_same<
0044                 typename std::remove_reference<T>::type,
0045                 boost::asio::io_context>::type is_ios;
0046     typedef typename std::conditional<is_ios::value,
0047             std::true_type,
0048             next>::type type;
0049 };
0050 
0051 template<typename T>
0052 struct has_io_context<T>
0053 {
0054     typedef typename std::is_same<
0055             typename std::remove_reference<T>::type,
0056             boost::asio::io_context>::type type;
0057 };
0058 
0059 template<typename ...Args>
0060 using has_io_context_t = typename has_io_context<Args...>::type;
0061 
0062 template<typename ...Args>
0063 struct has_async_handler;
0064 
0065 template<typename T, typename ...Args>
0066 struct has_async_handler<T, Args...>
0067 {
0068     typedef typename has_async_handler<Args...>::type next;
0069     typedef typename is_async_handler<T>::type is_ios;
0070     typedef typename std::conditional<is_ios::value,
0071             std::true_type,
0072             next>::type type;
0073 };
0074 
0075 template<typename T>
0076 struct has_async_handler<T>
0077 {
0078     typedef typename is_async_handler<T>::type type;
0079 };
0080 
0081 template<typename ...Args>
0082 struct needs_io_context;
0083 
0084 template<typename T, typename ...Args>
0085 struct needs_io_context<T, Args...>
0086 {
0087     typedef typename needs_io_context<Args...>::type next;
0088     typedef typename does_require_io_context<T>::type is_ios;
0089     typedef typename std::conditional<is_ios::value,
0090             std::true_type,
0091             next>::type type;
0092 };
0093 
0094 template<typename T>
0095 struct needs_io_context<T>
0096 {
0097     typedef typename does_require_io_context<T>::type type;
0098 };
0099 
0100 template<typename ...Args>
0101 boost::asio::io_context &get_io_context_var(boost::asio::io_context & f, Args&...)
0102 {
0103     return f;
0104 }
0105 
0106 template<typename First, typename ...Args>
0107 boost::asio::io_context &get_io_context_var(First&, Args&...args)
0108 {
0109     return get_io_context_var(args...);
0110 }
0111 
0112 }
0113 }
0114 }
0115 
0116 
0117 #endif /* BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_ */