Realistic 3D camera system
3D camera system components
overlapped_ptr.hpp
Go to the documentation of this file.
1 //
2 // windows/overlapped_ptr.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_WINDOWS_OVERLAPPED_PTR_HPP
12 #define ASIO_WINDOWS_OVERLAPPED_PTR_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR) \
21  || defined(GENERATING_DOCUMENTATION)
22 
25 #include "asio/io_service.hpp"
26 
28 
29 namespace asio {
30 namespace windows {
31 
33 
41 class overlapped_ptr
42  : private noncopyable
43 {
44 public:
46  overlapped_ptr()
47  : impl_()
48  {
49  }
50 
52  template <typename Handler>
53  explicit overlapped_ptr(asio::io_service& io_service,
54  ASIO_MOVE_ARG(Handler) handler)
55  : impl_(io_service, ASIO_MOVE_CAST(Handler)(handler))
56  {
57  }
58 
60  ~overlapped_ptr()
61  {
62  }
63 
65  void reset()
66  {
67  impl_.reset();
68  }
69 
72  template <typename Handler>
73  void reset(asio::io_service& io_service,
74  ASIO_MOVE_ARG(Handler) handler)
75  {
76  impl_.reset(io_service, ASIO_MOVE_CAST(Handler)(handler));
77  }
78 
80  OVERLAPPED* get()
81  {
82  return impl_.get();
83  }
84 
86  const OVERLAPPED* get() const
87  {
88  return impl_.get();
89  }
90 
92  OVERLAPPED* release()
93  {
94  return impl_.release();
95  }
96 
98  void complete(const asio::error_code& ec,
99  std::size_t bytes_transferred)
100  {
101  impl_.complete(ec, bytes_transferred);
102  }
103 
104 private:
105  detail::win_iocp_overlapped_ptr impl_;
106 };
107 
108 } // namespace windows
109 } // namespace asio
110 
112 
113 #endif // defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
114  // || defined(GENERATING_DOCUMENTATION)
115 
116 #endif // ASIO_WINDOWS_OVERLAPPED_PTR_HPP
Provides core I/O functionality.
Definition: io_service.hpp:184
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
#define ASIO_MOVE_CAST(type)
Definition: config.hpp:138