Skip to content

Commit 9f2e181

Browse files
authored
Add function for getting clients by node (#179)
Signed-off-by: Jacob Perron <[email protected]>
1 parent 2250b3e commit 9f2e181

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

rmw/include/rmw/get_node_info_and_types.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,41 @@ rmw_get_service_names_and_types_by_node(
131131
const char * node_namespace,
132132
rmw_names_and_types_t * service_names_and_types);
133133

134+
/// Return a list of service client topic names and their types.
135+
/**
136+
* This function returns a list of service client topic names and their types.
137+
*
138+
* The node parameter must not be `NULL`, and must point to a valid node.
139+
*
140+
* The topic_names_and_types parameter must be allocated and zero initialized.
141+
* The topic_names_and_types is the output for this function, and contains
142+
* allocated memory.
143+
* Therefore, it should be passed to rmw_names_and_types_fini() when
144+
* it is no longer needed.
145+
* Failing to do so will result in leaked memory.
146+
*
147+
* \param[in] node the handle to the node being used to query the ROS graph
148+
* \param[in] allocator allocator to be used when allocating space for strings
149+
* \param[in] node_name the name of the node to get information for
150+
* \param[in] node_namespace the namespace of the node to get information for
151+
* \param[out] topic_names_and_types list of topic names and their types the
152+
* node_name has created a service client for
153+
* \return `RMW_RET_OK` if the query was successful, or
154+
* \return `RMW_RET_INVALID_ARGUMENT` if the node is invalid, or
155+
* \return `RMW_RET_INVALID_ARGUMENT` if any arguments are invalid, or
156+
* \return `RMW_RET_BAD_ALLOC` if memory allocation fails, or
157+
* \return `RMW_RET_ERROR` if an unspecified error occurs.
158+
*/
159+
RMW_PUBLIC
160+
RMW_WARN_UNUSED
161+
rmw_ret_t
162+
rmw_get_client_names_and_types_by_node(
163+
const rmw_node_t * node,
164+
rcutils_allocator_t * allocator,
165+
const char * node_name,
166+
const char * node_namespace,
167+
rmw_names_and_types_t * service_names_and_types);
168+
134169
#ifdef __cplusplus
135170
}
136171
#endif

0 commit comments

Comments
 (0)