Realistic 3D camera system
3D camera system components
object_handle_service.hpp
Go to the documentation of this file.
1 //
2 // windows/object_handle_service.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 // Copyright (c) 2011 Boris Schaeling (boris@highscore.de)
7 //
8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 //
11 
12 #ifndef ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP
13 #define ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP
14 
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 # pragma once
17 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 
19 #include "asio/detail/config.hpp"
20 
21 #if defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) \
22  || defined(GENERATING_DOCUMENTATION)
23 
24 #include "asio/async_result.hpp"
26 #include "asio/error.hpp"
27 #include "asio/io_service.hpp"
28 
30 
31 namespace asio {
32 namespace windows {
33 
35 class object_handle_service
36 #if defined(GENERATING_DOCUMENTATION)
38 #else
39  : public asio::detail::service_base<object_handle_service>
40 #endif
41 {
42 public:
43 #if defined(GENERATING_DOCUMENTATION)
44  static asio::io_service::id id;
46 #endif
47 
48 private:
49  // The type of the platform-specific implementation.
50  typedef detail::win_object_handle_service service_impl_type;
51 
52 public:
54 #if defined(GENERATING_DOCUMENTATION)
55  typedef implementation_defined implementation_type;
56 #else
57  typedef service_impl_type::implementation_type implementation_type;
58 #endif
59 
61 #if defined(GENERATING_DOCUMENTATION)
62  typedef implementation_defined native_handle_type;
63 #else
64  typedef service_impl_type::native_handle_type native_handle_type;
65 #endif
66 
68  explicit object_handle_service(asio::io_service& io_service)
69  : asio::detail::service_base<object_handle_service>(io_service),
70  service_impl_(io_service)
71  {
72  }
73 
75  void construct(implementation_type& impl)
76  {
77  service_impl_.construct(impl);
78  }
79 
80 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
81  void move_construct(implementation_type& impl,
83  implementation_type& other_impl)
84  {
85  service_impl_.move_construct(impl, other_impl);
86  }
87 
89  void move_assign(implementation_type& impl,
90  object_handle_service& other_service,
91  implementation_type& other_impl)
92  {
93  service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
94  }
95 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
96 
98  void destroy(implementation_type& impl)
99  {
100  service_impl_.destroy(impl);
101  }
102 
104  asio::error_code assign(implementation_type& impl,
105  const native_handle_type& handle, asio::error_code& ec)
106  {
107  return service_impl_.assign(impl, handle, ec);
108  }
109 
111  bool is_open(const implementation_type& impl) const
112  {
113  return service_impl_.is_open(impl);
114  }
115 
117  asio::error_code close(implementation_type& impl,
118  asio::error_code& ec)
119  {
120  return service_impl_.close(impl, ec);
121  }
122 
124  native_handle_type native_handle(implementation_type& impl)
125  {
126  return service_impl_.native_handle(impl);
127  }
128 
130  asio::error_code cancel(implementation_type& impl,
131  asio::error_code& ec)
132  {
133  return service_impl_.cancel(impl, ec);
134  }
135 
136  // Wait for a signaled state.
137  void wait(implementation_type& impl, asio::error_code& ec)
138  {
139  service_impl_.wait(impl, ec);
140  }
141 
143  template <typename WaitHandler>
144  ASIO_INITFN_RESULT_TYPE(WaitHandler,
145  void (asio::error_code))
146  async_wait(implementation_type& impl,
147  ASIO_MOVE_ARG(WaitHandler) handler)
148  {
150  WaitHandler, void (asio::error_code)> init(
151  ASIO_MOVE_CAST(WaitHandler)(handler));
152 
153  service_impl_.async_wait(impl, init.handler);
154 
155  return init.result.get();
156  }
157 
158 private:
159  // Destroy all user-defined handler objects owned by the service.
160  void shutdown_service()
161  {
162  service_impl_.shutdown_service();
163  }
164 
165  // The platform-specific implementation.
166  service_impl_type service_impl_;
167 };
168 
169 } // namespace windows
170 } // namespace asio
171 
173 
174 #endif // defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
175  // || defined(GENERATING_DOCUMENTATION)
176 
177 #endif // ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP
Class used to uniquely identify a service.
Definition: io_service.hpp:665
Provides core I/O functionality.
Definition: io_service.hpp:184
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
Definition: read.hpp:704
Class to represent an error code value.
Definition: error_code.hpp:80
ASIO_DECL int close(int d, state_type &state, asio::error_code &ec)
#define ASIO_MOVE_CAST(type)
Definition: config.hpp:138
Base class for all io_service services.
Definition: io_service.hpp:674