2 // experimental/channel_error.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_EXPERIMENTAL_CHANNEL_ERROR_HPP
12 #define BOOST_ASIO_EXPERIMENTAL_CHANNEL_ERROR_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/system/error_code.hpp>
21 #include <boost/asio/detail/push_options.hpp>
25 namespace experimental {
30 /// The channel was closed.
33 /// The channel was cancelled.
37 extern BOOST_ASIO_DECL
38 const boost::system::error_category& get_channel_category();
40 static const boost::system::error_category&
41 channel_category BOOST_ASIO_UNUSED_VARIABLE
42 = boost::asio::experimental::error::get_channel_category();
45 namespace channel_errc {
46 // Simulates a scoped enum.
47 using error::channel_closed;
48 using error::channel_cancelled;
49 } // namespace channel_errc
50 } // namespace experimental
57 template<> struct is_error_code_enum<
58 boost::asio::experimental::error::channel_errors>
60 static const bool value = true;
68 namespace experimental {
71 inline boost::system::error_code make_error_code(channel_errors e)
73 return boost::system::error_code(
74 static_cast<int>(e), get_channel_category());
78 } // namespace experimental
82 #include <boost/asio/detail/pop_options.hpp>
84 #if defined(BOOST_ASIO_HEADER_ONLY)
85 # include <boost/asio/experimental/impl/channel_error.ipp>
86 #endif // defined(BOOST_ASIO_HEADER_ONLY)
88 #endif // BOOST_ASIO_EXPERIMENTAL_CHANNEL_ERROR_HPP