Function rmw_count_publishers
Defined in File rmw.h
Function Documentation
-
rmw_ret_t rmw_count_publishers(const rmw_node_t *node, const char *topic_name, size_t *count)
Count the number of known publishers matching a topic name.
This function returns the numbers of publishers of a given topic in the ROS graph, as discovered so far by the given node.
[1] implementation defined, check the implementation documentationAttribute
Adherence
Allocates Memory
No
Thread-Safe
Yes
Uses Atomics
Maybe [1]
Lock-Free
Maybe [1]
- Runtime behavior
To query the ROS graph is a synchronous operation. It is also non-blocking, but it is not guaranteed to be lock-free. Generally speaking, implementations may synchronize access to internal resources using locks but are not allowed to wait for events with no guaranteed time bound (barring the effects of starvation due to OS scheduling).
- Thread-safety
Nodes are thread-safe objects, and so are all operations on them except for finalization. Therefore, it is safe to query the ROS graph using the same node concurrently. However, access to primitive data-type arguments is not synchronized. It is not safe to read or write
topic_nameorcountwhile rmw_count_publishers() uses them.
- Parameters:
node – [in] Handle to node to use to query the ROS graph.
topic_name – [in] Fully qualified ROS topic name.
count – [out] Number of publishers matching the given topic name.
- Pre:
Given
nodemust be a valid node handle, as returned by rmw_create_node().- Returns:
RMW_RET_OKif the query was successful, or- Returns:
RMW_RET_INVALID_ARGUMENTifnodeis NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTiftopic_nameis NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTiftopic_nameis not a fully qualified topic name, by rmw_validate_full_topic_name() definition, or- Returns:
RMW_RET_INVALID_ARGUMENTifcountis NULL, or- Returns:
RMW_RET_INCORRECT_RMW_IMPLEMENTATIONif thenodeimplementation identifier does not match this implementation, or- Returns:
RMW_RET_ERRORif an unspecified error occurs.