]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/cancellation_type.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / cancellation_type.hpp
1 //
2 // cancellation_type.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2022 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 BOOST_ASIO_CANCELLATION_TYPE_HPP
12 #define BOOST_ASIO_CANCELLATION_TYPE_HPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18 #include <boost/asio/detail/config.hpp>
19
20 #include <boost/asio/detail/push_options.hpp>
21
22 namespace boost {
23 namespace asio {
24
25 # if defined(GENERATING_DOCUMENTATION)
26
27 /// Enumeration representing the different types of cancellation that may
28 /// be requested from or implemented by an asynchronous operation.
29 enum cancellation_type
30 {
31 /// Bitmask representing no types of cancellation.
32 none = 0,
33
34 /// Requests cancellation where, following a successful cancellation, the only
35 /// safe operations on the I/O object are closure or destruction.
36 terminal = 1,
37
38 /// Requests cancellation where a successful cancellation may result in
39 /// partial side effects or no side effects. Following cancellation, the I/O
40 /// object is in a well-known state, and may be used for further operations.
41 partial = 2,
42
43 /// Requests cancellation where a successful cancellation results in no
44 /// apparent side effects. Following cancellation, the I/O object is in the
45 /// same observable state as it was prior to the operation.
46 total = 4,
47
48 /// Bitmask representing all types of cancellation.
49 all = 0xFFFFFFFF
50 };
51
52 /// Portability typedef.
53 typedef cancellation_type cancellation_type_t;
54
55 #elif defined(BOOST_ASIO_HAS_ENUM_CLASS)
56
57 enum class cancellation_type : unsigned int
58 {
59 none = 0,
60 terminal = 1,
61 partial = 2,
62 total = 4,
63 all = 0xFFFFFFFF
64 };
65
66 typedef cancellation_type cancellation_type_t;
67
68 #else // defined(BOOST_ASIO_HAS_ENUM_CLASS)
69
70 namespace cancellation_type {
71
72 enum cancellation_type_t
73 {
74 none = 0,
75 terminal = 1,
76 partial = 2,
77 total = 4,
78 all = 0xFFFFFFFF
79 };
80
81 } // namespace cancellation_type
82
83 typedef cancellation_type::cancellation_type_t cancellation_type_t;
84
85 #endif // defined(BOOST_ASIO_HAS_ENUM_CLASS)
86
87 /// Negation operator.
88 /**
89 * @relates cancellation_type
90 */
91 inline BOOST_ASIO_CONSTEXPR bool operator!(cancellation_type_t x)
92 {
93 return static_cast<unsigned int>(x) == 0;
94 }
95
96 /// Bitwise and operator.
97 /**
98 * @relates cancellation_type
99 */
100 inline BOOST_ASIO_CONSTEXPR cancellation_type_t operator&(
101 cancellation_type_t x, cancellation_type_t y)
102 {
103 return static_cast<cancellation_type_t>(
104 static_cast<unsigned int>(x) & static_cast<unsigned int>(y));
105 }
106
107 /// Bitwise or operator.
108 /**
109 * @relates cancellation_type
110 */
111 inline BOOST_ASIO_CONSTEXPR cancellation_type_t operator|(
112 cancellation_type_t x, cancellation_type_t y)
113 {
114 return static_cast<cancellation_type_t>(
115 static_cast<unsigned int>(x) | static_cast<unsigned int>(y));
116 }
117
118 /// Bitwise xor operator.
119 /**
120 * @relates cancellation_type
121 */
122 inline BOOST_ASIO_CONSTEXPR cancellation_type_t operator^(
123 cancellation_type_t x, cancellation_type_t y)
124 {
125 return static_cast<cancellation_type_t>(
126 static_cast<unsigned int>(x) ^ static_cast<unsigned int>(y));
127 }
128
129 /// Bitwise negation operator.
130 /**
131 * @relates cancellation_type
132 */
133 inline BOOST_ASIO_CONSTEXPR cancellation_type_t operator~(cancellation_type_t x)
134 {
135 return static_cast<cancellation_type_t>(~static_cast<unsigned int>(x));
136 }
137
138 /// Bitwise and-assignment operator.
139 /**
140 * @relates cancellation_type
141 */
142 inline cancellation_type_t& operator&=(
143 cancellation_type_t& x, cancellation_type_t y)
144 {
145 x = x & y;
146 return x;
147 }
148
149 /// Bitwise or-assignment operator.
150 /**
151 * @relates cancellation_type
152 */
153 inline cancellation_type_t& operator|=(
154 cancellation_type_t& x, cancellation_type_t y)
155 {
156 x = x | y;
157 return x;
158 }
159
160 /// Bitwise xor-assignment operator.
161 /**
162 * @relates cancellation_type
163 */
164 inline cancellation_type_t& operator^=(
165 cancellation_type_t& x, cancellation_type_t y)
166 {
167 x = x ^ y;
168 return x;
169 }
170
171 } // namespace asio
172 } // namespace boost
173
174 #include <boost/asio/detail/pop_options.hpp>
175
176 #endif // BOOST_ASIO_CANCELLATION_TYPE_HPP