SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
smacc2::introspection::StateReactorHandler Class Reference

#include <smacc_state_info.hpp>

Collaboration diagram for smacc2::introspection::StateReactorHandler:
Collaboration graph

Public Member Functions

 StateReactorHandler (rclcpp::Node::SharedPtr nh)
 
void configureStateReactor (std::shared_ptr< smacc2::StateReactor > sr)
 
template<typename TEv >
void addInputEvent ()
 
template<typename TEv >
void setOutputEvent ()
 
rclcpp::Node::SharedPtr getNode ()
 

Public Attributes

std::shared_ptr< smacc2::introspection::SmaccStateReactorInfosrInfo_
 

Private Attributes

std::vector< StateReactorCallbackFunctorcallbacks_
 
rclcpp::Node::SharedPtr nh_
 

Detailed Description

Definition at line 83 of file smacc_state_info.hpp.

Constructor & Destructor Documentation

◆ StateReactorHandler()

smacc2::introspection::StateReactorHandler::StateReactorHandler ( rclcpp::Node::SharedPtr  nh)
inline

Definition at line 89 of file smacc_state_info.hpp.

89: nh_(nh) {}

Member Function Documentation

◆ addInputEvent()

template<typename TEv >
void smacc2::introspection::StateReactorHandler::addInputEvent

Definition at line 82 of file smacc_state_reactor_impl.hpp.

83{
84 StateReactorCallbackFunctor functor;
85 functor.fn = [this](std::shared_ptr<smacc2::StateReactor> sr)
86 {
87 RCLCPP_INFO(
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>();
91 };
92
93 this->callbacks_.push_back(functor);
94
95 auto evtype = TypeInfo::getFromStdTypeInfo(typeid(TEv));
96 auto evinfo = std::make_shared<SmaccEventInfo>(evtype);
97 EventLabel<TEv>(evinfo->label);
98
99 srInfo_->sourceEventTypes.push_back(evinfo);
100}
std::vector< StateReactorCallbackFunctor > callbacks_
std::shared_ptr< smacc2::introspection::SmaccStateReactorInfo > srInfo_
static TypeInfo::Ptr getFromStdTypeInfo(const std::type_info &tid)

References callbacks_, smacc2::introspection::StateReactorCallbackFunctor::fn, smacc2::introspection::TypeInfo::getFromStdTypeInfo(), nh_, and srInfo_.

Here is the call graph for this function:

◆ configureStateReactor()

void smacc2::introspection::StateReactorHandler::configureStateReactor ( std::shared_ptr< smacc2::StateReactor sr)

Definition at line 62 of file state_reactor.cpp.

63{
64 for (auto callback : this->callbacks_)
65 {
66 callback.fn(sb);
67 }
68}

References callbacks_.

◆ getNode()

rclcpp::Node::SharedPtr smacc2::introspection::StateReactorHandler::getNode ( )

◆ setOutputEvent()

template<typename TEv >
void smacc2::introspection::StateReactorHandler::setOutputEvent

Definition at line 103 of file smacc_state_reactor_impl.hpp.

104{
105 StateReactorCallbackFunctor functor;
106 functor.fn = [this](std::shared_ptr<smacc2::StateReactor> sr)
107 {
108 RCLCPP_INFO(
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>();
112 };
113
114 this->callbacks_.push_back(functor);
115}

References callbacks_, smacc2::introspection::StateReactorCallbackFunctor::fn, nh_, and srInfo_.

Member Data Documentation

◆ callbacks_

std::vector<StateReactorCallbackFunctor> smacc2::introspection::StateReactorHandler::callbacks_
private

Definition at line 86 of file smacc_state_info.hpp.

Referenced by addInputEvent(), configureStateReactor(), and setOutputEvent().

◆ nh_

rclcpp::Node::SharedPtr smacc2::introspection::StateReactorHandler::nh_
private

Definition at line 104 of file smacc_state_info.hpp.

Referenced by addInputEvent(), and setOutputEvent().

◆ srInfo_

std::shared_ptr<smacc2::introspection::SmaccStateReactorInfo> smacc2::introspection::StateReactorHandler::srInfo_

Definition at line 101 of file smacc_state_info.hpp.

Referenced by addInputEvent(), and setOutputEvent().


The documentation for this class was generated from the following files: