rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__SUBSCRIPTION_BASE_HPP_
16 #define RCLCPP__SUBSCRIPTION_BASE_HPP_
21 #include <unordered_map>
25 #include "rcl/subscription.h"
43 namespace node_interfaces
45 class NodeBaseInterface;
48 namespace experimental
54 class IntraProcessManager;
75 const rosidl_message_type_support_t & type_support_handle,
202 const rosidl_message_type_support_t &
237 uint64_t intra_process_subscription_id,
246 rclcpp::Waitable::SharedPtr
267 template<
typename EventCallbackT>
270 const EventCallbackT & callback,
271 const rcl_subscription_event_type_t event_type)
276 rcl_subscription_event_init,
305 rosidl_message_type_support_t type_support_;
309 std::atomic<bool> intra_process_subscription_waitable_in_use_by_wait_set_{
false};
316 #endif // RCLCPP__SUBSCRIPTION_BASE_HPP_
const std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > & get_event_handlers() const
Get all the QoS event handlers associated with this subscription.
virtual void handle_loaned_message(void *loaned_message, const rclcpp::MessageInfo &message_info)=0
void setup_intra_process(uint64_t intra_process_subscription_id, IntraProcessManagerWeakPtr weak_ipm)
Implemenation detail.
std::shared_ptr< rcl_subscription_t > intra_process_subscription_handle_
Definition: subscription_base.hpp:294
const rosidl_message_type_support_t & get_message_type_support_handle() const
rclcpp::node_interfaces::NodeBaseInterface *const node_base_
Definition: subscription_base.hpp:290
bool use_intra_process_
Definition: subscription_base.hpp:298
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
virtual void return_message(std::shared_ptr< void > &message)=0
Return the message borrowed in create_message.
IntraProcessManagerWeakPtr weak_ipm_
Definition: subscription_base.hpp:299
std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > event_handlers_
Definition: subscription_base.hpp:296
bool can_loan_messages() const
Check if subscription instance can loan messages.
std::shared_ptr< rcl_subscription_t > get_subscription_handle()
Definition: subscription_base.hpp:59
size_t get_publisher_count() const
Get matching publisher count.
uint64_t intra_process_subscription_id_
Definition: subscription_base.hpp:300
std::shared_ptr< rcl_subscription_t > subscription_handle_
Definition: subscription_base.hpp:293
void default_incompatible_qos_callback(QOSRequestedIncompatibleQoSInfo &info) const
virtual std::shared_ptr< rclcpp::SerializedMessage > create_serialized_message()=0
Borrow a new serialized message.
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.
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Pure virtual interface class for the NodeBase part of the Node API.
Definition: node_base_interface.hpp:36
Encapsulation of Quality of Service settings.
Definition: qos.hpp:59
bool is_serialized() const
Return if the subscription is serialized.
const char * get_topic_name() const
Get the topic that this subscription is subscribed on.
bool take_serialized(rclcpp::SerializedMessage &message_out, rclcpp::MessageInfo &message_info_out)
Take the next inter-process message, in its serialized form, from the subscription.
virtual void handle_message(std::shared_ptr< void > &message, const rclcpp::MessageInfo &message_info)=0
Check if we need to handle the message, and execute the callback if we do.
virtual std::shared_ptr< void > create_message()=0
Borrow a new message.
bool take_type_erased(void *message_out, rclcpp::MessageInfo &message_info_out)
Take the next inter-process message from the subscription as a type erased pointer.
T emplace_back(T... args)
Additional meta data about messages taken from subscriptions.
Definition: message_info.hpp:26
virtual void return_serialized_message(std::shared_ptr< rclcpp::SerializedMessage > &message)=0
Return the message borrowed in create_serialized_message.
Object oriented version of rcl_serialized_message_t with destructor to avoid memory leaks.
Definition: serialized_message.hpp:27
rclcpp::Waitable::SharedPtr get_intra_process_waitable() const
Return the waitable for intra-process.
#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...)
Definition: macros.hpp:51
virtual ~SubscriptionBase()
Default destructor.
bool matches_any_intra_process_publishers(const rmw_gid_t *sender_gid) const
bool exchange_in_use_by_wait_set_state(void *pointer_to_subscription_part, bool in_use_state)
Exchange state of whether or not a part of the subscription is used by a wait set.
std::shared_ptr< rcl_node_t > node_handle_
Definition: subscription_base.hpp:292
Definition: qos_event.hpp:79
Definition: qos_event.hpp:106
void add_event_handler(const EventCallbackT &callback, const rcl_subscription_event_type_t event_type)
Definition: subscription_base.hpp:269
rclcpp::QoS get_actual_qos() const
Get the actual QoS settings, after the defaults have been determined.