rclcpp  master
C++ ROS Client Library API
Public Member Functions | Protected Attributes | List of all members
rclcpp::subscription::SubscriptionBase Class Referenceabstract

#include <subscription.hpp>

Inheritance diagram for rclcpp::subscription::SubscriptionBase:
rclcpp::subscription::Subscription< MessageT, Alloc >

Public Member Functions

 SubscriptionBase (std::shared_ptr< rcl_node_t > node_handle, const rosidl_message_type_support_t &type_support_handle, const std::string &topic_name, const rcl_subscription_options_t &subscription_options)
 Default constructor. More...
 
virtual ~SubscriptionBase ()
 Default destructor. More...
 
const char * get_topic_name () const
 Get the topic that this subscription is subscribed on. More...
 
const rcl_subscription_tget_subscription_handle () const
 
virtual const rcl_subscription_tget_intra_process_subscription_handle () const
 
virtual std::shared_ptr< void > create_message ()=0
 Borrow a new message. More...
 
virtual void handle_message (std::shared_ptr< void > &message, const rmw_message_info_t &message_info)=0
 Check if we need to handle the message, and execute the callback if we do. More...
 
virtual void return_message (std::shared_ptr< void > &message)=0
 Return the message borrowed in create_message. More...
 
virtual void handle_intra_process_message (rcl_interfaces::msg::IntraProcessMessage &ipm, const rmw_message_info_t &message_info)=0
 

Protected Attributes

rcl_subscription_t intra_process_subscription_handle_ = rcl_get_zero_initialized_subscription()
 
rcl_subscription_t subscription_handle_ = rcl_get_zero_initialized_subscription()
 
std::shared_ptr< rcl_node_tnode_handle_
 

Detailed Description

Virtual base class for subscriptions. This pattern allows us to iterate over different template specializations of Subscription, among other things.

Constructor & Destructor Documentation

◆ SubscriptionBase()

rclcpp::subscription::SubscriptionBase::SubscriptionBase ( std::shared_ptr< rcl_node_t node_handle,
const rosidl_message_type_support_t &  type_support_handle,
const std::string &  topic_name,
const rcl_subscription_options_t subscription_options 
)

Default constructor.

Parameters
[in]node_handleThe rcl representation of the node that owns this subscription.
[in]type_support_handlerosidl type support struct, for the Message type of the topic.
[in]topic_nameName of the topic to subscribe to.
[in]subscription_optionsoptions for the subscription.

◆ ~SubscriptionBase()

virtual rclcpp::subscription::SubscriptionBase::~SubscriptionBase ( )
virtual

Default destructor.

Member Function Documentation

◆ get_topic_name()

const char* rclcpp::subscription::SubscriptionBase::get_topic_name ( ) const

Get the topic that this subscription is subscribed on.

◆ get_subscription_handle()

const rcl_subscription_t* rclcpp::subscription::SubscriptionBase::get_subscription_handle ( ) const

◆ get_intra_process_subscription_handle()

virtual const rcl_subscription_t* rclcpp::subscription::SubscriptionBase::get_intra_process_subscription_handle ( ) const
virtual

◆ create_message()

virtual std::shared_ptr<void> rclcpp::subscription::SubscriptionBase::create_message ( )
pure virtual

Borrow a new message.

Returns
Shared pointer to the fresh message.

Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.

◆ handle_message()

virtual void rclcpp::subscription::SubscriptionBase::handle_message ( std::shared_ptr< void > &  message,
const rmw_message_info_t message_info 
)
pure virtual

Check if we need to handle the message, and execute the callback if we do.

Parameters
[in]messageShared pointer to the message to handle.
[in]message_infoMetadata associated with this message.

Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.

◆ return_message()

virtual void rclcpp::subscription::SubscriptionBase::return_message ( std::shared_ptr< void > &  message)
pure virtual

Return the message borrowed in create_message.

Parameters
[in]messageShared pointer to the returned message.

Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.

◆ handle_intra_process_message()

virtual void rclcpp::subscription::SubscriptionBase::handle_intra_process_message ( rcl_interfaces::msg::IntraProcessMessage &  ipm,
const rmw_message_info_t message_info 
)
pure virtual

Member Data Documentation

◆ intra_process_subscription_handle_

rcl_subscription_t rclcpp::subscription::SubscriptionBase::intra_process_subscription_handle_ = rcl_get_zero_initialized_subscription()
protected

◆ subscription_handle_

rcl_subscription_t rclcpp::subscription::SubscriptionBase::subscription_handle_ = rcl_get_zero_initialized_subscription()
protected

◆ node_handle_

std::shared_ptr<rcl_node_t> rclcpp::subscription::SubscriptionBase::node_handle_
protected

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