xref: /openbmc/sdbusplus/include/sdbusplus/async/stdexec/__detail/__execution_fwd.hpp (revision 10d0b4b7d1498cfd5c3d37edea271a54d1984e41)
1 /*
2  * Copyright (c) 2023 NVIDIA Corporation
3  *
4  * Licensed under the Apache License Version 2.0 with LLVM Exceptions
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *   https://llvm.org/LICENSE.txt
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "__config.hpp" // IWYU pragma: export
19 #include "__meta.hpp"
20 #include "__concepts.hpp"
21 #include "__type_traits.hpp"
22 
23 // IWYU pragma: always_keep
24 
25 namespace stdexec {
26   struct __none_such;
27 
28   //////////////////////////////////////////////////////////////////////////////////////////////////
29   struct default_domain;
30 
31   //////////////////////////////////////////////////////////////////////////////////////////////////
32   namespace __rcvrs {
33     struct set_value_t;
34     struct set_error_t;
35     struct set_stopped_t;
36   } // namespace __rcvrs
37 
38   using __rcvrs::set_value_t;
39   using __rcvrs::set_error_t;
40   using __rcvrs::set_stopped_t;
41   extern const set_value_t set_value;
42   extern const set_error_t set_error;
43   extern const set_stopped_t set_stopped;
44 
45   template <class _Tag>
46   concept __completion_tag = __one_of<_Tag, set_value_t, set_error_t, set_stopped_t>;
47 
48   struct receiver_t;
49 
50   template <class _Sender>
51   extern const bool enable_receiver;
52 
53   namespace __env {
54     template <class _Query, class _Value>
55     struct prop;
56 
57     template <class _Query, auto _Value>
58     struct cprop;
59 
60     template <class... _Envs>
61     struct env;
62   } // namespace __env
63 
64   using __env::prop;
65   using __env::cprop;
66   using __env::env;
67   using empty_env [[deprecated("stdexec::empty_env is now spelled stdexec::env<>")]] = env<>;
68 
69   //////////////////////////////////////////////////////////////////////////////////////////////////
70   namespace __get_env {
71     struct get_env_t;
72   } // namespace __get_env
73 
74   using __get_env::get_env_t;
75   extern const get_env_t get_env;
76 
77   template <class _EnvProvider>
78   using env_of_t = __call_result_t<get_env_t, _EnvProvider>;
79 
80   //////////////////////////////////////////////////////////////////////////////////////////////////
81   enum class forward_progress_guarantee {
82     concurrent,
83     parallel,
84     weakly_parallel
85   };
86 
87   namespace __queries {
88     struct forwarding_query_t;
89     struct execute_may_block_caller_t;
90     struct get_forward_progress_guarantee_t;
91     struct get_scheduler_t;
92     struct get_delegation_scheduler_t;
93     struct get_allocator_t;
94     struct get_stop_token_t;
95     template <__completion_tag _CPO>
96     struct get_completion_scheduler_t;
97     struct get_domain_t;
98   } // namespace __queries
99 
100   using __queries::forwarding_query_t;
101   using __queries::execute_may_block_caller_t;
102   using __queries::get_forward_progress_guarantee_t;
103   using __queries::get_allocator_t;
104   using __queries::get_scheduler_t;
105   using __queries::get_delegation_scheduler_t;
106   using __queries::get_stop_token_t;
107   using __queries::get_completion_scheduler_t;
108   using __queries::get_domain_t;
109 
110   extern const forwarding_query_t forwarding_query;
111   extern const execute_may_block_caller_t execute_may_block_caller;
112   extern const get_forward_progress_guarantee_t get_forward_progress_guarantee;
113   extern const get_scheduler_t get_scheduler;
114   extern const get_delegation_scheduler_t get_delegation_scheduler;
115   extern const get_allocator_t get_allocator;
116   extern const get_stop_token_t get_stop_token;
117   template <__completion_tag _CPO>
118   extern const get_completion_scheduler_t<_CPO> get_completion_scheduler;
119   extern const get_domain_t get_domain;
120 
121   struct never_stop_token;
122   class inplace_stop_source;
123   class inplace_stop_token;
124   template <class _Fn>
125   class inplace_stop_callback;
126 
127   template <class _Tp>
128   using stop_token_of_t = __decay_t<__call_result_t<get_stop_token_t, _Tp>>;
129 
130   template <class _Sender, class _CPO>
131   concept __has_completion_scheduler =
132     __callable<get_completion_scheduler_t<_CPO>, env_of_t<const _Sender&>>;
133 
134   template <class _Sender, class _CPO>
135   using __completion_scheduler_for =
136     __call_result_t<get_completion_scheduler_t<_CPO>, env_of_t<const _Sender&>>;
137 
138   template <class _Env>
139   using __domain_of_t = __decay_t<__call_result_t<get_domain_t, _Env>>;
140 
141   //////////////////////////////////////////////////////////////////////////////////////////////////
142   namespace __sigs {
143     template <class _Sig>
144     inline constexpr bool __is_compl_sig = false;
145 
146     struct get_completion_signatures_t;
147   } // namespace __sigs
148 
149   template <class _Sig>
150   concept __completion_signature = __sigs::__is_compl_sig<_Sig>;
151 
152   template <class... _Sigs>
153   struct completion_signatures;
154 
155   using __sigs::get_completion_signatures_t;
156   extern const get_completion_signatures_t get_completion_signatures;
157 
158   template <class _Sender, class... _Env>
159   using __completion_signatures_of_t =
160     __call_result_t<get_completion_signatures_t, _Sender, _Env...>;
161 
162   //////////////////////////////////////////////////////////////////////////////////////////////////
163   namespace __connect {
164     struct connect_t;
165   } // namespace __connect
166 
167   using __connect::connect_t;
168   extern const connect_t connect;
169 
170   template <class _Sender, class _Receiver>
171   concept __nothrow_connectable = __nothrow_callable<connect_t, _Sender, _Receiver>;
172 
173   struct sender_t;
174 
175   template <class _Sender>
176   extern const bool enable_sender;
177 
178   //////////////////////////////////////////////////////////////////////////////////////////////////
179   struct operation_state_t;
180 
181   namespace __start {
182     struct start_t;
183   } // namespace __start
184 
185   using __start::start_t;
186   extern const start_t start;
187 
188   //////////////////////////////////////////////////////////////////////////////////////////////////
189   namespace __sched {
190     struct schedule_t;
191   } // namespace __sched
192 
193   using __sched::schedule_t;
194   extern const schedule_t schedule;
195 
196   struct scheduler_t;
197 
198   //////////////////////////////////////////////////////////////////////////////////////////////////
199   namespace __as_awaitable {
200     struct as_awaitable_t;
201   } // namespace __as_awaitable
202 
203   using __as_awaitable::as_awaitable_t;
204   extern const as_awaitable_t as_awaitable;
205 
206   //////////////////////////////////////////////////////////////////////////////////////////////////
207   struct transform_sender_t;
208   extern const transform_sender_t transform_sender;
209 
210   template <class _Domain, class _Sender, class... _Env>
211   using transform_sender_result_t = __call_result_t<transform_sender_t, _Domain, _Sender, _Env...>;
212 
213   //////////////////////////////////////////////////////////////////////////////////////////////////
214   namespace __starts_on_ns {
215     struct starts_on_t;
216   } // namespace __starts_on_ns
217 
218   using __starts_on_ns::starts_on_t;
219   extern const starts_on_t starts_on;
220 
221   using start_on_t [[deprecated("start_on_t has been renamed starts_on_t")]] = starts_on_t;
222   [[deprecated("start_on has been renamed starts_on")]]
223   extern const starts_on_t start_on;
224 
225   //////////////////////////////////////////////////////////////////////////////////////////////////
226   namespace __schfr {
227     struct schedule_from_t;
228   } // namespace __schfr
229 
230   using __schfr::schedule_from_t;
231   extern const schedule_from_t schedule_from;
232 
233   namespace __continues_on {
234     struct continues_on_t;
235   } // namespace __continues_on
236 
237   using __continues_on::continues_on_t;
238   extern const continues_on_t continues_on;
239 
240   using transfer_t [[deprecated("transfer_t has been renamed continues_on_t")]] = continues_on_t;
241   [[deprecated("transfer has been renamed continues_on")]]
242   extern const continues_on_t transfer;
243 
244   using continue_t [[deprecated("continue_on_t has been renamed continues_on_t")]] = continues_on_t;
245   [[deprecated("continue_on has been renamed continues_on")]]
246   extern const continues_on_t continue_on;
247 
248   //////////////////////////////////////////////////////////////////////////////////////////////////
249   namespace __transfer_just {
250     struct transfer_just_t;
251   } // namespace __transfer_just
252 
253   using __transfer_just::transfer_just_t;
254   extern const transfer_just_t transfer_just;
255 
256   //////////////////////////////////////////////////////////////////////////////////////////////////
257   namespace __bulk {
258     struct bulk_t;
259     struct bulk_chunked_t;
260     struct bulk_unchunked_t;
261   } // namespace __bulk
262 
263   using __bulk::bulk_t;
264   using __bulk::bulk_chunked_t;
265   using __bulk::bulk_unchunked_t;
266   extern const bulk_t bulk;
267   extern const bulk_chunked_t bulk_chunked;
268   extern const bulk_unchunked_t bulk_unchunked;
269 
270   //////////////////////////////////////////////////////////////////////////////////////////////////
271   namespace __split {
272     struct split_t;
273     struct __split_t;
274   } // namespace __split
275 
276   using __split::split_t;
277   extern const split_t split;
278 
279   //////////////////////////////////////////////////////////////////////////////////////////////////
280   namespace __ensure_started {
281     struct ensure_started_t;
282     struct __ensure_started_t;
283   } // namespace __ensure_started
284 
285   using __ensure_started::ensure_started_t;
286   extern const ensure_started_t ensure_started;
287 
288   //////////////////////////////////////////////////////////////////////////////////////////////////
289   namespace __on {
290     struct on_t;
291   } // namespace __on
292 
293   using __on::on_t;
294   extern const on_t on;
295 
296   namespace __detail {
297     struct __sexpr_apply_t;
298   } // namespace __detail
299 
300   using __detail::__sexpr_apply_t;
301   extern const __sexpr_apply_t __sexpr_apply;
302 } // namespace stdexec
303 
304 template <class...>
305 [[deprecated]]
__print()306 void __print() {
307 }
308 
309 template <class...>
310 struct __undef;
311