Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:37

0001 //
0002 // detail/base_from_completion_cond.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
0012 #define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/completion_condition.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace detail {
0026 
0027 template <typename CompletionCondition>
0028 class base_from_completion_cond
0029 {
0030 protected:
0031   explicit base_from_completion_cond(CompletionCondition& completion_condition)
0032     : completion_condition_(
0033         static_cast<CompletionCondition&&>(completion_condition))
0034   {
0035   }
0036 
0037   std::size_t check_for_completion(
0038       const boost::system::error_code& ec,
0039       std::size_t total_transferred)
0040   {
0041     return detail::adapt_completion_condition_result(
0042         completion_condition_(ec, total_transferred));
0043   }
0044 
0045 private:
0046   CompletionCondition completion_condition_;
0047 };
0048 
0049 template <>
0050 class base_from_completion_cond<transfer_all_t>
0051 {
0052 protected:
0053   explicit base_from_completion_cond(transfer_all_t)
0054   {
0055   }
0056 
0057   static std::size_t check_for_completion(
0058       const boost::system::error_code& ec,
0059       std::size_t total_transferred)
0060   {
0061     return transfer_all_t()(ec, total_transferred);
0062   }
0063 };
0064 
0065 } // namespace detail
0066 } // namespace asio
0067 } // namespace boost
0068 
0069 #include <boost/asio/detail/pop_options.hpp>
0070 
0071 #endif // BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP