SMACC2
Public Member Functions | Public Attributes | List of all members
sm_ferrari::cl_subscriber::CbMySubscriberBehavior Class Reference

#include <cb_my_subscriber_behavior.hpp>

Inheritance diagram for sm_ferrari::cl_subscriber::CbMySubscriberBehavior:
Inheritance graph
Collaboration diagram for sm_ferrari::cl_subscriber::CbMySubscriberBehavior:
Collaboration graph

Public Member Functions

void onEntry ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
void onMessageReceived (const std_msgs::msg::Float32 &msg)
 
- Public Member Functions inherited from smacc2::SmaccClientBehavior
void onEntry () override
 
void onExit () override
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 

Public Attributes

std::function< void()> postMyEvent_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode ()
 
virtual rclcpp::Logger getLogger ()
 

Detailed Description

Definition at line 27 of file cb_my_subscriber_behavior.hpp.

Member Function Documentation

◆ onEntry()

void sm_ferrari::cl_subscriber::CbMySubscriberBehavior::onEntry ( )
inlinevirtual

Reimplemented from smacc2::SmaccClientBehavior.

Definition at line 30 of file cb_my_subscriber_behavior.hpp.

31 {
32 ClSubscriber * client;
33 this->requiresClient(client);
34
35 client->onMessageReceived(&CbMySubscriberBehavior::onMessageReceived, this);
36 }
void onMessageReceived(const std_msgs::msg::Float32 &msg)
void requiresClient(SmaccClientType *&storage)

References onMessageReceived(), smacc2::client_bases::SmaccSubscriberClient< MessageType >::onMessageReceived(), and smacc2::ISmaccClientBehavior::requiresClient().

Here is the call graph for this function:

◆ onMessageReceived()

void sm_ferrari::cl_subscriber::CbMySubscriberBehavior::onMessageReceived ( const std_msgs::msg::Float32 &  msg)
inline

Definition at line 44 of file cb_my_subscriber_behavior.hpp.

45 {
46 if (msg.data > 30)
47 {
48 RCLCPP_INFO(
49 getLogger(),
50 "[CbMySubscriberBehavior] received message from topic with value > 30. "
51 "Posting event!");
52 this->postMyEvent_();
53 }
54 }

References smacc2::ISmaccClientBehavior::getLogger(), and postMyEvent_.

Referenced by onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void sm_ferrari::cl_subscriber::CbMySubscriberBehavior::onOrthogonalAllocation ( )
inline

Definition at line 39 of file cb_my_subscriber_behavior.hpp.

40 {
41 postMyEvent_ = [=] { this->postEvent<EvMyBehavior<TSourceObject, TOrthogonal>>(); };
42 }

References postMyEvent_.

Member Data Documentation

◆ postMyEvent_

std::function<void()> sm_ferrari::cl_subscriber::CbMySubscriberBehavior::postMyEvent_

Definition at line 56 of file cb_my_subscriber_behavior.hpp.

Referenced by onMessageReceived(), and onOrthogonalAllocation().


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