Debian Codegraph @

yo/coroutines/demo/fsa_awaittransform/start/start.h

raw symbols SCIP
1 #ifndef INCLUDED_START_
2 #define INCLUDED_START_
3
4 #include "../../promisebase/promisebase.h"
5
6 #include "../awaiter/awaiter.h"
7
8 //start
9 struct Start
10 {
11 struct State: public PromiseBase<Start, State>
12 {
13 template <typename Handler>
14 Awaiter await_transform(Next<Handler> &&next);
15 };
16
17 using Handle = std::coroutine_handle<State>;
18
19 std::coroutine_handle<State> d_handle;
20
21 public:
22 using promise_type = State;
23
24 explicit Start(Handle handle);
25 ~Start();
26
27 Handle handle() const;
28 void go();
29 };
30
31 template <typename Handler>
32 Awaiter Start::State::await_transform(Next<Handler> &&next)
33 {
34 return Awaiter{ next.d_handle };
35 }
36
37 //inline void Start::State::setHandle(std::coroutine_handle<> handle)
38 //{
39 // d_handle = handle;
40 //}
41
42 inline Start::Handle Start::handle() const
43 {
44 return d_handle;
45 }
46
47 extern Start g_start;
48
49 #endif