]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // Copyright Oliver Kowalke 2014. | |
3 | // Distributed under the Boost Software License, Version 1.0. | |
4 | // (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | #ifndef BOOST_COROUTINES2_DETAIL_ASYMMETRIC_COROUTINE_HPP | |
8 | #define BOOST_COROUTINES2_DETAIL_ASYMMETRIC_COROUTINE_HPP | |
9 | ||
10 | #include <exception> | |
11 | ||
12 | #include <boost/assert.hpp> | |
13 | #include <boost/config.hpp> | |
14 | ||
15 | #include <boost/coroutine2/detail/config.hpp> | |
16 | ||
17 | #ifdef BOOST_HAS_ABI_HEADERS | |
18 | # include BOOST_ABI_PREFIX | |
19 | #endif | |
20 | ||
21 | namespace boost { | |
22 | namespace coroutines2 { | |
23 | namespace detail { | |
24 | ||
25 | enum class state_t : unsigned int { | |
26 | none = 0, | |
27 | complete = 1 << 1, | |
28 | unwind = 1 << 2, | |
29 | destroy = 1 << 3 | |
30 | }; | |
31 | ||
32 | ||
33 | inline | |
34 | constexpr state_t | |
35 | operator&( state_t l, state_t r) { | |
36 | return static_cast< state_t >( | |
37 | static_cast< unsigned int >( l) & static_cast< unsigned int >( r) ); | |
38 | } | |
39 | ||
40 | inline | |
41 | constexpr state_t | |
42 | operator|( state_t l, state_t r) { | |
43 | return static_cast< state_t >( | |
44 | static_cast< unsigned int >( l) | static_cast< unsigned int >( r) ); | |
45 | } | |
46 | ||
47 | inline | |
48 | constexpr state_t | |
49 | operator^( state_t l, state_t r) { | |
50 | return static_cast< state_t >( | |
51 | static_cast< unsigned int >( l) ^ static_cast< unsigned int >( r) ); | |
52 | } | |
53 | ||
54 | inline | |
55 | constexpr state_t | |
56 | operator~( state_t l) { | |
57 | return static_cast< state_t >( ~static_cast< unsigned int >( l) ); | |
58 | } | |
59 | ||
60 | inline | |
61 | state_t & | |
62 | operator&=( state_t & l, state_t r) { | |
63 | l = l & r; | |
64 | return l; | |
65 | } | |
66 | ||
67 | inline | |
68 | state_t & | |
69 | operator|=( state_t & l, state_t r) { | |
70 | l = l | r; | |
71 | return l; | |
72 | } | |
73 | ||
74 | inline | |
75 | state_t & | |
76 | operator^=( state_t & l, state_t r) { | |
77 | l = l ^ r; | |
78 | return l; | |
79 | } | |
80 | ||
81 | }}} | |
82 | ||
83 | #ifdef BOOST_HAS_ABI_HEADERS | |
84 | # include BOOST_ABI_SUFFIX | |
85 | #endif | |
86 | ||
87 | #endif // BOOST_COROUTINES2_DETAIL_ASYMMETRIC_COROUTINE_HPP |