27template <
typename EventType>
33template <
typename EventType>
39template <
typename TEv>
44 this->
getLogger(),
"[State Reactor Base] postingfn posting event: " << demangleSymbol<TEv>());
45 auto * ev =
new TEv();
50template <
typename TEv>
56template <
typename T,
typename TClass>
59 const auto * eventtype = &
typeid(
T);
69 const auto * eventtype = &
typeid(
T);
76namespace introspection
78template <
typename TEv>
82 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr) {
84 nh_->get_logger(),
"[%s] State Reactor adding input event: %s",
85 srInfo_->stateReactorType->getFullName().c_str(), demangledTypeName<TEv>().c_str());
86 sr->addInputEvent<TEv>();
92 auto evinfo = std::make_shared<SmaccEventInfo>(evtype);
93 EventLabel<TEv>(evinfo->label);
95 srInfo_->sourceEventTypes.push_back(evinfo);
98template <
typename TEv>
102 functor.
fn = [
this](std::shared_ptr<smacc2::StateReactor> sr) {
104 nh_->get_logger(),
"[%s] State Reactor setting output event: %s",
105 srInfo_->stateReactorType->getFullName().c_str(), demangledTypeName<TEv>().c_str());
106 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)
void callback(const image_tools::ROSCvMatContainer &img)
std::function< void(std::shared_ptr< smacc2::StateReactor >)> fn