11 #ifndef ASIO_DETAIL_IO_OBJECT_IMPL_HPP 12 #define ASIO_DETAIL_IO_OBJECT_IMPL_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 19 #include "asio/detail/config.hpp" 20 #include "asio/detail/type_traits.hpp" 21 #include "asio/execution/executor.hpp" 22 #include "asio/execution/context.hpp" 23 #include "asio/io_context.hpp" 24 #include "asio/query.hpp" 26 #include "asio/detail/push_options.hpp" 31 template <
typename IoObjectService,
37 typedef IoObjectService service_type;
40 typedef typename service_type::implementation_type implementation_type;
43 typedef Executor executor_type;
47 : service_(&asio::use_service<IoObjectService>(
48 io_object_impl::get_context(ex))),
51 service_->construct(implementation_);
55 template <
typename ExecutionContext>
59 : service_(&asio::use_service<IoObjectService>(context)),
60 executor_(context.get_executor())
62 service_->construct(implementation_);
65 #if defined(ASIO_HAS_MOVE) 68 : service_(&other.get_service()),
69 executor_(other.get_executor())
71 service_->move_construct(implementation_, other.implementation_);
75 template <
typename IoObjectService1,
typename Executor1>
77 : service_(&asio::use_service<IoObjectService>(
78 io_object_impl::get_context(other.get_executor()))),
79 executor_(other.get_executor())
81 service_->converting_move_construct(implementation_,
82 other.get_service(), other.get_implementation());
84 #endif // defined(ASIO_HAS_MOVE) 89 service_->destroy(implementation_);
92 #if defined(ASIO_HAS_MOVE) 98 service_->move_assign(implementation_,
99 *other.service_, other.implementation_);
100 executor_.~executor_type();
101 new (&executor_) executor_type(
102 std::move(other.executor_));
103 service_ = other.service_;
107 #endif // defined(ASIO_HAS_MOVE) 110 const executor_type& get_executor() ASIO_NOEXCEPT
116 service_type& get_service()
122 const service_type& get_service()
const 128 implementation_type& get_implementation()
130 return implementation_;
134 const implementation_type& get_implementation()
const 136 return implementation_;
141 template <
typename T>
145 return asio::query(t, execution::context);
149 template <
typename T>
161 service_type* service_;
164 implementation_type implementation_;
167 executor_type executor_;
173 #include "asio/detail/pop_options.hpp" 175 #endif // ASIO_DETAIL_IO_OBJECT_IMPL_HPP basic_executor_type< std::allocator< void >, 0 > executor_type
Executor used to submit functions to an io_context.
Definition: io_context.hpp:228
A context for function object execution.
Definition: execution_context.hpp:105
Definition: type_traits.hpp:97
Definition: io_object_impl.hpp:33
Definition: any_io_executor.hpp:28
The is_executor trait detects whether a type T satisfies the execution::executor concept.
Definition: executor.hpp:109