15 #ifndef RCLCPP__PUBLISHER_HPP_ 16 #define RCLCPP__PUBLISHER_HPP_ 30 #include "rcl_interfaces/msg/intra_process_message.hpp" 43 namespace node_interfaces
45 class NodeTopicsInterface;
50 friend ::rclcpp::node_interfaces::NodeTopicsInterface;
68 const rosidl_message_type_support_t & type_support,
136 uint64_t intra_process_publisher_id,
154 template<
typename MessageT,
typename Alloc = std::allocator<
void>>
166 rclcpp::node_interfaces::NodeBaseInterface * node_base,
167 const
std::
string & topic,
173 *rosidl_typesupport_cpp::get_message_type_support_handle<MessageT>(),
200 MessageT * msg_ptr = msg.
get();
202 uint64_t message_seq =
204 rcl_interfaces::msg::IntraProcessMessage ipm;
206 ipm.message_sequence = message_seq;
236 return this->
publish(unique_msg);
255 return this->
publish(unique_msg);
270 return this->
publish(unique_msg);
307 #endif // RCLCPP__PUBLISHER_HPP_ void setup_intra_process(uint64_t intra_process_publisher_id, StoreMessageCallbackT callback, const rcl_publisher_options_t &intra_process_options)
Implementation utility function used to setup intra process publishing after creation.
virtual void publish(std::shared_ptr< const MessageT > msg)
Definition: publisher.hpp:240
virtual void publish(const std::shared_ptr< MessageT > &msg)
Definition: publisher.hpp:221
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:155
std::shared_ptr< MessageAlloc > message_allocator_
Definition: publisher.hpp:300
size_t get_queue_size() const
Get the queue size for this publisher.
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: publisher.hpp:159
PublisherBase(rclcpp::node_interfaces::NodeBaseInterface *node_base, const std::string &topic, const rosidl_message_type_support_t &type_support, const rcl_publisher_options_t &publisher_options)
Default constructor.
std::shared_ptr< rcl_node_t > rcl_node_handle_
Definition: publisher.hpp:141
Definition: publisher.hpp:48
Definition: allocator_common.hpp:24
virtual ~Publisher()
Definition: publisher.hpp:180
std::shared_ptr< MessageAlloc > get_allocator() const
Definition: publisher.hpp:282
rmw_gid_t intra_process_rmw_gid_
Definition: publisher.hpp:150
StoreMessageCallbackT store_intra_process_message_
Definition: publisher.hpp:147
virtual void publish(const MessageT *msg)
Definition: publisher.hpp:274
void set_allocator_for_deleter(D *deleter, Alloc *alloc)
Definition: allocator_deleter.hpp:72
allocator::Deleter< MessageAlloc, rcl_interfaces::msg::ParameterEvent > MessageDeleter
Definition: publisher.hpp:160
MessageDeleter message_deleter_
Definition: publisher.hpp:302
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
rcl_publisher_t rcl_get_zero_initialized_publisher(void)
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
virtual void publish(const MessageT &msg)
Definition: publisher.hpp:259
const char * get_topic_name() const
Get the topic that this publisher publishes on.
#define rcl_get_error_string_safe
uint64_t intra_process_publisher_id_
Definition: publisher.hpp:146
rcl_publisher_t intra_process_publisher_handle_
Definition: publisher.hpp:144
rcl_publisher_t * get_publisher_handle()
Get the rcl publisher handle.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
rcl_publisher_t publisher_handle_
Definition: publisher.hpp:143
rmw_gid_t rmw_gid_
Definition: publisher.hpp:149
virtual void publish(std::unique_ptr< MessageT, MessageDeleter > &msg)
Send a message to the topic for this publisher.
Definition: publisher.hpp:189
bool operator==(const rmw_gid_t &gid) const
Compare this publisher to a gid.
Pure virtual interface class for the NodeBase part of the Node API.
Definition: node_base_interface.hpp:36
void do_inter_process_publish(const MessageT *msg)
Definition: publisher.hpp:289
typename std::conditional< std::is_same< typename std::allocator_traits< Alloc >::template rebind_alloc< T >, typename std::allocator< void >::template rebind< T >::other >::value, std::default_delete< T >, AllocatorDeleter< Alloc > >::type Deleter
Definition: allocator_deleter.hpp:101
allocator::AllocRebind< rcl_interfaces::msg::ParameterEvent, std::allocator< void > > MessageAllocTraits
Definition: publisher.hpp:158
const rmw_gid_t & get_intra_process_gid() const
Get the global identifier for this publisher used by intra-process communication. ...
rcl_ret_t rcl_publish(const rcl_publisher_t *publisher, const void *ros_message)
const rmw_gid_t & get_gid() const
Get the global identifier for this publisher (used in rmw and by DDS).