Function rcl_get_topic_names_and_types

Function Documentation

rcl_ret_t rcl_get_topic_names_and_types(const rcl_node_t *node, rcl_allocator_t *allocator, bool no_demangle, rcl_names_and_types_t *topic_names_and_types)

Return a list of topic names and their types.

The node parameter must point to a valid node.

The topic_names_and_types parameter must be allocated and zero initialized. This function allocates memory for the returned list of names and types and so it is the callers responsibility to pass topic_names_and_types to rcl_names_and_types_fini() when it is no longer needed. Failing to do so will result in leaked memory.

The returned names are not automatically remapped by this function. Attempting to create publishers or subscribers using names returned by this function may not result in the desired topic name being used depending on the remap rules in use.

See also

rcl_get_publisher_names_and_types_by_node for details on the no_demangle parameter.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters:
  • node[in] the handle to the node being used to query the ROS graph

  • allocator[in] allocator to be used when allocating space for strings

  • no_demangle[in] if true, list all topics without any demangling

  • topic_names_and_types[out] list of topic names and their types

Returns:

RCL_RET_OK if the query was successful, or

Returns:

RCL_RET_NODE_INVALID if the node is invalid, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_NODE_INVALID_NAME if the node name is invalid, or

Returns:

RCL_RET_NODE_INVALID_NAMESPACE if the node namespace is invalid, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.