15 #ifndef RCLCPP__PUBLISHER_OPTIONS_HPP_
16 #define RCLCPP__PUBLISHER_OPTIONS_HPP_
20 #include <type_traits>
25 #include "rclcpp/allocator/allocator_common.hpp"
26 #include "rclcpp/detail/rmw_implementation_specific_publisher_payload.hpp"
27 #include "rclcpp/intra_process_buffer_type.hpp"
28 #include "rclcpp/intra_process_setting.hpp"
29 #include "rclcpp/qos.hpp"
30 #include "rclcpp/event_handler.hpp"
31 #include "rclcpp/qos_overriding_options.hpp"
56 RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_NOT_REQUIRED;
62 std::shared_ptr<rclcpp::detail::RMWImplementationSpecificPublisherPayload>
69 template<
typename Allocator>
73 std::is_void_v<
typename std::allocator_traits<Allocator>::value_type>,
74 "Publisher allocator value type must be void");
87 template<
typename MessageT>
92 result.
allocator = this->get_rcl_allocator();
107 std::shared_ptr<Allocator>
110 if (!this->allocator) {
111 if (!allocator_storage_) {
112 allocator_storage_ = std::make_shared<Allocator>();
114 return allocator_storage_;
120 using PlainAllocator =
121 typename std::allocator_traits<Allocator>::template rebind_alloc<char>;
124 get_rcl_allocator()
const
126 if (!plain_allocator_storage_) {
127 plain_allocator_storage_ =
130 return rclcpp::allocator::get_rcl_allocator<char>(*plain_allocator_storage_);
135 mutable std::shared_ptr<Allocator> allocator_storage_;
139 mutable std::shared_ptr<PlainAllocator> plain_allocator_storage_;
142 using PublisherOptions = PublisherOptionsWithAllocator<std::allocator<void>>;
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Encapsulation of Quality of Service settings.
rmw_qos_profile_t & get_rmw_qos_profile()
Return the rmw qos profile.
Options that are passed in subscription/publisher constructor to specify QoSConfigurability.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
IntraProcessSetting
Used as argument in create_publisher and create_subscriber.
@ NodeDefault
Take intraprocess configuration from the node.
@ SharedPtr
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
RCL_PUBLIC RCL_WARN_UNUSED rcl_publisher_options_t rcl_publisher_get_default_options(void)
Return the default publisher options in a rcl_publisher_options_t.
Options available for a rcl publisher.
rmw_qos_profile_t qos
Middleware quality of service settings for the publisher.
rmw_publisher_options_t rmw_publisher_options
rmw specific publisher options, e.g. the rmw implementation specific payload.
rcl_allocator_t allocator
Custom allocator for the publisher, used for incidental allocations.
Contains callbacks for various types of events a Publisher can receive from the middleware.
Non-templated part of PublisherOptionsWithAllocator<Allocator>.
rmw_unique_network_flow_endpoints_requirement_t require_unique_network_flow_endpoints
IntraProcessBufferType intra_process_buffer_type
Setting the data-type stored in the intraprocess buffer.
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.
std::shared_ptr< rclcpp::detail::RMWImplementationSpecificPublisherPayload > rmw_implementation_payload
Optional RMW implementation specific payload to be used during creation of the publisher.
IntraProcessSetting use_intra_process_comm
Setting to explicitly set intraprocess communications.
std::shared_ptr< rclcpp::CallbackGroup > callback_group
Callback group in which the waitable items from the publisher should be placed.
Structure containing optional configuration for Publishers.
PublisherOptionsWithAllocator(const PublisherOptionsBase &publisher_options_base)
Constructor using base class as input.
std::shared_ptr< Allocator > allocator
Optional custom allocator.
std::shared_ptr< Allocator > get_allocator() const
Get the allocator, creating one if needed.
rcl_publisher_options_t to_rcl_publisher_options(const rclcpp::QoS &qos) const
Convert this class, and a rclcpp::QoS, into an rcl_publisher_options_t.