summaryrefslogtreecommitdiff
path: root/boost/process/detail/async_handler.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:08:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:09:00 +0900
commitb5c87084afaef42b2d058f68091be31988a6a874 (patch)
treeadef9a65870a41181687e11d57fdf98e7629de3c /boost/process/detail/async_handler.hpp
parent34bd32e225e2a8a94104489b31c42e5801cc1f4a (diff)
downloadboost-b5c87084afaef42b2d058f68091be31988a6a874.tar.gz
boost-b5c87084afaef42b2d058f68091be31988a6a874.tar.bz2
boost-b5c87084afaef42b2d058f68091be31988a6a874.zip
Imported Upstream version 1.64.0upstream/1.64.0
Change-Id: Id9212edd016dd55f21172c427aa7894d1d24148b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/process/detail/async_handler.hpp')
-rw-r--r--boost/process/detail/async_handler.hpp117
1 files changed, 117 insertions, 0 deletions
diff --git a/boost/process/detail/async_handler.hpp b/boost/process/detail/async_handler.hpp
new file mode 100644
index 0000000000..832a42014e
--- /dev/null
+++ b/boost/process/detail/async_handler.hpp
@@ -0,0 +1,117 @@
+/*
+ * async_handler.hpp
+ *
+ * Created on: 12.06.2016
+ * Author: Klemens
+ */
+
+#ifndef BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
+#define BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_
+
+#include <type_traits>
+
+#if defined(BOOST_POSIX_API)
+#include <boost/process/posix.hpp>
+#include <boost/process/detail/posix/async_handler.hpp>
+#include <boost/process/detail/posix/asio_fwd.hpp>
+#else
+#include <boost/process/detail/windows/async_handler.hpp>
+#include <boost/process/detail/windows/asio_fwd.hpp>
+#endif
+
+namespace boost {
+
+namespace process {
+
+namespace detail {
+
+#if defined(BOOST_POSIX_API)
+using ::boost::process::detail::posix::is_async_handler;
+using ::boost::process::detail::posix::does_require_io_service;
+#else
+using ::boost::process::detail::windows::is_async_handler;
+using ::boost::process::detail::windows::does_require_io_service;
+#endif
+
+template<typename ...Args>
+struct has_io_service;
+
+template<typename T, typename ...Args>
+struct has_io_service<T, Args...>
+{
+ typedef typename has_io_service<Args...>::type next;
+ typedef typename std::is_same<
+ typename std::remove_reference<T>::type,
+ boost::asio::io_service>::type is_ios;
+ typedef typename std::conditional<is_ios::value,
+ std::true_type,
+ next>::type type;
+};
+
+template<typename T>
+struct has_io_service<T>
+{
+ typedef typename std::is_same<
+ typename std::remove_reference<T>::type,
+ boost::asio::io_service>::type type;
+};
+
+template<typename ...Args>
+using has_io_service_t = typename has_io_service<Args...>::type;
+
+template<typename ...Args>
+struct has_async_handler;
+
+template<typename T, typename ...Args>
+struct has_async_handler<T, Args...>
+{
+ typedef typename has_async_handler<Args...>::type next;
+ typedef typename is_async_handler<T>::type is_ios;
+ typedef typename std::conditional<is_ios::value,
+ std::true_type,
+ next>::type type;
+};
+
+template<typename T>
+struct has_async_handler<T>
+{
+ typedef typename is_async_handler<T>::type type;
+};
+
+template<typename ...Args>
+struct needs_io_service;
+
+template<typename T, typename ...Args>
+struct needs_io_service<T, Args...>
+{
+ typedef typename needs_io_service<Args...>::type next;
+ typedef typename does_require_io_service<T>::type is_ios;
+ typedef typename std::conditional<is_ios::value,
+ std::true_type,
+ next>::type type;
+};
+
+template<typename T>
+struct needs_io_service<T>
+{
+ typedef typename does_require_io_service<T>::type type;
+};
+
+template<typename ...Args>
+boost::asio::io_service &get_io_service_var(boost::asio::io_service & f, Args&...)
+{
+ return f;
+}
+
+template<typename First, typename ...Args>
+boost::asio::io_service &get_io_service_var(First&, Args&...args)
+{
+ return get_io_service_var(args...);
+}
+
+}
+}
+}
+
+
+#endif /* BOOST_PROCESS_DETAIL_ASYNC_HANDLER_HPP_ */