Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / task_io_service_operation.hpp @ 2486

History | View | Annotate | Download (1.9 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// detail/task_io_service_operation.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
//
7 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 2486 sjacqu01
//
10 2486 sjacqu01
11 2486 sjacqu01
#ifndef BOOST_ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP
12 2486 sjacqu01
#define BOOST_ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP
13 2486 sjacqu01
14 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 2486 sjacqu01
# pragma once
16 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 2486 sjacqu01
18 2486 sjacqu01
#include <boost/system/error_code.hpp>
19 2486 sjacqu01
#include <boost/asio/detail/handler_tracking.hpp>
20 2486 sjacqu01
#include <boost/asio/detail/op_queue.hpp>
21 2486 sjacqu01
22 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
23 2486 sjacqu01
24 2486 sjacqu01
namespace boost {
25 2486 sjacqu01
namespace asio {
26 2486 sjacqu01
namespace detail {
27 2486 sjacqu01
28 2486 sjacqu01
class task_io_service;
29 2486 sjacqu01
30 2486 sjacqu01
// Base class for all operations. A function pointer is used instead of virtual
31 2486 sjacqu01
// functions to avoid the associated overhead.
32 2486 sjacqu01
class task_io_service_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER
33 2486 sjacqu01
{
34 2486 sjacqu01
public:
35 2486 sjacqu01
  void complete(task_io_service& owner,
36 2486 sjacqu01
      const boost::system::error_code& ec, std::size_t bytes_transferred)
37 2486 sjacqu01
  {
38 2486 sjacqu01
    func_(&owner, this, ec, bytes_transferred);
39 2486 sjacqu01
  }
40 2486 sjacqu01
41 2486 sjacqu01
  void destroy()
42 2486 sjacqu01
  {
43 2486 sjacqu01
    func_(0, this, boost::system::error_code(), 0);
44 2486 sjacqu01
  }
45 2486 sjacqu01
46 2486 sjacqu01
protected:
47 2486 sjacqu01
  typedef void (*func_type)(task_io_service*,
48 2486 sjacqu01
      task_io_service_operation*,
49 2486 sjacqu01
      const boost::system::error_code&, std::size_t);
50 2486 sjacqu01
51 2486 sjacqu01
  task_io_service_operation(func_type func)
52 2486 sjacqu01
    : next_(0),
53 2486 sjacqu01
      func_(func),
54 2486 sjacqu01
      task_result_(0)
55 2486 sjacqu01
  {
56 2486 sjacqu01
  }
57 2486 sjacqu01
58 2486 sjacqu01
  // Prevents deletion through this type.
59 2486 sjacqu01
  ~task_io_service_operation()
60 2486 sjacqu01
  {
61 2486 sjacqu01
  }
62 2486 sjacqu01
63 2486 sjacqu01
private:
64 2486 sjacqu01
  friend class op_queue_access;
65 2486 sjacqu01
  task_io_service_operation* next_;
66 2486 sjacqu01
  func_type func_;
67 2486 sjacqu01
protected:
68 2486 sjacqu01
  friend class task_io_service;
69 2486 sjacqu01
  unsigned int task_result_; // Passed into bytes transferred.
70 2486 sjacqu01
};
71 2486 sjacqu01
72 2486 sjacqu01
} // namespace detail
73 2486 sjacqu01
} // namespace asio
74 2486 sjacqu01
} // namespace boost
75 2486 sjacqu01
76 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
77 2486 sjacqu01
78 2486 sjacqu01
#endif // BOOST_ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP