rclcpp
master
C++ ROS Client Library API
|
#include <subscription.hpp>
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_t * | get_subscription_handle () const |
virtual const rcl_subscription_t * | get_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_t > | node_handle_ |
Virtual base class for subscriptions. This pattern allows us to iterate over different template specializations of Subscription, among other things.
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.
[in] | node_handle | The rcl representation of the node that owns this subscription. |
[in] | type_support_handle | rosidl type support struct, for the Message type of the topic. |
[in] | topic_name | Name of the topic to subscribe to. |
[in] | subscription_options | options for the subscription. |
|
virtual |
Default destructor.
const char* rclcpp::subscription::SubscriptionBase::get_topic_name | ( | ) | const |
Get the topic that this subscription is subscribed on.
const rcl_subscription_t* rclcpp::subscription::SubscriptionBase::get_subscription_handle | ( | ) | const |
|
virtual |
Reimplemented in rclcpp::subscription::Subscription< MessageT, Alloc >.
|
pure virtual |
Borrow a new message.
Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.
|
pure virtual |
Check if we need to handle the message, and execute the callback if we do.
[in] | message | Shared pointer to the message to handle. |
[in] | message_info | Metadata associated with this message. |
Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.
|
pure virtual |
Return the message borrowed in create_message.
[in] | message | Shared pointer to the returned message. |
Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.
|
pure virtual |
Implemented in rclcpp::subscription::Subscription< MessageT, Alloc >.
|
protected |
|
protected |
|
protected |