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>
44 namespace node_interfaces
46 class NodeBaseInterface;
49 namespace experimental
55 class IntraProcessManager;
79 const rosidl_message_type_support_t & type_support_handle,
206 const rosidl_message_type_support_t &
241 uint64_t intra_process_subscription_id,
250 rclcpp::Waitable::SharedPtr
280 template<
typename EventCallbackT>
283 const EventCallbackT & callback,
318 rosidl_message_type_support_t type_support_;
322 std::atomic<bool> intra_process_subscription_waitable_in_use_by_wait_set_{
false};
329 #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.
rcl_subscription_event_type_t
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:307
const rosidl_message_type_support_t & get_message_type_support_handle() const
rclcpp::node_interfaces::NodeBaseInterface *const node_base_
Definition: subscription_base.hpp:303
bool use_intra_process_
Definition: subscription_base.hpp:311
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
rcl_ret_t rcl_subscription_event_init(rcl_event_t *event, const rcl_subscription_t *subscription, const rcl_subscription_event_type_t event_type)
virtual void return_message(std::shared_ptr< void > &message)=0
Return the message borrowed in create_message.
IntraProcessManagerWeakPtr weak_ipm_
Definition: subscription_base.hpp:312
std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > event_handlers_
Definition: subscription_base.hpp:309
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:60
size_t get_publisher_count() const
Get matching publisher count.
uint64_t intra_process_subscription_id_
Definition: subscription_base.hpp:313
std::shared_ptr< rcl_subscription_t > subscription_handle_
Definition: subscription_base.hpp:306
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)
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:110
std::vector< rclcpp::NetworkFlowEndpoint > get_network_flow_endpoints() const
Get network flow endpoints.
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()
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:305
Definition: qos_event.hpp:84
Definition: qos_event.hpp:111
void add_event_handler(const EventCallbackT &callback, const rcl_subscription_event_type_t event_type)
Definition: subscription_base.hpp:282
rclcpp::QoS get_actual_qos() const
Get the actual QoS settings, after the defaults have been determined.