File indexing completed on 2025-01-18 09:29:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP
0012 #define BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
0020 # include <boost/asio/executor.hpp>
0021 #else
0022 # include <boost/asio/execution.hpp>
0023 #endif
0024
0025 #include <boost/asio/detail/push_options.hpp>
0026
0027 namespace boost {
0028 namespace asio {
0029
0030 #if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
0031
0032 typedef executor any_completion_executor;
0033
0034 #else
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 class any_completion_executor :
0050 #if defined(GENERATING_DOCUMENTATION)
0051 public execution::any_executor<...>
0052 #else
0053 public execution::any_executor<
0054 execution::prefer_only<execution::outstanding_work_t::tracked_t>,
0055 execution::prefer_only<execution::outstanding_work_t::untracked_t>,
0056 execution::prefer_only<execution::relationship_t::fork_t>,
0057 execution::prefer_only<execution::relationship_t::continuation_t>
0058 >
0059 #endif
0060 {
0061 public:
0062 #if !defined(GENERATING_DOCUMENTATION)
0063 typedef execution::any_executor<
0064 execution::prefer_only<execution::outstanding_work_t::tracked_t>,
0065 execution::prefer_only<execution::outstanding_work_t::untracked_t>,
0066 execution::prefer_only<execution::relationship_t::fork_t>,
0067 execution::prefer_only<execution::relationship_t::continuation_t>
0068 > base_type;
0069
0070 typedef void supportable_properties_type(
0071 execution::prefer_only<execution::outstanding_work_t::tracked_t>,
0072 execution::prefer_only<execution::outstanding_work_t::untracked_t>,
0073 execution::prefer_only<execution::relationship_t::fork_t>,
0074 execution::prefer_only<execution::relationship_t::continuation_t>
0075 );
0076 #endif
0077
0078
0079 BOOST_ASIO_DECL any_completion_executor() noexcept;
0080
0081
0082 BOOST_ASIO_DECL any_completion_executor(nullptr_t) noexcept;
0083
0084
0085 BOOST_ASIO_DECL any_completion_executor(
0086 const any_completion_executor& e) noexcept;
0087
0088
0089 BOOST_ASIO_DECL any_completion_executor(
0090 any_completion_executor&& e) noexcept;
0091
0092
0093 #if defined(GENERATING_DOCUMENTATION)
0094 template <class... OtherSupportableProperties>
0095 any_completion_executor(
0096 execution::any_executor<OtherSupportableProperties...> e);
0097 #else
0098 template <typename OtherAnyExecutor>
0099 any_completion_executor(OtherAnyExecutor e,
0100 constraint_t<
0101 conditional<
0102 !is_same<OtherAnyExecutor, any_completion_executor>::value
0103 && is_base_of<execution::detail::any_executor_base,
0104 OtherAnyExecutor>::value,
0105 typename execution::detail::supportable_properties<
0106 0, supportable_properties_type>::template
0107 is_valid_target<OtherAnyExecutor>,
0108 false_type
0109 >::type::value
0110 > = 0)
0111 : base_type(static_cast<OtherAnyExecutor&&>(e))
0112 {
0113 }
0114 #endif
0115
0116
0117 #if defined(GENERATING_DOCUMENTATION)
0118 template <class... OtherSupportableProperties>
0119 any_completion_executor(std::nothrow_t,
0120 execution::any_executor<OtherSupportableProperties...> e);
0121 #else
0122 template <typename OtherAnyExecutor>
0123 any_completion_executor(std::nothrow_t, OtherAnyExecutor e,
0124 constraint_t<
0125 conditional<
0126 !is_same<OtherAnyExecutor, any_completion_executor>::value
0127 && is_base_of<execution::detail::any_executor_base,
0128 OtherAnyExecutor>::value,
0129 typename execution::detail::supportable_properties<
0130 0, supportable_properties_type>::template
0131 is_valid_target<OtherAnyExecutor>,
0132 false_type
0133 >::type::value
0134 > = 0) noexcept
0135 : base_type(std::nothrow, static_cast<OtherAnyExecutor&&>(e))
0136 {
0137 }
0138 #endif
0139
0140
0141 BOOST_ASIO_DECL any_completion_executor(std::nothrow_t,
0142 const any_completion_executor& e) noexcept;
0143
0144
0145 BOOST_ASIO_DECL any_completion_executor(std::nothrow_t,
0146 any_completion_executor&& e) noexcept;
0147
0148
0149 #if defined(GENERATING_DOCUMENTATION)
0150 template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
0151 any_completion_executor(Executor e);
0152 #else
0153 template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
0154 any_completion_executor(Executor e,
0155 constraint_t<
0156 conditional<
0157 !is_same<Executor, any_completion_executor>::value
0158 && !is_base_of<execution::detail::any_executor_base,
0159 Executor>::value,
0160 execution::detail::is_valid_target_executor<
0161 Executor, supportable_properties_type>,
0162 false_type
0163 >::type::value
0164 > = 0)
0165 : base_type(static_cast<Executor&&>(e))
0166 {
0167 }
0168 #endif
0169
0170
0171 #if defined(GENERATING_DOCUMENTATION)
0172 template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
0173 any_completion_executor(std::nothrow_t, Executor e);
0174 #else
0175 template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
0176 any_completion_executor(std::nothrow_t, Executor e,
0177 constraint_t<
0178 conditional<
0179 !is_same<Executor, any_completion_executor>::value
0180 && !is_base_of<execution::detail::any_executor_base,
0181 Executor>::value,
0182 execution::detail::is_valid_target_executor<
0183 Executor, supportable_properties_type>,
0184 false_type
0185 >::type::value
0186 > = 0) noexcept
0187 : base_type(std::nothrow, static_cast<Executor&&>(e))
0188 {
0189 }
0190 #endif
0191
0192
0193 BOOST_ASIO_DECL any_completion_executor& operator=(
0194 const any_completion_executor& e) noexcept;
0195
0196
0197 BOOST_ASIO_DECL any_completion_executor& operator=(
0198 any_completion_executor&& e) noexcept;
0199
0200
0201 BOOST_ASIO_DECL any_completion_executor& operator=(nullptr_t);
0202
0203
0204 BOOST_ASIO_DECL ~any_completion_executor();
0205
0206
0207 BOOST_ASIO_DECL void swap(any_completion_executor& other) noexcept;
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218 template <typename Property>
0219 any_completion_executor require(const Property& p,
0220 constraint_t<
0221 traits::require_member<const base_type&, const Property&>::is_valid
0222 > = 0) const
0223 {
0224 return static_cast<const base_type&>(*this).require(p);
0225 }
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236 template <typename Property>
0237 any_completion_executor prefer(const Property& p,
0238 constraint_t<
0239 traits::prefer_member<const base_type&, const Property&>::is_valid
0240 > = 0) const
0241 {
0242 return static_cast<const base_type&>(*this).prefer(p);
0243 }
0244 };
0245
0246 #if !defined(GENERATING_DOCUMENTATION)
0247
0248 template <>
0249 BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
0250 const execution::outstanding_work_t::tracked_t&, int) const;
0251
0252 template <>
0253 BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
0254 const execution::outstanding_work_t::untracked_t&, int) const;
0255
0256 template <>
0257 BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
0258 const execution::relationship_t::fork_t&, int) const;
0259
0260 template <>
0261 BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
0262 const execution::relationship_t::continuation_t&, int) const;
0263
0264 namespace traits {
0265
0266 #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
0267
0268 template <>
0269 struct equality_comparable<any_completion_executor>
0270 {
0271 static const bool is_valid = true;
0272 static const bool is_noexcept = true;
0273 };
0274
0275 #endif
0276
0277 #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
0278
0279 template <typename F>
0280 struct execute_member<any_completion_executor, F>
0281 {
0282 static const bool is_valid = true;
0283 static const bool is_noexcept = false;
0284 typedef void result_type;
0285 };
0286
0287 #endif
0288
0289 #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
0290
0291 template <typename Prop>
0292 struct query_member<any_completion_executor, Prop> :
0293 query_member<any_completion_executor::base_type, Prop>
0294 {
0295 };
0296
0297 #endif
0298
0299 #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
0300
0301 template <typename Prop>
0302 struct require_member<any_completion_executor, Prop> :
0303 require_member<any_completion_executor::base_type, Prop>
0304 {
0305 typedef any_completion_executor result_type;
0306 };
0307
0308 #endif
0309
0310 #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
0311
0312 template <typename Prop>
0313 struct prefer_member<any_completion_executor, Prop> :
0314 prefer_member<any_completion_executor::base_type, Prop>
0315 {
0316 typedef any_completion_executor result_type;
0317 };
0318
0319 #endif
0320
0321 }
0322
0323 #endif
0324
0325 #endif
0326
0327 }
0328 }
0329
0330 #include <boost/asio/detail/pop_options.hpp>
0331
0332 #if defined(BOOST_ASIO_HEADER_ONLY) \
0333 && !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
0334 # include <boost/asio/impl/any_completion_executor.ipp>
0335 #endif
0336
0337
0338 #endif