27template <
typename EventType>
33template <
typename EventType>
39template <
typename TEv>
50template <
typename TEv>
56template <
typename T,
typename TClass>
59 const auto * eventtype = &
typeid(T);
62 T * evptr =
static_cast<T *
>(msg);
63 (
object->*callback)(evptr);
70 const auto * eventtype = &
typeid(T);
73 T * evptr =
static_cast<T *
>(msg);
78namespace introspection
80template <
typename TEv>
84 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr)
88 logger_,
"[%s] State Reactor adding input event: %s",
89 srInfo ? srInfo->stateReactorType->getFullName().c_str() :
"?",
91 sr->addInputEvent<TEv>();
97 auto evinfo = std::make_shared<SmaccEventInfo>(evtype);
102 if (srInfo !=
nullptr)
104 srInfo->sourceEventTypes.push_back(evinfo);
108template <
typename TEv>
112 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr)
116 logger_,
"[%s] State Reactor setting output event: %s",
117 srInfo ? srInfo->stateReactorType->getFullName().c_str() :
"?",
119 sr->setOutputEvent<TEv>();
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)
virtual ISmaccStateMachine & getStateMachine()=0
void postEvent(const EventType &ev)
std::function< void()> postEventFn
void createEventCallback(void(TClass::*callback)(T *), TClass *object)
rclcpp::Logger getLogger()
std::vector< const std::type_info * > eventTypes
std::map< const std::type_info *, std::function< void(void *)> > eventCallbacks_
std::vector< StateReactorCallbackFunctor > callbacks_
std::weak_ptr< smacc2::introspection::SmaccStateReactorInfo > srInfo_
static TypeInfo::Ptr getFromStdTypeInfo(const std::type_info &tid)
std::enable_if< HasEventLabel< T >::value, void >::type EventLabel(std::string &label)
std::string demangleSymbol()
std::string demangledTypeName()
boost::intrusive_ptr< EventType > makeEvent(Args &&... args)
std::function< void(std::shared_ptr< smacc2::StateReactor >)> fn