Realistic 3D camera system
3D camera system components
base_from_completion_cond.hpp
Go to the documentation of this file.
1 //
2 // detail/base_from_completion_cond.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_BASE_FROM_COMPLETION_COND_HPP
12 #define ASIO_DETAIL_BASE_FROM_COMPLETION_COND_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"
20 
22 
23 namespace asio {
24 namespace detail {
25 
26 template <typename CompletionCondition>
28 {
29 protected:
30  explicit base_from_completion_cond(CompletionCondition completion_condition)
31  : completion_condition_(completion_condition)
32  {
33  }
34 
35  std::size_t check_for_completion(
36  const asio::error_code& ec,
37  std::size_t total_transferred)
38  {
40  completion_condition_(ec, total_transferred));
41  }
42 
43 private:
44  CompletionCondition completion_condition_;
45 };
46 
47 template <>
49 {
50 protected:
52  {
53  }
54 
55  static std::size_t check_for_completion(
56  const asio::error_code& ec,
57  std::size_t total_transferred)
58  {
59  return transfer_all_t()(ec, total_transferred);
60  }
61 };
62 
63 } // namespace detail
64 } // namespace asio
65 
67 
68 #endif // ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
std::size_t check_for_completion(const asio::error_code &ec, std::size_t total_transferred)
Class to represent an error code value.
Definition: error_code.hpp:80
static std::size_t check_for_completion(const asio::error_code &ec, std::size_t total_transferred)
std::size_t adapt_completion_condition_result(bool result)
const MutableBufferSequence CompletionCondition completion_condition
Definition: read.hpp:521
base_from_completion_cond(CompletionCondition completion_condition)