27template <
typename EventType>
33template <
typename EventType>
39template <
typename TEv>
45 this->
getLogger(),
"[State Reactor Base] postingfn posting event: " << demangleSymbol<TEv>());
46 auto * ev =
new TEv();
51template <
typename TEv>
57template <
typename T,
typename TClass>
60 const auto * eventtype = &
typeid(T);
64 (
object->*callback)(evptr);
71 const auto * eventtype = &
typeid(T);
79namespace introspection
81template <
typename TEv>
85 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr)
88 nh_->get_logger(),
"[%s] State Reactor adding input event: %s",
89 srInfo_->stateReactorType->getFullName().c_str(), demangledTypeName<TEv>().c_str());
90 sr->addInputEvent<TEv>();
96 auto evinfo = std::make_shared<SmaccEventInfo>(evtype);
97 EventLabel<TEv>(evinfo->label);
99 srInfo_->sourceEventTypes.push_back(evinfo);
102template <
typename TEv>
106 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr)
109 nh_->get_logger(),
"[%s] State Reactor setting output event: %s",
110 srInfo_->stateReactorType->getFullName().c_str(), demangledTypeName<TEv>().c_str());
111 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_
rclcpp::Node::SharedPtr nh_
std::shared_ptr< smacc2::introspection::SmaccStateReactorInfo > srInfo_
static TypeInfo::Ptr getFromStdTypeInfo(const std::type_info &tid)
std::function< void(std::shared_ptr< smacc2::StateReactor >)> fn