Realistic 3D camera system
3D camera system components
task_io_service_operation.hpp
Go to the documentation of this file.
1 //
2 // detail/task_io_service_operation.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_DETAIL_TASK_IO_SERVICE_OPERATION_HPP
12 #define ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_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/error_code.hpp"
20 #include "asio/detail/op_queue.hpp"
21 
23 
24 namespace asio {
25 namespace detail {
26 
27 class task_io_service;
28 
29 // Base class for all operations. A function pointer is used instead of virtual
30 // functions to avoid the associated overhead.
31 class task_io_service_operation ASIO_INHERIT_TRACKED_HANDLER
32 {
33 public:
35  const asio::error_code& ec, std::size_t bytes_transferred)
36  {
37  func_(&owner, this, ec, bytes_transferred);
38  }
39 
40  void destroy()
41  {
42  func_(0, this, asio::error_code(), 0);
43  }
44 
45 protected:
46  typedef void (*func_type)(task_io_service*,
47  task_io_service_operation*,
48  const asio::error_code&, std::size_t);
49 
50  task_io_service_operation(func_type func)
51  : next_(0),
52  func_(func),
53  task_result_(0)
54  {
55  }
56 
57  // Prevents deletion through this type.
59  {
60  }
61 
62 private:
63  friend class op_queue_access;
64  task_io_service_operation* next_;
65  func_type func_;
66 protected:
67  friend class task_io_service;
68  unsigned int task_result_; // Passed into bytes transferred.
69 };
70 
71 } // namespace detail
72 } // namespace asio
73 
75 
76 #endif // ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP
Class to represent an error code value.
Definition: error_code.hpp:80
void complete(task_io_service &owner, const asio::error_code &ec, std::size_t bytes_transferred)