28 #include <type_traits>
38 template <
class StateType>
77 template <
class StateType>
80 static_assert(std::is_base_of_v<StateTemplate, StateType>,
81 "The template parameter of StateTemplate, must be a class that derives from StateTemplate");
84 std::string className = GetTypeString<StateType>();
86 if (className.size() > 1)
88 className = className.substr(0, className.size() - 1);
91 setStateClassNameFromTypeName(className);
94 template <
class StateType>
99 if (stateName.empty())
101 if (ptr->stateClassName.empty())
103 throw LocalException(
"StateName and StateClassName are empty - cannot create state instance");
106 stateName = ptr->stateClassName;
109 ptr->setTag(stateName);
110 ptr->stateName = stateName;
114 template <
class StateType>
117 StatePtr result =
new StateType(*
dynamic_cast<const StateType*
>(
this));