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 "__concepts.hpp"
19 #include "__config.hpp"
20 #include "__meta.hpp"
21 #include "__type_traits.hpp"
22
23 namespace stdexec
24 {
25 struct __none_such;
26
27 //////////////////////////////////////////////////////////////////////////////////////////////////
28 struct default_domain;
29
30 //////////////////////////////////////////////////////////////////////////////////////////////////
31 namespace __rcvrs
32 {
33 struct set_value_t;
34 struct set_error_t;
35 struct set_stopped_t;
36 } // namespace __rcvrs
37
38 using __rcvrs::set_error_t;
39 using __rcvrs::set_stopped_t;
40 using __rcvrs::set_value_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 =
47 __one_of<_Tag, set_value_t, set_error_t, set_stopped_t>;
48
49 struct receiver_t;
50
51 template <class _Sender>
52 extern const bool enable_receiver;
53
54 namespace __env
55 {
56 template <class _Query, class _Value>
57 struct prop;
58
59 template <class... _Envs>
60 struct env;
61 } // namespace __env
62
63 using __env::env;
64 using __env::prop;
65 using empty_env = env<>;
66
67 //////////////////////////////////////////////////////////////////////////////////////////////////
68 namespace __get_env
69 {
70 struct get_env_t;
71 } // namespace __get_env
72
73 using __get_env::get_env_t;
74 extern const get_env_t get_env;
75
76 template <class _EnvProvider>
77 using env_of_t = __call_result_t<get_env_t, _EnvProvider>;
78
79 //////////////////////////////////////////////////////////////////////////////////////////////////
80 enum class forward_progress_guarantee
81 {
82 concurrent,
83 parallel,
84 weakly_parallel
85 };
86
87 namespace __queries
88 {
89 struct forwarding_query_t;
90 struct execute_may_block_caller_t;
91 struct get_forward_progress_guarantee_t;
92 struct __has_algorithm_customizations_t;
93 struct get_scheduler_t;
94 struct get_delegation_scheduler_t;
95 struct get_allocator_t;
96 struct get_stop_token_t;
97 template <__completion_tag _CPO>
98 struct get_completion_scheduler_t;
99 } // namespace __queries
100
101 using __queries::__has_algorithm_customizations_t;
102 using __queries::execute_may_block_caller_t;
103 using __queries::forwarding_query_t;
104 using __queries::get_allocator_t;
105 using __queries::get_completion_scheduler_t;
106 using __queries::get_delegation_scheduler_t;
107 using __queries::get_forward_progress_guarantee_t;
108 using __queries::get_scheduler_t;
109 using __queries::get_stop_token_t;
110
111 extern const forwarding_query_t forwarding_query;
112 extern const execute_may_block_caller_t execute_may_block_caller;
113 extern const __has_algorithm_customizations_t __has_algorithm_customizations;
114 extern const get_forward_progress_guarantee_t get_forward_progress_guarantee;
115 extern const get_scheduler_t get_scheduler;
116 extern const get_delegation_scheduler_t get_delegation_scheduler;
117 extern const get_allocator_t get_allocator;
118 extern const get_stop_token_t get_stop_token;
119 template <__completion_tag _CPO>
120 extern const get_completion_scheduler_t<_CPO> get_completion_scheduler;
121
122 struct never_stop_token;
123 class inplace_stop_source;
124 class inplace_stop_token;
125 template <class _Fn>
126 class inplace_stop_callback;
127
128 template <class _Tp>
129 using stop_token_of_t = __decay_t<__call_result_t<get_stop_token_t, _Tp>>;
130
131 template <class _Sender, class _CPO>
132 concept __has_completion_scheduler =
133 __callable<get_completion_scheduler_t<_CPO>, env_of_t<const _Sender&>>;
134
135 template <class _Sender, class _CPO>
136 using __completion_scheduler_for =
137 __call_result_t<get_completion_scheduler_t<_CPO>, env_of_t<const _Sender&>>;
138
139 //////////////////////////////////////////////////////////////////////////////////////////////////
140 namespace __sigs
141 {
142 template <class _Sig>
143 inline constexpr bool __is_compl_sig = false;
144
145 struct get_completion_signatures_t;
146 } // namespace __sigs
147
148 template <class _Sig>
149 concept __completion_signature = __sigs::__is_compl_sig<_Sig>;
150
151 template <class... _Sigs>
152 struct completion_signatures;
153
154 using __sigs::get_completion_signatures_t;
155 extern const get_completion_signatures_t get_completion_signatures;
156
157 template <class _Sender, class... _Env>
158 using __completion_signatures_of_t = //
159 __call_result_t<get_completion_signatures_t, _Sender, _Env...>;
160
161 //////////////////////////////////////////////////////////////////////////////////////////////////
162 namespace __connect
163 {
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 using connect_result_t = __call_result_t<connect_t, _Sender, _Receiver>;
172
173 template <class _Sender, class _Receiver>
174 concept __nothrow_connectable =
175 __nothrow_callable<connect_t, _Sender, _Receiver>;
176
177 struct sender_t;
178
179 template <class _Sender>
180 extern const bool enable_sender;
181
182 //////////////////////////////////////////////////////////////////////////////////////////////////
183 namespace __start
184 {
185 struct start_t;
186 } // namespace __start
187
188 using __start::start_t;
189 extern const start_t start;
190
191 //////////////////////////////////////////////////////////////////////////////////////////////////
192 namespace __sched
193 {
194 struct schedule_t;
195 } // namespace __sched
196
197 using __sched::schedule_t;
198 extern const schedule_t schedule;
199
200 //////////////////////////////////////////////////////////////////////////////////////////////////
201 namespace __as_awaitable
202 {
203 struct as_awaitable_t;
204 } // namespace __as_awaitable
205
206 using __as_awaitable::as_awaitable_t;
207 extern const as_awaitable_t as_awaitable;
208
209 //////////////////////////////////////////////////////////////////////////////////////////////////
210 namespace __starts_on_ns
211 {
212 struct starts_on_t;
213 } // namespace __starts_on_ns
214
215 using __starts_on_ns::starts_on_t;
216 extern const starts_on_t starts_on;
217
218 using on_t [[deprecated("on_t has been renamed starts_on_t")]] = starts_on_t;
219 [[deprecated("on has been renamed starts_on")]] extern const starts_on_t on;
220
221 using start_on_t
222 [[deprecated("start_on_t has been renamed starts_on_t")]] = starts_on_t;
223 [[deprecated(
224 "start_on has been renamed starts_on")]] extern const starts_on_t start_on;
225
226 //////////////////////////////////////////////////////////////////////////////////////////////////
227 namespace __continues_on
228 {
229 struct continues_on_t;
230 } // namespace __continues_on
231
232 using __continues_on::continues_on_t;
233 extern const continues_on_t continues_on;
234
235 using transfer_t [[deprecated("transfer_t has been renamed continues_on_t")]] =
236 continues_on_t;
237 [[deprecated(
238 "transfer has been renamed continues_on")]] extern const continues_on_t
239 transfer;
240
241 using continue_t
242 [[deprecated("continue_on_t has been renamed continues_on_t")]] =
243 continues_on_t;
244 [[deprecated(
245 "continue_on has been renamed continues_on")]] extern const continues_on_t
246 continue_on;
247
248 //////////////////////////////////////////////////////////////////////////////////////////////////
249 namespace __transfer_just
250 {
251 struct transfer_just_t;
252 } // namespace __transfer_just
253
254 using __transfer_just::transfer_just_t;
255 extern const transfer_just_t transfer_just;
256
257 //////////////////////////////////////////////////////////////////////////////////////////////////
258 namespace __bulk
259 {
260 struct bulk_t;
261 } // namespace __bulk
262
263 using __bulk::bulk_t;
264 extern const bulk_t bulk;
265
266 //////////////////////////////////////////////////////////////////////////////////////////////////
267 namespace __split
268 {
269 struct split_t;
270 struct __split_t;
271 } // namespace __split
272
273 using __split::split_t;
274 extern const split_t split;
275
276 //////////////////////////////////////////////////////////////////////////////////////////////////
277 namespace __ensure_started
278 {
279 struct ensure_started_t;
280 struct __ensure_started_t;
281 } // namespace __ensure_started
282
283 using __ensure_started::ensure_started_t;
284 extern const ensure_started_t ensure_started;
285
286 //////////////////////////////////////////////////////////////////////////////////////////////////
287 namespace __on_v2
288 {
289 struct on_t;
290 } // namespace __on_v2
291
292 namespace v2
293 {
294 using __on_v2::on_t;
295 } // namespace v2
296
297 namespace __detail
298 {
299 struct __sexpr_apply_t;
300 } // namespace __detail
301
302 using __detail::__sexpr_apply_t;
303 extern const __sexpr_apply_t __sexpr_apply;
304 } // namespace stdexec
305
306 template <class...>
__print()307 [[deprecated]] void __print()
308 {}
309
310 template <class...>
311 struct __undef;
312