SMACC2
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 82 of file smacc_state_info.hpp.

Constructor & Destructor Documentation

◆ StateReactorHandler()

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

Definition at line 88 of file smacc_state_info.hpp.

88: nh_(nh) {}

Member Function Documentation

◆ addInputEvent()

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

Definition at line 79 of file smacc_state_reactor_impl.hpp.

80{
81 StateReactorCallbackFunctor functor;
82 functor.fn = [this](std::shared_ptr<smacc2::StateReactor> sr) {
83 RCLCPP_INFO(
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>();
87 };
88
89 this->callbacks_.push_back(functor);
90
91 auto evtype = TypeInfo::getFromStdTypeInfo(typeid(TEv));
92 auto evinfo = std::make_shared<SmaccEventInfo>(evtype);
93 EventLabel<TEv>(evinfo->label);
94
95 srInfo_->sourceEventTypes.push_back(evinfo);
96}
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}
void callback(const image_tools::ROSCvMatContainer &img)

References callback(), and callbacks_.

Here is the call graph for this function:

◆ getNode()

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

◆ setOutputEvent()

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

Definition at line 99 of file smacc_state_reactor_impl.hpp.

100{
101 StateReactorCallbackFunctor functor;
102 functor.fn = [this](std::shared_ptr<smacc2::StateReactor> sr) {
103 RCLCPP_INFO(
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>();
107 };
108
109 this->callbacks_.push_back(functor);
110}

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

Member Data Documentation

◆ callbacks_

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

Definition at line 85 of file smacc_state_info.hpp.

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

◆ nh_

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

Definition at line 103 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 100 of file smacc_state_info.hpp.

Referenced by addInputEvent(), and setOutputEvent().


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