15 #ifndef RCLCPP__CREATE_SUBSCRIPTION_HPP_ 16 #define RCLCPP__CREATE_SUBSCRIPTION_HPP_ 36 typename CallbackMessageT,
39 [[deprecated(
"use alternative rclcpp::create_subscription() signatures")]]
44 CallbackT && callback,
47 rclcpp::callback_group::CallbackGroup::SharedPtr group,
48 bool ignore_local_publications,
49 bool use_intra_process_comms,
51 CallbackMessageT, AllocatorT>::SharedPtr
56 subscription_options.qos = qos_profile;
57 subscription_options.ignore_local_publications = ignore_local_publications;
60 <MessageT, CallbackT, AllocatorT, CallbackMessageT, SubscriptionT>(
61 std::forward<CallbackT>(callback),
70 use_intra_process_comms);
85 typename CallbackMessageT =
94 CallbackT && callback,
99 CallbackMessageT, AllocatorT>::SharedPtr
100 msg_mem_strat =
nullptr)
105 if (!msg_mem_strat) {
107 msg_mem_strat = MessageMemoryStrategy<CallbackMessageT, AllocatorT>::create_default();
112 allocator = std::make_shared<AllocatorT>();
115 <MessageT, CallbackT, AllocatorT, CallbackMessageT, SubscriptionT>(
116 std::forward<CallbackT>(callback), options.event_callbacks, msg_mem_strat, allocator);
118 bool use_intra_process;
119 switch (options.use_intra_process_comm) {
121 use_intra_process =
true;
124 use_intra_process =
false;
127 use_intra_process = node_topics->get_node_base_interface()->get_use_intra_process_default();
135 auto sub = node_topics->create_subscription(
138 options.template to_rcl_subscription_options<MessageT>(qos),
140 node_topics->add_subscription(sub, options.callback_group);
146 #endif // RCLCPP__CREATE_SUBSCRIPTION_HPP_ Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:40
Encapsulation of Quality of Service settings.
Definition: qos.hpp:55
This header provides the get_node_topics_interface() template function.
Definition: allocator_common.hpp:24
virtual rclcpp::SubscriptionBase::SharedPtr create_subscription(const std::string &topic_name, const rclcpp::SubscriptionFactory &subscription_factory, const rcl_subscription_options_t &subscription_options, bool use_intra_process)=0
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:59
std::shared_ptr< SubscriptionT > create_subscription(rclcpp::node_interfaces::NodeTopicsInterface *node_topics, const std::string &topic_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile, const SubscriptionEventCallbacks &event_callbacks, rclcpp::callback_group::CallbackGroup::SharedPtr group, bool ignore_local_publications, bool use_intra_process_comms, typename rclcpp::message_memory_strategy::MessageMemoryStrategy< CallbackMessageT, AllocatorT >::SharedPtr msg_mem_strat, typename std::shared_ptr< AllocatorT > allocator)
Definition: create_subscription.hpp:41
rcl_subscription_options_t rcl_subscription_get_default_options(void)
rclcpp::node_interfaces::NodeTopicsInterface * get_node_topics_interface(NodeType &&node_pointer)
Get the NodeTopicsInterface as a pointer from a pointer to a "Node like" object.
Definition: get_node_topics_interface.hpp:126
Explicitly enable intraprocess comm at publisher/subscription level.
Explicitly disable intraprocess comm at publisher/subscription level.
T dynamic_pointer_cast(T... args)
virtual void add_subscription(rclcpp::SubscriptionBase::SharedPtr subscription, rclcpp::callback_group::CallbackGroup::SharedPtr callback_group)=0
Structure containing optional configuration for Subscriptions.
Definition: subscription_options.hpp:46
SubscriptionFactory create_subscription_factory(CallbackT &&callback, const SubscriptionEventCallbacks &event_callbacks, typename rclcpp::message_memory_strategy::MessageMemoryStrategy< CallbackMessageT, Alloc >::SharedPtr msg_mem_strat, std::shared_ptr< Alloc > allocator)
Return a SubscriptionFactory with functions for creating a SubscriptionT<MessageT, Alloc>.
Definition: subscription_factory.hpp:76
Pure virtual interface class for the NodeTopics part of the Node API.
Definition: node_topics_interface.hpp:38
Contains callbacks for non-message events that a Subscription can receive from the middleware...
Definition: qos_event.hpp:49
Take intraprocess configuration from the node.