5 #ifndef STATE_MACHINE_CPP_BUILD_H
6 #define STATE_MACHINE_CPP_BUILD_H
26 template <
typename C>
static std::true_type
test(
checker<C, decltype(&C::INITIAL_STATE)> *) {
return {}; }
27 template <
typename C>
static std::false_type
test(...) {
return {}; }
28 typedef decltype(test<T>(
nullptr))
type;
29 static constexpr
bool value = std::is_same<std::true_type, decltype(
test<T>(
nullptr))>::
value;
35 template <
typename C>
static std::true_type
test(
checker<C, decltype(&C::FINAL_STATE)> *) {
return {}; }
36 template <
typename C>
static std::false_type
test(...) {
return {}; }
37 typedef decltype(test<T>(
nullptr))
type;
38 static constexpr
bool value = std::is_same<std::true_type, decltype(
test<T>(
nullptr))>::
value;
44 template <
typename C>
static std::true_type
test(
checker<C, decltype(&C::TIME_LIMIT_REACHED)> *) {
return {}; }
45 template <
typename C>
static std::false_type
test(...) {
return {}; }
46 typedef decltype(test<T>(
nullptr))
type;
47 static constexpr
bool value = std::is_same<std::true_type, decltype(
test<T>(
nullptr))>::
value;
57 Algorithm::Builder::import<T>(states, transitions, layers);
60 throw std::runtime_error(
"There were some opened layers which failed to be closed.");
64 if (!t_destination.transitions().has(T::INITIAL_STATE)) {
65 throw std::runtime_error(
"INITIAL_STATE have been auto-detected yet the state is not created within the algorithm."
66 "Call states.create.");
68 t_destination.set_initial_state(T::INITIAL_STATE);
72 if (!t_destination.transitions().has(T::FINAL_STATE)) {
73 throw std::runtime_error(
"FINAL_STATE have been auto-detected yet the state is not created within the algorithm."
74 "Call states.create.");
76 t_destination.set_final_state(T::FINAL_STATE);
80 if (!t_destination.transitions().has(T::TIME_LIMIT_REACHED)) {
81 throw std::runtime_error(
"TIME_LIMIT_REACHED have been auto-detected yet the state is not created within the algorithm."
82 "Call states.create.");
84 t_destination.set_time_limit_reached_state(T::TIME_LIMIT_REACHED);
89 #endif //STATE_MACHINE_CPP_BUILD_H