Debian Codegraph @

yo/coroutines/demo/fsa/digit/digit.h

raw
1 #ifndef INCLUDED_DIGIT_
2 #define INCLUDED_DIGIT_
3
4 #include "../../promisebase/promisebase.h"
5 #include "../awaiter/awaiter.h"
6
7 #include "../start/start.h"
8 #include "../letter/letter.h"
9 #include "../done/done.h"
10
11 class Digit: public Awaiter
12 {
13 struct State: public PromiseBase<Digit, State>
14 {
15 };
16
17 std::coroutine_handle<State> d_handle;
18
19 public:
20 using promise_type = State;
21 using Handle = std::coroutine_handle<State>;
22
23 explicit Digit(Handle handle);
24 ~Digit();
25
26 template <typename HandleType>
27 std::coroutine_handle<State> await_suspend(HandleType const &handle);
28 };
29
30 template <typename HandleType>
31 inline std::coroutine_handle<Digit::State> Digit::await_suspend(
32 HandleType const &handle)
33 {
34 return d_handle;
35 }
36
37 extern Digit g_digit;
38
39 #endif