Function rmw_get_client_names_and_types_by_node
Defined in File get_node_info_and_types.h
Function Documentation
-
rmw_ret_t rmw_get_client_names_and_types_by_node(const rmw_node_t *node, rcutils_allocator_t *allocator, const char *node_name, const char *node_namespace, rmw_names_and_types_t *service_names_and_types)
Return all service names and types for which a given remote node has clients.
This function returns an array of service names and types for which a given remote node has clients, as discovered so far by the given local node.
Attribute
Adherence
Allocates Memory
Yes
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, when querying served service names and types:
Access to the array of names and types is not synchronized. It is not safe to read or write
service_names_and_types
while rmw_get_client_names_and_types_by_node() uses it.Access to C-style string arguments is read-only but it is not synchronized. Concurrent
node_name
andnode_namespace
reads are safe, but concurrent reads and writes are not.The default allocators are thread-safe objects, but any custom
allocator
may not be. Check your allocator documentation for further reference.
- Parameters:
node – [in] Local node to query the ROS graph.
allocator – [in] Allocator to be used when populating the
service_names_and_types
array.node_name – [in] Name of the remote node to get information for.
node_namespace – [in] Namespace of the remote node to get information for.
service_names_and_types – [out] Array of service names and types the remote node has created a service client for, populated on success but left unchanged on failure. If populated, it is up to the caller to finalize this array later on using rmw_names_and_types_fini().
- Returns:
RMW_RET_OK
if the query was successful, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifnode
is NULL, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifallocator
is not valid, by rcutils_allocator_is_valid() definition, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifnode_name
is not valid, by rmw_validate_node_name() definition, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifnode_namespace
is not valid, by rmw_validate_namespace() definition, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifservice_names_and_types
is NULL, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifservice_names_and_types
is not a zero-initialized array, or- Returns:
RMW_RET_INCORRECT_RMW_IMPLEMENTATION
if thenode
implementation identifier does not match this implementation, or- Returns:
RMW_RET_NODE_NAME_NON_EXISTENT
if the node name wasn’t found, or- Returns:
RMW_RET_BAD_ALLOC
if memory allocation fails, or- Returns:
RMW_RET_ERROR
if an unspecified error occurs.