13 #ifndef __PROCESS_STATE_MACHINE_HPP__ 14 #define __PROCESS_STATE_MACHINE_HPP__ 152 template <
typename State>
158 template <State from, State to,
typename F>
164 return Error(message.getOrElse(
"Invalid current state"));
173 promises[state].clear();
178 template <State from, State to>
181 return transition<from, to>([]() {
return Nothing(); }, std::move(message));
194 promises[s].emplace_back();
195 return promises[s].back().future();
209 #endif // __PROCESS_STATE_MACHINE_HPP__ Definition: nothing.hpp:16
Definition: errorbase.hpp:36
F && f
Definition: defer.hpp:270
bool set(const T &_t)
Definition: future.hpp:827
Definition: state_machine.hpp:153
Try< Nothing > transition(Option< std::string > &&message=None())
Definition: state_machine.hpp:179
Future< Nothing > when()
Definition: state_machine.hpp:191
Definition: hashmap.hpp:38
StateMachine(State initial)
Definition: state_machine.hpp:156
Protocol< PromiseRequest, PromiseResponse > promise
Try< typename result_of< F()>::type > transition(F &&f, Option< std::string > &&message=None())
Definition: state_machine.hpp:159
Definition: executor.hpp:48
bool is() const
Definition: state_machine.hpp:185