16 #ifndef RCLCPP__GENERIC_PUBLISHER_HPP_
17 #define RCLCPP__GENERIC_PUBLISHER_HPP_
22 #include "rcpputils/shared_library.hpp"
24 #include "rclcpp/callback_group.hpp"
25 #include "rclcpp/macros.hpp"
26 #include "rclcpp/node_interfaces/node_base_interface.hpp"
27 #include "rclcpp/node_interfaces/node_topics_interface.hpp"
28 #include "rclcpp/publisher_base.hpp"
29 #include "rclcpp/qos.hpp"
30 #include "rclcpp/serialized_message.hpp"
31 #include "rclcpp/typesupport_helpers.hpp"
32 #include "rclcpp/visibility_control.hpp"
69 template<
typename AllocatorT = std::allocator<
void>>
72 std::shared_ptr<rcpputils::SharedLibrary> ts_lib,
73 const std::string & topic_name,
74 const std::string & topic_type,
87 this->add_event_handler(
89 RCL_PUBLISHER_OFFERED_DEADLINE_MISSED);
92 this->add_event_handler(
94 RCL_PUBLISHER_LIVELINESS_LOST);
97 this->add_event_handler(
99 RCL_PUBLISHER_OFFERED_INCOMPATIBLE_QOS);
103 this->add_event_handler(
104 [
this](QOSOfferedIncompatibleQoSInfo & info) {
105 this->default_incompatible_qos_callback(info);
107 RCL_PUBLISHER_OFFERED_INCOMPATIBLE_QOS);
132 std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
134 void * borrow_loaned_message();
135 void deserialize_message(
136 const rmw_serialized_message_t & serialized_message,
137 void * deserialized_msg);
138 void publish_loaned_message(
void * loaned_message);
Publisher for serialized messages whose type is not known at compile time.
RCLCPP_PUBLIC void publish(const rclcpp::SerializedMessage &message)
Publish a rclcpp::SerializedMessage.
GenericPublisher(rclcpp::node_interfaces::NodeBaseInterface *node_base, std::shared_ptr< rcpputils::SharedLibrary > ts_lib, const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options)
Constructor.
RCLCPP_PUBLIC void publish_as_loaned_msg(const rclcpp::SerializedMessage &message)
Encapsulation of Quality of Service settings.
Object oriented version of rcl_serialized_message_t with destructor to avoid memory leaks.
Pure virtual interface class for the NodeBase part of the Node API.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
RCLCPP_PUBLIC const rosidl_message_type_support_t * get_typesupport_handle(const std::string &type, const std::string &typesupport_identifier, rcpputils::SharedLibrary &library)
Extract the type support handle from the library.
PublisherEventCallbacks event_callbacks
Callbacks for various events related to publishers.
bool use_default_callbacks
Whether or not to use default callbacks when user doesn't supply any in event_callbacks.
Structure containing optional configuration for Publishers.