40 template <
typename T,
typename ChainType,
typename StatusType, StatusType failure_status>
46 using state = std::function<StatusType(
T*)>;
80 return *
static_cast<ChainType*
>(
this);
92 throw std::logic_error{
"From-state was already set. Did you forget to append "
93 "on_success() or on_failure()?"};
96 return *
static_cast<ChainType*
>(
this);
108 throw std::logic_error{
"To-state was already set. Did you forget to append "
109 "on_success() or on_failure()?"};
112 return *
static_cast<ChainType*
>(
this);
120 throw std::logic_error{
"Both from-state and to-state must be set with "
121 "from(...).to(...)."};
144 return *
static_cast<ChainType*
>(
this);
158 throw std::logic_error{
"When using on_any_failure(), from-state must be unset."};
164 return *
static_cast<ChainType*
>(
this);
174 throw std::logic_error{
"From-state or to-state set but not commited with .on()"};
179 throw std::logic_error{
"Cannot run without a start state."};
182 long current_state_id;
188 current_state_id =
get_id(next_state);
213 auto key = std::make_tuple(state_id,
status);
227 return get_id(fn.value());
234 return *(
long*)(
char*)&fn;
240 template <
typename T>
266 template <
typename T>
289 template <
typename T>
291 template <
typename T>
293 template <
typename T>
295 template <
typename T>
297 template <
typename T>
299 template <
typename T>