rclcpp  master
C++ ROS Client Library API
Public Types | Public Member Functions | Protected Attributes | List of all members
rclcpp::publisher::PublisherBase Class Reference

#include <publisher.hpp>

Inheritance diagram for rclcpp::publisher::PublisherBase:
rclcpp::publisher::Publisher< rcl_interfaces::msg::ParameterEvent > rclcpp::publisher::Publisher< MessageT, Alloc >

Public Types

using StoreMessageCallbackT = std::function< uint64_t(uint64_t, void *, const std::type_info &)>
 

Public Member Functions

 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. More...
 
virtual ~PublisherBase ()
 
const char * get_topic_name () const
 Get the topic that this publisher publishes on. More...
 
size_t get_queue_size () const
 Get the queue size for this publisher. More...
 
const rmw_gid_tget_gid () const
 Get the global identifier for this publisher (used in rmw and by DDS). More...
 
const rmw_gid_tget_intra_process_gid () const
 Get the global identifier for this publisher used by intra-process communication. More...
 
bool operator== (const rmw_gid_t &gid) const
 Compare this publisher to a gid. More...
 
bool operator== (const rmw_gid_t *gid) const
 Compare this publisher to a pointer gid. More...
 
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. More...
 

Protected Attributes

std::shared_ptr< rcl_node_trcl_node_handle_
 
rcl_publisher_t publisher_handle_ = rcl_get_zero_initialized_publisher()
 
rcl_publisher_t intra_process_publisher_handle_ = rcl_get_zero_initialized_publisher()
 
uint64_t intra_process_publisher_id_
 
StoreMessageCallbackT store_intra_process_message_
 
rmw_gid_t rmw_gid_
 
rmw_gid_t intra_process_rmw_gid_
 

Member Typedef Documentation

◆ StoreMessageCallbackT

using rclcpp::publisher::PublisherBase::StoreMessageCallbackT = std::function<uint64_t(uint64_t, void *, const std::type_info &)>

Constructor & Destructor Documentation

◆ PublisherBase()

rclcpp::publisher::PublisherBase::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.

Typically, a publisher is not created through this method, but instead is created through a call to Node::create_publisher.

Parameters
[in]node_baseA pointer to the NodeBaseInterface for the parent node.
[in]topicThe topic that this publisher publishes on.
[in]type_supportThe type support structure for the type to be published.
[in]publisher_optionsQoS settings for this publisher.

◆ ~PublisherBase()

virtual rclcpp::publisher::PublisherBase::~PublisherBase ( )
virtual

Member Function Documentation

◆ get_topic_name()

const char* rclcpp::publisher::PublisherBase::get_topic_name ( ) const

Get the topic that this publisher publishes on.

Returns
The topic name.

◆ get_queue_size()

size_t rclcpp::publisher::PublisherBase::get_queue_size ( ) const

Get the queue size for this publisher.

Returns
The queue size.

◆ get_gid()

const rmw_gid_t& rclcpp::publisher::PublisherBase::get_gid ( ) const

Get the global identifier for this publisher (used in rmw and by DDS).

Returns
The gid.

◆ get_intra_process_gid()

const rmw_gid_t& rclcpp::publisher::PublisherBase::get_intra_process_gid ( ) const

Get the global identifier for this publisher used by intra-process communication.

Returns
The intra-process gid.

◆ operator==() [1/2]

bool rclcpp::publisher::PublisherBase::operator== ( const rmw_gid_t gid) const

Compare this publisher to a gid.

Note that this function calls the next function.

Parameters
[in]gidReference to a gid.
Returns
True if the publisher's gid matches the input.

◆ operator==() [2/2]

bool rclcpp::publisher::PublisherBase::operator== ( const rmw_gid_t gid) const

Compare this publisher to a pointer gid.

A wrapper for comparing this publisher's gid to the input using rmw_compare_gids_equal.

Parameters
[in]gidA pointer to a gid.
Returns
True if this publisher's gid matches the input.

◆ setup_intra_process()

void rclcpp::publisher::PublisherBase::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.

Member Data Documentation

◆ rcl_node_handle_

std::shared_ptr<rcl_node_t> rclcpp::publisher::PublisherBase::rcl_node_handle_
protected

◆ publisher_handle_

rcl_publisher_t rclcpp::publisher::PublisherBase::publisher_handle_ = rcl_get_zero_initialized_publisher()
protected

◆ intra_process_publisher_handle_

rcl_publisher_t rclcpp::publisher::PublisherBase::intra_process_publisher_handle_ = rcl_get_zero_initialized_publisher()
protected

◆ intra_process_publisher_id_

uint64_t rclcpp::publisher::PublisherBase::intra_process_publisher_id_
protected

◆ store_intra_process_message_

StoreMessageCallbackT rclcpp::publisher::PublisherBase::store_intra_process_message_
protected

◆ rmw_gid_

rmw_gid_t rclcpp::publisher::PublisherBase::rmw_gid_
protected

◆ intra_process_rmw_gid_

rmw_gid_t rclcpp::publisher::PublisherBase::intra_process_rmw_gid_
protected

The documentation for this class was generated from the following file: