annotate DEPENDENCIES/generic/include/boost/asio/windows/object_handle_service.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // windows/object_handle_service.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 // Copyright (c) 2011 Boris Schaeling (boris@highscore.de)
Chris@16 7 //
Chris@16 8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10 //
Chris@16 11
Chris@16 12 #ifndef BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP
Chris@16 13 #define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP
Chris@16 14
Chris@16 15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 16 # pragma once
Chris@16 17 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 18
Chris@16 19 #include <boost/asio/detail/config.hpp>
Chris@16 20
Chris@16 21 #if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \
Chris@16 22 || defined(GENERATING_DOCUMENTATION)
Chris@16 23
Chris@16 24 #include <boost/asio/async_result.hpp>
Chris@16 25 #include <boost/asio/detail/win_object_handle_service.hpp>
Chris@16 26 #include <boost/asio/error.hpp>
Chris@16 27 #include <boost/asio/io_service.hpp>
Chris@16 28
Chris@16 29 #include <boost/asio/detail/push_options.hpp>
Chris@16 30
Chris@16 31 namespace boost {
Chris@16 32 namespace asio {
Chris@16 33 namespace windows {
Chris@16 34
Chris@16 35 /// Default service implementation for an object handle.
Chris@16 36 class object_handle_service
Chris@16 37 #if defined(GENERATING_DOCUMENTATION)
Chris@16 38 : public boost::asio::io_service::service
Chris@16 39 #else
Chris@16 40 : public boost::asio::detail::service_base<object_handle_service>
Chris@16 41 #endif
Chris@16 42 {
Chris@16 43 public:
Chris@16 44 #if defined(GENERATING_DOCUMENTATION)
Chris@16 45 /// The unique service identifier.
Chris@16 46 static boost::asio::io_service::id id;
Chris@16 47 #endif
Chris@16 48
Chris@16 49 private:
Chris@16 50 // The type of the platform-specific implementation.
Chris@16 51 typedef detail::win_object_handle_service service_impl_type;
Chris@16 52
Chris@16 53 public:
Chris@16 54 /// The type of an object handle implementation.
Chris@16 55 #if defined(GENERATING_DOCUMENTATION)
Chris@16 56 typedef implementation_defined implementation_type;
Chris@16 57 #else
Chris@16 58 typedef service_impl_type::implementation_type implementation_type;
Chris@16 59 #endif
Chris@16 60
Chris@16 61 /// The native handle type.
Chris@16 62 #if defined(GENERATING_DOCUMENTATION)
Chris@16 63 typedef implementation_defined native_handle_type;
Chris@16 64 #else
Chris@16 65 typedef service_impl_type::native_handle_type native_handle_type;
Chris@16 66 #endif
Chris@16 67
Chris@16 68 /// Construct a new object handle service for the specified io_service.
Chris@16 69 explicit object_handle_service(boost::asio::io_service& io_service)
Chris@16 70 : boost::asio::detail::service_base<object_handle_service>(io_service),
Chris@16 71 service_impl_(io_service)
Chris@16 72 {
Chris@16 73 }
Chris@16 74
Chris@16 75 /// Construct a new object handle implementation.
Chris@16 76 void construct(implementation_type& impl)
Chris@16 77 {
Chris@16 78 service_impl_.construct(impl);
Chris@16 79 }
Chris@16 80
Chris@16 81 #if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
Chris@16 82 /// Move-construct a new object handle implementation.
Chris@16 83 void move_construct(implementation_type& impl,
Chris@16 84 implementation_type& other_impl)
Chris@16 85 {
Chris@16 86 service_impl_.move_construct(impl, other_impl);
Chris@16 87 }
Chris@16 88
Chris@16 89 /// Move-assign from another object handle implementation.
Chris@16 90 void move_assign(implementation_type& impl,
Chris@16 91 object_handle_service& other_service,
Chris@16 92 implementation_type& other_impl)
Chris@16 93 {
Chris@16 94 service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
Chris@16 95 }
Chris@16 96 #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
Chris@16 97
Chris@16 98 /// Destroy an object handle implementation.
Chris@16 99 void destroy(implementation_type& impl)
Chris@16 100 {
Chris@16 101 service_impl_.destroy(impl);
Chris@16 102 }
Chris@16 103
Chris@16 104 /// Assign an existing native handle to an object handle.
Chris@16 105 boost::system::error_code assign(implementation_type& impl,
Chris@16 106 const native_handle_type& handle, boost::system::error_code& ec)
Chris@16 107 {
Chris@16 108 return service_impl_.assign(impl, handle, ec);
Chris@16 109 }
Chris@16 110
Chris@16 111 /// Determine whether the handle is open.
Chris@16 112 bool is_open(const implementation_type& impl) const
Chris@16 113 {
Chris@16 114 return service_impl_.is_open(impl);
Chris@16 115 }
Chris@16 116
Chris@16 117 /// Close an object handle implementation.
Chris@16 118 boost::system::error_code close(implementation_type& impl,
Chris@16 119 boost::system::error_code& ec)
Chris@16 120 {
Chris@16 121 return service_impl_.close(impl, ec);
Chris@16 122 }
Chris@16 123
Chris@16 124 /// Get the native handle implementation.
Chris@16 125 native_handle_type native_handle(implementation_type& impl)
Chris@16 126 {
Chris@16 127 return service_impl_.native_handle(impl);
Chris@16 128 }
Chris@16 129
Chris@16 130 /// Cancel all asynchronous operations associated with the handle.
Chris@16 131 boost::system::error_code cancel(implementation_type& impl,
Chris@16 132 boost::system::error_code& ec)
Chris@16 133 {
Chris@16 134 return service_impl_.cancel(impl, ec);
Chris@16 135 }
Chris@16 136
Chris@16 137 // Wait for a signaled state.
Chris@16 138 void wait(implementation_type& impl, boost::system::error_code& ec)
Chris@16 139 {
Chris@16 140 service_impl_.wait(impl, ec);
Chris@16 141 }
Chris@16 142
Chris@16 143 /// Start an asynchronous wait.
Chris@16 144 template <typename WaitHandler>
Chris@16 145 BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler,
Chris@16 146 void (boost::system::error_code))
Chris@16 147 async_wait(implementation_type& impl,
Chris@16 148 BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
Chris@16 149 {
Chris@16 150 boost::asio::detail::async_result_init<
Chris@16 151 WaitHandler, void (boost::system::error_code)> init(
Chris@16 152 BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
Chris@16 153
Chris@16 154 service_impl_.async_wait(impl, init.handler);
Chris@16 155
Chris@16 156 return init.result.get();
Chris@16 157 }
Chris@16 158
Chris@16 159 private:
Chris@16 160 // Destroy all user-defined handler objects owned by the service.
Chris@16 161 void shutdown_service()
Chris@16 162 {
Chris@16 163 service_impl_.shutdown_service();
Chris@16 164 }
Chris@16 165
Chris@16 166 // The platform-specific implementation.
Chris@16 167 service_impl_type service_impl_;
Chris@16 168 };
Chris@16 169
Chris@16 170 } // namespace windows
Chris@16 171 } // namespace asio
Chris@16 172 } // namespace boost
Chris@16 173
Chris@16 174 #include <boost/asio/detail/pop_options.hpp>
Chris@16 175
Chris@16 176 #endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
Chris@16 177 // || defined(GENERATING_DOCUMENTATION)
Chris@16 178
Chris@16 179 #endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP