Statistics
| Revision:

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

History | View | Annotate | Download (2.6 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// async_result.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_ASYNC_RESULT_HPP
12 2486 sjacqu01
#define BOOST_ASIO_ASYNC_RESULT_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/asio/detail/config.hpp>
19 2486 sjacqu01
#include <boost/asio/handler_type.hpp>
20 2486 sjacqu01
21 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
22 2486 sjacqu01
23 2486 sjacqu01
namespace boost {
24 2486 sjacqu01
namespace asio {
25 2486 sjacqu01
26 2486 sjacqu01
/// An interface for customising the behaviour of an initiating function.
27 2486 sjacqu01
/**
28 2486 sjacqu01
 * This template may be specialised for user-defined handler types.
29 2486 sjacqu01
 */
30 2486 sjacqu01
template <typename Handler>
31 2486 sjacqu01
class async_result
32 2486 sjacqu01
{
33 2486 sjacqu01
public:
34 2486 sjacqu01
  /// The return type of the initiating function.
35 2486 sjacqu01
  typedef void type;
36 2486 sjacqu01
37 2486 sjacqu01
  /// Construct an async result from a given handler.
38 2486 sjacqu01
  /**
39 2486 sjacqu01
   * When using a specalised async_result, the constructor has an opportunity
40 2486 sjacqu01
   * to initialise some state associated with the handler, which is then
41 2486 sjacqu01
   * returned from the initiating function.
42 2486 sjacqu01
   */
43 2486 sjacqu01
  explicit async_result(Handler&)
44 2486 sjacqu01
  {
45 2486 sjacqu01
  }
46 2486 sjacqu01
47 2486 sjacqu01
  /// Obtain the value to be returned from the initiating function.
48 2486 sjacqu01
  type get()
49 2486 sjacqu01
  {
50 2486 sjacqu01
  }
51 2486 sjacqu01
};
52 2486 sjacqu01
53 2486 sjacqu01
namespace detail {
54 2486 sjacqu01
55 2486 sjacqu01
// Helper template to deduce the true type of a handler, capture a local copy
56 2486 sjacqu01
// of the handler, and then create an async_result for the handler.
57 2486 sjacqu01
template <typename Handler, typename Signature>
58 2486 sjacqu01
struct async_result_init
59 2486 sjacqu01
{
60 2486 sjacqu01
  explicit async_result_init(BOOST_ASIO_MOVE_ARG(Handler) orig_handler)
61 2486 sjacqu01
    : handler(BOOST_ASIO_MOVE_CAST(Handler)(orig_handler)),
62 2486 sjacqu01
      result(handler)
63 2486 sjacqu01
  {
64 2486 sjacqu01
  }
65 2486 sjacqu01
66 2486 sjacqu01
  typename handler_type<Handler, Signature>::type handler;
67 2486 sjacqu01
  async_result<typename handler_type<Handler, Signature>::type> result;
68 2486 sjacqu01
};
69 2486 sjacqu01
70 2486 sjacqu01
template <typename Handler, typename Signature>
71 2486 sjacqu01
struct async_result_type_helper
72 2486 sjacqu01
{
73 2486 sjacqu01
  typedef typename async_result<
74 2486 sjacqu01
      typename handler_type<Handler, Signature>::type
75 2486 sjacqu01
    >::type type;
76 2486 sjacqu01
};
77 2486 sjacqu01
78 2486 sjacqu01
} // namespace detail
79 2486 sjacqu01
} // namespace asio
80 2486 sjacqu01
} // namespace boost
81 2486 sjacqu01
82 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
83 2486 sjacqu01
84 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
85 2486 sjacqu01
# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \
86 2486 sjacqu01
  void_or_deduced
87 2486 sjacqu01
#elif defined(_MSC_VER) && (_MSC_VER < 1500)
88 2486 sjacqu01
# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \
89 2486 sjacqu01
  typename ::boost::asio::detail::async_result_type_helper<h, sig>::type
90 2486 sjacqu01
#else
91 2486 sjacqu01
# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \
92 2486 sjacqu01
  typename ::boost::asio::async_result< \
93 2486 sjacqu01
    typename ::boost::asio::handler_type<h, sig>::type>::type
94 2486 sjacqu01
#endif
95 2486 sjacqu01
96 2486 sjacqu01
#endif // BOOST_ASIO_ASYNC_RESULT_HPP