SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
cl_ros_publisher::CbPublishOnce< RosMsgType > Class Template Reference

#include <cb_publish_once.hpp>

Inheritance diagram for cl_ros_publisher::CbPublishOnce< RosMsgType >:
Inheritance graph
Collaboration diagram for cl_ros_publisher::CbPublishOnce< RosMsgType >:
Collaboration graph

Public Member Functions

 CbPublishOnce ()
 
template<typename TMessage >
 CbPublishOnce (const TMessage &data)
 
template<typename TMessage >
void setMessage (const TMessage &data)
 
void onEntry () override
 
void onExit () override
 
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, bool throwExceptionIfNotExist=false)
 
virtual void onEntry ()
 
virtual void onExit ()
 
virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 

Private Attributes

std::function< void()> deferedPublishFn
 
ClRosPublisherclient_
 

Additional Inherited Members

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

Detailed Description

template<typename RosMsgType>
class cl_ros_publisher::CbPublishOnce< RosMsgType >

Definition at line 28 of file cb_publish_once.hpp.

Constructor & Destructor Documentation

◆ CbPublishOnce() [1/2]

template<typename RosMsgType >
cl_ros_publisher::CbPublishOnce< RosMsgType >::CbPublishOnce ( )
inline

Definition at line 35 of file cb_publish_once.hpp.

35: deferedPublishFn(nullptr) {}
std::function< void()> deferedPublishFn

◆ CbPublishOnce() [2/2]

template<typename RosMsgType >
template<typename TMessage >
cl_ros_publisher::CbPublishOnce< RosMsgType >::CbPublishOnce ( const TMessage &  data)
inline

Definition at line 38 of file cb_publish_once.hpp.

39 {
40 this->setMessage(data);
41 }
void setMessage(const TMessage &data)

References cl_ros_publisher::CbPublishOnce< RosMsgType >::setMessage().

Here is the call graph for this function:

Member Function Documentation

◆ onEntry()

template<typename RosMsgType >
void cl_ros_publisher::CbPublishOnce< RosMsgType >::onEntry ( )
inlineoverridevirtual

Reimplemented from smacc2::SmaccClientBehavior.

Definition at line 49 of file cb_publish_once.hpp.

50 {
52
53 if (deferedPublishFn != nullptr) deferedPublishFn();
54 }
void requiresClient(SmaccClientType *&storage)

References cl_ros_publisher::CbPublishOnce< RosMsgType >::deferedPublishFn, and smacc2::ISmaccClientBehavior::requiresClient().

Here is the call graph for this function:

◆ onExit()

template<typename RosMsgType >
void cl_ros_publisher::CbPublishOnce< RosMsgType >::onExit ( )
inlineoverridevirtual

Reimplemented from smacc2::SmaccClientBehavior.

Definition at line 56 of file cb_publish_once.hpp.

56{}

◆ setMessage()

template<typename RosMsgType >
template<typename TMessage >
void cl_ros_publisher::CbPublishOnce< RosMsgType >::setMessage ( const TMessage &  data)
inline

Definition at line 44 of file cb_publish_once.hpp.

45 {
46 deferedPublishFn = [this, data]() { this->client_->publish(data); };
47 }
void publish(const MessageType &msg)

References cl_ros_publisher::CbPublishOnce< RosMsgType >::deferedPublishFn, and cl_ros_publisher::ClRosPublisher::publish().

Referenced by cl_ros_publisher::CbPublishOnce< RosMsgType >::CbPublishOnce().

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

Member Data Documentation

◆ client_

template<typename RosMsgType >
ClRosPublisher* cl_ros_publisher::CbPublishOnce< RosMsgType >::client_
private

Definition at line 32 of file cb_publish_once.hpp.

◆ deferedPublishFn

template<typename RosMsgType >
std::function<void()> cl_ros_publisher::CbPublishOnce< RosMsgType >::deferedPublishFn
private

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