32#include <smacc2_msgs/msg/smacc_event_generator.hpp>
33#include <smacc2_msgs/msg/smacc_orthogonal.hpp>
34#include <smacc2_msgs/msg/smacc_state.hpp>
35#include <smacc2_msgs/msg/smacc_state_reactor.hpp>
36#include <smacc2_msgs/msg/smacc_transition.hpp>
40namespace introspection
49 std::map<std::string, std::shared_ptr<SmaccStateInfo>>
states;
51 std::vector<smacc2_msgs::msg::SmaccState>
stateMsgs;
53 template <
typename InitialStateType>
56 template <
typename StateType>
59 template <
typename StateType>
67 template <
typename StateType>
81 template <
typename StateType>
86 rclcpp::Node::SharedPtr
nh_;
119 template <
typename T>
124template <
typename InitialStateType>
134 using type_t =
typename T::type;
152 using boost::mpl::_1;
153 using wrappedList =
typename boost::mpl::transform<T, add_type_wrapper<_1>>::type;
161 std::shared_ptr<SmaccStateInfo> & sourceState)
164 globalNh_->get_logger(),
"State %s Walker has transition list",
165 sourceState->fullStateName.c_str());
166 using boost::mpl::_1;
167 using wrappedList =
typename boost::mpl::transform<T, add_type_wrapper<_1>>::type;
168 boost::mpl::for_each<wrappedList>(
AddTransition(sourceState));
171template <
typename Ev,
typename Dst,
typename Tag>
174 std::shared_ptr<SmaccStateInfo> & sourceState)
182template <
typename Ev,
typename Dst,
typename Tag>
186 auto transitionTypeInfo = TypeInfo::getTypeInfoFromType<smacc2::Transition<Ev, Dst, Tag>>();
188 globalNh_->get_logger(),
"State %s Walker transition: %s", sourceState->toShortName().c_str(),
193template <
typename Ev,
typename Dst,
typename Tag>
199 globalNh_->get_logger(),
"State %s Walker transition: %s", sourceState->toShortName().c_str(),
201 std::string transitionTag;
202 std::string transitionType;
219 if (!sourceState->stateMachine_->containsState<
Dst>())
221 auto realparentState = sourceState->stateMachine_->getState<
typename Dst::TContext>();
226 sourceState->declareTransition<
Ev>(
235 sourceState->declareTransition<
Ev>(
241template <
typename EvType>
243 std::shared_ptr<SmaccStateInfo> &
dstState, std::string transitionTag, std::string transitionType,
254 if (transitionTag !=
"")
263 std::make_shared<SmaccEventInfo>(transitionTypeInfo->templateParameters.front());
282 template <
typename C>
284 template <
typename C>
320template <
typename Ev,
typename Dst>
322 statechart::transition<Ev, Dst> *, std::shared_ptr<SmaccStateInfo> & sourceState)
327template <
typename Ev>
329 statechart::custom_reaction<Ev> *, std::shared_ptr<SmaccStateInfo> & sourceState)
339 std::shared_ptr<SmaccStateInfo> & sourceState)
353 T::staticConfigure();
361 "static OnDefinition: dont exist for " <<
demangleSymbol(
typeid(
T).name()));
412template <
typename TTrans>
415 using type_t =
typename TTrans::type;
426template <
typename InitialStateType>
453 typename std::remove_pointer<
decltype(InitialStateType::smacc_inner_type)>::type
InnerType;
457 typedef typename InitialStateType::reactions reactions;
466template <
typename InitialStateType>
473template <
typename StateType>
475 std::shared_ptr<SmaccStateInfo>
parent)
498template <
typename StateType>
504template <
typename StateType>
static YesType & test(decltype(&C::staticConfigure))
static NoType & test(...)
std::shared_ptr< SmaccStateInfo > createChildState()
void declareTransition(std::shared_ptr< SmaccStateInfo > &dstState, std::string transitionTag, std::string transitionType, bool history, TypeInfo::Ptr transitionTypeInfo)
rclcpp::Logger getLogger()
std::vector< SmaccTransitionInfo > transitions_
std::shared_ptr< SmaccStateMachineInfo > stateMachine_
rclcpp::Node::SharedPtr nh_
rclcpp::Logger getLogger()
void addState(std::shared_ptr< StateType > &state)
std::shared_ptr< SmaccStateInfo > createState(std::shared_ptr< SmaccStateInfo > parentState)
rclcpp::Node::SharedPtr getNode()
std::map< std::string, std::shared_ptr< SmaccStateInfo > > states
std::vector< smacc2_msgs::msg::SmaccState > stateMsgs
SmaccStateMachineInfo(rclcpp::Node::SharedPtr nh)
void buildStateMachineInfo()
std::shared_ptr< SmaccStateInfo > getState()
void assembleSMStructureMessage(ISmaccStateMachine *sm)
static TypeInfo::Ptr getTypeInfoFromType()
std::shared_ptr< TypeInfo > Ptr
disable_if< boost::mpl::is_sequence< T > >::type processSubState(std::shared_ptr< SmaccStateInfo > &parentState)
rclcpp::Node::SharedPtr globalNh_
void processTransition(smacc2::Transition< Ev, boost::statechart::deep_history< Dst >, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState)
std::string demangleSymbol()
enable_if< boost::mpl::is_sequence< T > >::type processTransitions(std::shared_ptr< SmaccStateInfo > &sourceState)
void processTransitionAux(smacc2::Transition< Ev, Dst, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState, bool history, TypeInfo::Ptr &transitionTypeInfo)
std::enable_if< HasOnDefinition< T >::value, void >::type CallOnDefinition()
std::shared_ptr< SmaccStateInfo > & parentState_
AddSubState(std::shared_ptr< SmaccStateInfo > &parentState)
AddTransition(std::shared_ptr< SmaccStateInfo > ¤tState)
void operator()(TTransition< EvType< TevSource >, DestinyState, Tag >)
std::shared_ptr< SmaccStateInfo > & currentState_
static void walkStates(std::shared_ptr< SmaccStateInfo > ¤tState, bool rootInitialNode)