SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
cl_ros_publisher::CbDefaultPublishLoop Class Reference

#include <cb_default_publish_loop.hpp>

Inheritance diagram for cl_ros_publisher::CbDefaultPublishLoop:
Inheritance graph
Collaboration diagram for cl_ros_publisher::CbDefaultPublishLoop:
Collaboration graph

Public Member Functions

 CbDefaultPublishLoop ()
 
template<typename TMessage >
 CbDefaultPublishLoop (const TMessage &data)
 
template<typename TMessage >
void setMessage (const TMessage &data)
 
void onEntry () override
 
virtual void update ()
 
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 ()
 
- Public Member Functions inherited from smacc2::ISmaccUpdatable
 ISmaccUpdatable ()
 
 ISmaccUpdatable (rclcpp::Duration duration)
 
void executeUpdate (rclcpp::Node::SharedPtr node)
 
void setUpdatePeriod (rclcpp::Duration duration)
 

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
 
virtual void update ()=0
 

Detailed Description

Definition at line 26 of file cb_default_publish_loop.hpp.

Constructor & Destructor Documentation

◆ CbDefaultPublishLoop() [1/2]

cl_ros_publisher::CbDefaultPublishLoop::CbDefaultPublishLoop ( )
inline

Definition at line 33 of file cb_default_publish_loop.hpp.

33: deferedPublishFn_(nullptr) {}

◆ CbDefaultPublishLoop() [2/2]

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

Definition at line 36 of file cb_default_publish_loop.hpp.

37 {
38 this->setMessage(data);
39 }

References setMessage().

Here is the call graph for this function:

Member Function Documentation

◆ onEntry()

void cl_ros_publisher::CbDefaultPublishLoop::onEntry ( )
inlineoverridevirtual

Reimplemented from smacc2::SmaccClientBehavior.

Definition at line 47 of file cb_default_publish_loop.hpp.

References smacc2::ISmaccClientBehavior::requiresClient().

Here is the call graph for this function:

◆ onExit()

void cl_ros_publisher::CbDefaultPublishLoop::onExit ( )
inlineoverridevirtual

Reimplemented from smacc2::SmaccClientBehavior.

Definition at line 57 of file cb_default_publish_loop.hpp.

57{}

◆ setMessage()

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

Definition at line 42 of file cb_default_publish_loop.hpp.

43 {
44 deferedPublishFn_ = [this, data]() { this->client_->publish(data); };
45 }
void publish(const MessageType &msg)

References deferedPublishFn_, and cl_ros_publisher::ClRosPublisher::publish().

Referenced by CbDefaultPublishLoop().

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

◆ update()

virtual void cl_ros_publisher::CbDefaultPublishLoop::update ( )
inlinevirtual

Implements smacc2::ISmaccUpdatable.

Definition at line 49 of file cb_default_publish_loop.hpp.

50 {
51 if (deferedPublishFn_ != nullptr)
52 {
54 }
55 }

References deferedPublishFn_.

Member Data Documentation

◆ client_

ClRosPublisher* cl_ros_publisher::CbDefaultPublishLoop::client_
private

Definition at line 30 of file cb_default_publish_loop.hpp.

◆ deferedPublishFn_

std::function<void()> cl_ros_publisher::CbDefaultPublishLoop::deferedPublishFn_
private

Definition at line 29 of file cb_default_publish_loop.hpp.

Referenced by setMessage(), and update().


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