rclcpp
master
C++ ROS Client Library API
|
#include <subscription_base.hpp>
Public Types | |
using | IntraProcessManagerWeakPtr = std::weak_ptr< rclcpp::experimental::IntraProcessManager > |
Public Member Functions | |
SubscriptionBase (rclcpp::node_interfaces::NodeBaseInterface *node_base, 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 |
const std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > & | get_event_handlers () const |
Get all the QoS event handlers associated with this subscription. More... | |
rclcpp::QoS | get_actual_qos () const |
Get the actual QoS settings, after the defaults have been determined. 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 | handle_loaned_message (void *loaned_message, const rmw_message_info_t &message_info)=0 |
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... | |
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... | |
bool | can_loan_messages () const |
Check if subscription instance can loan messages. More... | |
void | setup_intra_process (uint64_t intra_process_subscription_id, IntraProcessManagerWeakPtr weak_ipm) |
Implemenation detail. More... | |
rclcpp::Waitable::SharedPtr | get_intra_process_waitable () const |
Return the waitable for intra-process, or nullptr if intra-process is not setup. More... | |
Public Member Functions inherited from std::enable_shared_from_this< SubscriptionBase > | |
T | enable_shared_from_this (T... args) |
T | operator= (T... args) |
T | shared_from_this (T... args) |
T | ~enable_shared_from_this (T... args) |
Protected Member Functions | |
template<typename EventCallbackT > | |
void | add_event_handler (const EventCallbackT &callback, const rcl_subscription_event_type_t event_type) |
bool | matches_any_intra_process_publishers (const rmw_gid_t *sender_gid) const |
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::experimental::IntraProcessManager> |
rclcpp::SubscriptionBase::SubscriptionBase | ( | rclcpp::node_interfaces::NodeBaseInterface * | node_base, |
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_base | NodeBaseInterface pointer used in parts of the setup. |
[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 |
const std::vector<std::shared_ptr<rclcpp::QOSEventHandlerBase> >& rclcpp::SubscriptionBase::get_event_handlers | ( | ) | const |
rclcpp::QoS rclcpp::SubscriptionBase::get_actual_qos | ( | ) | const |
Get the actual QoS settings, after the defaults have been determined.
The actual configuration applied when using RMW_QOS_POLICY_*_SYSTEM_DEFAULT can only be resolved after the creation of the publisher, and it depends on the underlying rmw implementation. If the underlying setting in use can't be represented in ROS terms, it will be set to RMW_QOS_POLICY_*_UNKNOWN. May throw runtime_error when an unexpected error occurs.
|
pure virtual |
Borrow a new message.
Implemented in rclcpp::Subscription< CallbackMessageT, AllocatorT, MessageMemoryStrategyT >.
|
pure virtual |
Borrow a new serialized message.
Implemented in rclcpp::Subscription< CallbackMessageT, AllocatorT, MessageMemoryStrategyT >.
|
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, AllocatorT, MessageMemoryStrategyT >.
|
pure virtual |
|
pure virtual |
Return the message borrowed in create_message.
[in] | message | Shared pointer to the returned message. |
Implemented in rclcpp::Subscription< CallbackMessageT, AllocatorT, MessageMemoryStrategyT >.
|
pure virtual |
Return the message borrowed in create_serialized_message.
[in] | message | Shared pointer to the returned message. |
Implemented in rclcpp::Subscription< CallbackMessageT, AllocatorT, MessageMemoryStrategyT >.
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.
bool rclcpp::SubscriptionBase::can_loan_messages | ( | ) | const |
Check if subscription instance can loan messages.
Depending on the middleware and the message type, this will return true if the middleware can allocate a ROS message instance.
void rclcpp::SubscriptionBase::setup_intra_process | ( | uint64_t | intra_process_subscription_id, |
IntraProcessManagerWeakPtr | weak_ipm | ||
) |
Implemenation detail.
rclcpp::Waitable::SharedPtr rclcpp::SubscriptionBase::get_intra_process_waitable | ( | ) | const |
Return the waitable for intra-process, or nullptr if intra-process is not setup.
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |