123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #ifndef BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP
- #define BOOST_ASIO_WINDOWS_OVERLAPPED_PTR_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/config.hpp>
- #if defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) \
- || defined(GENERATING_DOCUMENTATION)
- #include <boost/asio/detail/noncopyable.hpp>
- #include <boost/asio/detail/win_iocp_overlapped_ptr.hpp>
- #include <boost/asio/io_context.hpp>
- #include <boost/asio/detail/push_options.hpp>
- namespace boost {
- namespace asio {
- namespace windows {
- class overlapped_ptr
- : private noncopyable
- {
- public:
-
- overlapped_ptr()
- : impl_()
- {
- }
-
- template <typename ExecutionContext, typename Handler>
- explicit overlapped_ptr(ExecutionContext& context,
- Handler&& handler,
- constraint_t<
- is_convertible<ExecutionContext&, execution_context&>::value
- > = 0)
- : impl_(context.get_executor(), static_cast<Handler&&>(handler))
- {
- }
-
- template <typename Executor, typename Handler>
- explicit overlapped_ptr(const Executor& ex,
- Handler&& handler,
- constraint_t<
- execution::is_executor<Executor>::value
- || is_executor<Executor>::value
- > = 0)
- : impl_(ex, static_cast<Handler&&>(handler))
- {
- }
-
- ~overlapped_ptr()
- {
- }
-
- void reset()
- {
- impl_.reset();
- }
-
-
- template <typename ExecutionContext, typename Handler>
- void reset(ExecutionContext& context, Handler&& handler,
- constraint_t<
- is_convertible<ExecutionContext&, execution_context&>::value
- > = 0)
- {
- impl_.reset(context.get_executor(), static_cast<Handler&&>(handler));
- }
-
-
- template <typename Executor, typename Handler>
- void reset(const Executor& ex, Handler&& handler,
- constraint_t<
- execution::is_executor<Executor>::value
- || is_executor<Executor>::value
- > = 0)
- {
- impl_.reset(ex, static_cast<Handler&&>(handler));
- }
-
- OVERLAPPED* get()
- {
- return impl_.get();
- }
-
- const OVERLAPPED* get() const
- {
- return impl_.get();
- }
-
- OVERLAPPED* release()
- {
- return impl_.release();
- }
-
- void complete(const boost::system::error_code& ec,
- std::size_t bytes_transferred)
- {
- impl_.complete(ec, bytes_transferred);
- }
- private:
- detail::win_iocp_overlapped_ptr impl_;
- };
- }
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #endif
-
- #endif
|