rclcpp
master
C++ ROS Client Library API
|
#include <subscription_base.hpp>
Public Types | |
using | IntraProcessManagerWeakPtr = std::weak_ptr< rclcpp::intra_process_manager::IntraProcessManager > |
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, bool is_serialized=false) | |
Default constructor. More... | |
virtual | ~SubscriptionBase () |
Default destructor. More... | |
const char * | get_topic_name () const |
Get the topic that this subscription is subscribed on. More... | |
std::shared_ptr< rcl_subscription_t > | get_subscription_handle () |
const std::shared_ptr< rcl_subscription_t > | get_subscription_handle () const |
virtual const std::shared_ptr< rcl_subscription_t > | get_intra_process_subscription_handle () const |
const std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > & | get_event_handlers () const |
Get all the QoS event handlers associated with this subscription. More... | |
virtual std::shared_ptr< void > | create_message ()=0 |
Borrow a new message. More... | |
virtual std::shared_ptr< rcl_serialized_message_t > | create_serialized_message ()=0 |
Borrow a new serialized 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 | return_serialized_message (std::shared_ptr< rcl_serialized_message_t > &message)=0 |
Return the message borrowed in create_serialized_message. More... | |
virtual void | handle_intra_process_message (rcl_interfaces::msg::IntraProcessMessage &ipm, const rmw_message_info_t &message_info)=0 |
const rosidl_message_type_support_t & | get_message_type_support_handle () const |
bool | is_serialized () const |
size_t | get_publisher_count () const |
Get matching publisher count. More... | |
void | setup_intra_process (uint64_t intra_process_subscription_id, IntraProcessManagerWeakPtr weak_ipm, const rcl_subscription_options_t &intra_process_options) |
Implemenation detail. More... | |
Protected Member Functions | |
template<typename EventCallbackT > | |
void | add_event_handler (const EventCallbackT &callback, const rcl_subscription_event_type_t event_type) |
Virtual base class for subscriptions. This pattern allows us to iterate over different template specializations of Subscription, among other things.
using rclcpp::SubscriptionBase::IntraProcessManagerWeakPtr = std::weak_ptr<rclcpp::intra_process_manager::IntraProcessManager> |
rclcpp::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, | ||
bool | is_serialized = false |
||
) |
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. |
[in] | is_serialized | is true if the message will be delivered still serialized |
|
virtual |
Default destructor.
const char* rclcpp::SubscriptionBase::get_topic_name | ( | ) | const |
Get the topic that this subscription is subscribed on.
std::shared_ptr<rcl_subscription_t> rclcpp::SubscriptionBase::get_subscription_handle | ( | ) |
const std::shared_ptr<rcl_subscription_t> rclcpp::SubscriptionBase::get_subscription_handle | ( | ) | const |
|
virtual |
Reimplemented in rclcpp::Subscription< CallbackMessageT, Alloc >.
const std::vector<std::shared_ptr<rclcpp::QOSEventHandlerBase> >& rclcpp::SubscriptionBase::get_event_handlers | ( | ) | const |
|
pure virtual |
Borrow a new message.
Implemented in rclcpp::Subscription< CallbackMessageT, Alloc >.
|
pure virtual |
Borrow a new serialized message.
Implemented in rclcpp::Subscription< CallbackMessageT, 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< CallbackMessageT, Alloc >.
|
pure virtual |
Return the message borrowed in create_message.
[in] | message | Shared pointer to the returned message. |
Implemented in rclcpp::Subscription< CallbackMessageT, Alloc >.
|
pure virtual |
Return the message borrowed in create_serialized_message.
[in] | message | Shared pointer to the returned message. |
Implemented in rclcpp::Subscription< CallbackMessageT, Alloc >.
|
pure virtual |
Implemented in rclcpp::Subscription< CallbackMessageT, Alloc >.
const rosidl_message_type_support_t& rclcpp::SubscriptionBase::get_message_type_support_handle | ( | ) | const |
bool rclcpp::SubscriptionBase::is_serialized | ( | ) | const |
size_t rclcpp::SubscriptionBase::get_publisher_count | ( | ) | const |
Get matching publisher count.
void rclcpp::SubscriptionBase::setup_intra_process | ( | uint64_t | intra_process_subscription_id, |
IntraProcessManagerWeakPtr | weak_ipm, | ||
const rcl_subscription_options_t & | intra_process_options | ||
) |
Implemenation detail.
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |