16 #include "rclcpp/generic_subscription.hpp"
23 #include "rclcpp/exceptions.hpp"
34 std::shared_ptr<rclcpp::SerializedMessage>
37 return std::make_shared<rclcpp::SerializedMessage>(0);
45 for (
const auto & [_, event_ptr] : event_handlers_) {
57 for (
const auto & [_, event_ptr] : event_handlers_) {
66 std::shared_ptr<void> &,
70 "handle_message is not implemented for GenericSubscription");
75 const std::shared_ptr<rclcpp::SerializedMessage> & message,
78 any_callback_.dispatch(message, message_info);
83 [[maybe_unused]]
void * message,
87 "handle_loaned_message is not implemented for GenericSubscription");
93 auto typed_message = std::static_pointer_cast<rclcpp::SerializedMessage>(message);
99 std::shared_ptr<rclcpp::SerializedMessage> & message)
107 rclcpp::dynamic_typesupport::DynamicMessageType::SharedPtr
108 GenericSubscription::get_shared_dynamic_message_type()
111 "get_shared_dynamic_message_type is not implemented for GenericSubscription");
114 rclcpp::dynamic_typesupport::DynamicMessage::SharedPtr
115 GenericSubscription::get_shared_dynamic_message()
118 "get_shared_dynamic_message is not implemented for GenericSubscription");
121 rclcpp::dynamic_typesupport::DynamicSerializationSupport::SharedPtr
122 GenericSubscription::get_shared_dynamic_serialization_support()
125 "get_shared_dynamic_serialization_support is not implemented for GenericSubscription");
128 rclcpp::dynamic_typesupport::DynamicMessage::SharedPtr
132 "create_dynamic_message is not implemented for GenericSubscription");
136 GenericSubscription::return_dynamic_message(
137 [[maybe_unused]] rclcpp::dynamic_typesupport::DynamicMessage::SharedPtr & message)
140 "return_dynamic_message is not implemented for GenericSubscription");
144 GenericSubscription::handle_dynamic_message(
145 [[maybe_unused]]
const rclcpp::dynamic_typesupport::DynamicMessage::SharedPtr & message,
149 "handle_dynamic_message is not implemented for GenericSubscription");
void disable()
Disable the callback from being called during dispatch.
void enable()
Enable the callback to be called during dispatch.
RCLCPP_PUBLIC void return_message(std::shared_ptr< void > &message) override
Return the message borrowed in create_message.
RCLCPP_PUBLIC rclcpp::dynamic_typesupport::DynamicMessage::SharedPtr create_dynamic_message() override
Borrow a new serialized message (this clones!)
RCLCPP_PUBLIC void return_serialized_message(std::shared_ptr< rclcpp::SerializedMessage > &message) override
Return the message borrowed in create_serialized_message.
RCLCPP_PUBLIC void handle_message(std::shared_ptr< void > &message, const rclcpp::MessageInfo &message_info) override
Cast the message to a rclcpp::SerializedMessage and call the callback.
RCLCPP_PUBLIC std::shared_ptr< rclcpp::SerializedMessage > create_serialized_message() override
Borrow a new serialized message.
RCLCPP_PUBLIC void handle_loaned_message(void *loaned_message, const rclcpp::MessageInfo &message_info) override
This function is currently not implemented.
RCLCPP_PUBLIC void disable_callbacks() override
Disable callbacks from being called.
RCLCPP_PUBLIC void enable_callbacks() override
Enable the callbacks to be called.
RCLCPP_PUBLIC std::shared_ptr< void > create_message() override
Borrow a new message.
RCLCPP_PUBLIC void handle_serialized_message(const std::shared_ptr< rclcpp::SerializedMessage > &serialized_message, const rclcpp::MessageInfo &message_info) override
Handle dispatching rclcpp::SerializedMessage to user callback.
Additional meta data about messages taken from subscriptions.
virtual RCLCPP_PUBLIC void enable_callbacks()
Enable the callbacks to be called.
virtual RCLCPP_PUBLIC void disable_callbacks()
Disable callbacks from being called.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.