File indexing completed on 2025-04-10 08:42:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef BOOST_PROCESS_ASYNC_HPP_
0032 #define BOOST_PROCESS_ASYNC_HPP_
0033
0034 #include <boost/process/v1/detail/traits.hpp>
0035 #include <boost/process/v1/detail/on_exit.hpp>
0036
0037 #include <boost/asio/io_context.hpp>
0038 #include <boost/asio/streambuf.hpp>
0039 #include <boost/asio/buffer.hpp>
0040 #include <type_traits>
0041 #include <boost/fusion/iterator/deref.hpp>
0042
0043 #if defined(BOOST_POSIX_API)
0044 #include <boost/process/v1/detail/posix/io_context_ref.hpp>
0045 #include <boost/process/v1/detail/posix/async_in.hpp>
0046 #include <boost/process/v1/detail/posix/async_out.hpp>
0047 #include <boost/process/v1/detail/posix/on_exit.hpp>
0048
0049 #elif defined(BOOST_WINDOWS_API)
0050 #include <boost/process/v1/detail/windows/io_context_ref.hpp>
0051 #include <boost/process/v1/detail/windows/async_in.hpp>
0052 #include <boost/process/v1/detail/windows/async_out.hpp>
0053 #include <boost/process/v1/detail/windows/on_exit.hpp>
0054 #endif
0055
0056 namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
0057
0058 struct async_tag;
0059
0060 template<typename T>
0061 struct is_io_context : std::false_type {};
0062 template<>
0063 struct is_io_context<api::io_context_ref> : std::true_type {};
0064
0065 template<typename Tuple>
0066 inline asio::io_context& get_io_context(const Tuple & tup)
0067 {
0068 auto& ref = *boost::fusion::find_if<is_io_context<boost::mpl::_>>(tup);
0069 return ref.get();
0070 }
0071
0072 struct async_builder
0073 {
0074 boost::asio::io_context * ios;
0075
0076 void operator()(boost::asio::io_context & ios_) {this->ios = &ios_;};
0077
0078 typedef api::io_context_ref result_type;
0079 api::io_context_ref get_initializer() {return api::io_context_ref (*ios);};
0080 };
0081
0082
0083 template<>
0084 struct initializer_builder<async_tag>
0085 {
0086 typedef async_builder type;
0087 };
0088
0089 }
0090
0091 using ::boost::asio::buffer;
0092
0093
0094 #if defined(BOOST_PROCESS_DOXYGEN)
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127 constexpr static ::boost::process::v1::detail::on_exit_ on_exit{};
0128 #endif
0129
0130 }}}
0131
0132
0133
0134 #endif