rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
Functions
get_topic_endpoint_info.h File Reference
#include "rmw/topic_endpoint_info_array.h"
#include "rmw/visibility_control.h"
Include dependency graph for get_topic_endpoint_info.h:

Go to the source code of this file.

Functions

rmw_ret_t rmw_get_publishers_info_by_topic (const rmw_node_t *node, rcutils_allocator_t *allocator, const char *topic_name, bool no_mangle, rmw_topic_endpoint_info_array_t *publishers_info)
 Retrieve the information for all publishers to a given topic. More...
 
rmw_ret_t rmw_get_subscriptions_info_by_topic (const rmw_node_t *node, rcutils_allocator_t *allocator, const char *topic_name, bool no_mangle, rmw_topic_endpoint_info_array_t *subscriptions_info)
 Retrieve the information for all subscriptions to a given topic. More...
 

Function Documentation

◆ rmw_get_publishers_info_by_topic()

rmw_ret_t rmw_get_publishers_info_by_topic ( const rmw_node_t node,
rcutils_allocator_t allocator,
const char *  topic_name,
bool  no_mangle,
rmw_topic_endpoint_info_array_t publishers_info 
)

Retrieve the information for all publishers to a given topic.

The retrieved information will contain the publisher's node name, node namespace, associated topic type, publisher gid and qos profile.

The node parameter must not be NULL and must point to a valid node.

The topic_name parameter must not be NULL and must follow the topic naming rules mentioned at http://design.ros2.org/articles/topic_and_service_names.html Names of non-existent topics are allowed. In that case, this function will return an empty array.

It is the responsibility of the caller to ensure that publishers_info parameter points to a valid struct of type rmw_topic_endpoint_info_array_t. The rmw_topic_endpoint_info_array_t struct must be zero initialized.

See also
rmw_get_zero_initialized_topic_endpoint_info_array

The allocator will be used to allocate memory to the info_array member inside of publishers_info. Moreover, every const char * member inside of rmw_topic_endpoint_info_t will be assigned a copied value on allocated memory.

See also
rmw_topic_endpoint_info_set_topic_type
rmw_topic_endpoint_info_set_node_name
rmw_topic_endpoint_info_set_node_namespace However, it is the responsibility of the caller to reclaim any allocated resources to publishers_info to avoid leaking memory.
rmw_topic_endpoint_info_array_fini
Parameters
[in]nodethe handle to the node being used to query the ROS graph.
[in]allocatorthe allocator to be used when allocating space for the array.
[in]topic_namethe name of the topic for which the list of publishers will be retrieved.
[in]no_mangleif true, the topic name will not be mangled.
[out]publishers_infoan array of rmw_topic_endpoint_info_t.
Returns
RMW_RET_OK if the query was successful, or
RMW_RET_INVALID_ARGUMENT if the node is invalid, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
RMW_RET_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR if an unspecified error occurs.

◆ rmw_get_subscriptions_info_by_topic()

rmw_ret_t rmw_get_subscriptions_info_by_topic ( const rmw_node_t node,
rcutils_allocator_t allocator,
const char *  topic_name,
bool  no_mangle,
rmw_topic_endpoint_info_array_t subscriptions_info 
)

Retrieve the information for all subscriptions to a given topic.

The retrieved information will contain the subscriptions's node name, node namespace, associated topic type, subscription gid and qos profile.

The node parameter must not be NULL and must point to a valid node.

The topic_name parameter must not be NULL and must follow the topic naming rules mentioned at http://design.ros2.org/articles/topic_and_service_names.html Names of non-existent topics are allowed. They will return an empty array.

It is the responsibility of the caller to ensure that subscriptions_info parameter points to a valid struct of type rmw_topic_endpoint_info_array_t. The rmw_topic_endpoint_info_array_t struct must be zero initialized.

See also
rmw_get_zero_initialized_topic_endpoint_info_array

The allocator will be used to allocate memory to the info_array member inside of publishers_info. Moreover, every const char * member inside of rmw_topic_endpoint_info_t will be assigned a copied value on allocated memory.

See also
rmw_topic_endpoint_info_set_topic_type
rmw_topic_endpoint_info_set_node_name
rmw_topic_endpoint_info_set_node_namespace However, it is the responsibility of the caller to reclaim any allocated resources to publishers_info to avoid leaking memory.
rmw_topic_endpoint_info_array_fini
Parameters
[in]nodethe handle to the node being used to query the ROS graph.
[in]allocatorthe allocator to be used when allocating space for the array.
[in]topic_namethe name of the topic for which the list of subscriptions will be retrieved.
[in]no_mangleif true, the topic name will not be mangled.
[out]subscriptions_infoan array of rmw_topic_endpoint_info_t..
Returns
RMW_RET_OK if the query was successful, or
RMW_RET_INVALID_ARGUMENT if the node is invalid, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
RMW_RET_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR if an unspecified error occurs.