39 template <
typename T,
typename ChainType,
typename StatusType, StatusType failure_status>
44 using state = std::function<StatusType(
T*)>;
76 return *
static_cast<ChainType*
>(
this);
88 throw std::logic_error{
"From-state was already set. Did you forget to append "
89 "on_success() or on_failure()?"};
92 return *
static_cast<ChainType*
>(
this);
104 throw std::logic_error{
"To-state was already set. Did you forget to append "
105 "on_success() or on_failure()?"};
108 return *
static_cast<ChainType*
>(
this);
116 throw std::logic_error{
"Both from-state and to-state must be set with "
117 "from(...).to(...)."};
140 return *
static_cast<ChainType*
>(
this);
154 throw std::logic_error{
"When using on_any_failure(), from-state must be unset."};
160 return *
static_cast<ChainType*
>(
this);
168 throw std::logic_error{
"From-state or to-state set but not commited with .on()"};
173 throw std::logic_error{
"Cannot run without a start state."};
176 long current_state_id;
182 current_state_id =
get_id(next_state);
204 auto key = std::make_tuple(state_id,
status);
217 return get_id(fn.value());
223 return *(
long*)(
char*)&fn;
227 template <
typename T>
250 template <
typename T>
270 template <
typename T>
272 template <
typename T>
274 template <
typename T>
276 template <
typename T>
278 template <
typename T>
280 template <
typename T>