Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions rmw/include/rmw/get_node_info_and_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C"
#include "rmw/types.h"
#include "rmw/visibility_control.h"

/// Return all topic names and types for which a given remote node has subscriptions.
/// Return all topic names, types, and type hashes for which a given remote node has subscriptions.
/**
* This function returns an array of topic names and types for which a given remote
* This function returns an array of topic names, types, and type hashes for which a given remote
* node has subscriptions, as discovered so far by the given local node.
*
* <hr>
Expand All @@ -49,8 +49,8 @@ extern "C"
* \par 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 subscribed topic names and types:
* - Access to the array of names and types is not synchronized.
* However, when querying subscribed topic names, types, and type hashes:
* - Access to the array of names, types, and type hashes is not synchronized.
* It is not safe to read or write `topic_names_and_types`
* while rmw_get_subscriber_names_and_types_by_node() uses it.
* - Access to node name and namespace is read-only but it is not synchronized.
Expand All @@ -60,15 +60,15 @@ extern "C"
* Check your allocator documentation for further reference.
*
* \pre Given `node` must be a valid node handle, as returned by rmw_create_node().
* \pre Given `topic_names_and_types` must be a zero-initialized array of names and types,
* \pre Given `topic_names_and_types` must be a zero-initialized array of names, types, and type hashes,
* as returned by rmw_get_zero_initialized_names_and_types().
*
* \param[in] node Local node to query the ROS graph.
* \param[in] allocator Allocator to be used when populating the `topic_names_and_types` array.
* \param[in] node_name Name of the remote node to get information for.
* \param[in] node_namespace Namespace of the remote node to get information for.
* \param[in] no_demangle Whether to demangle all topic names following ROS conventions or not.
* \param[out] topic_names_and_types Array of topic names and types the remote node has created
* \param[out] topic_names_and_types Array of topic names, types, and type hashes the remote node has created
* a subscription 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().
Expand Down Expand Up @@ -100,9 +100,9 @@ rmw_get_subscriber_names_and_types_by_node(
bool no_demangle,
rmw_names_and_types_t * topic_names_and_types);

/// Return all topic names and types for which a given remote node has publishers.
/// Return all topic names, types, and type hashes for which a given remote node has publishers.
/**
* This function returns an array of topic names and types for which a given remote
* This function returns an array of topic names, types, and type hashes for which a given remote
* node has created publishers, as discovered so far by the given local node.
*
* <hr>
Expand All @@ -124,8 +124,8 @@ rmw_get_subscriber_names_and_types_by_node(
* \par 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 published topic names and types:
* - Access to the array of names and types is not synchronized.
* However, when querying published topic names, types, and type hashes:
* - Access to the array of names, types, and type hashes is not synchronized.
* It is not safe to read or write `topic_names_and_types`
* while rmw_get_publisher_names_and_types_by_node() uses it.
* - Access to node name and namespace is read-only but it is not synchronized.
Expand All @@ -135,15 +135,15 @@ rmw_get_subscriber_names_and_types_by_node(
* Check your allocator documentation for further reference.
*
* \pre Given `node` must be a valid node handle, as returned by rmw_create_node().
* \pre Given `topic_names_and_types` must be a zero-initialized array of names and types,
* \pre Given `topic_names_and_types` must be a zero-initialized array of names, types, and type hashes,
* as returned by rmw_get_zero_initialized_names_and_types().
*
* \param[in] node Local node to query the ROS graph.
* \param[in] allocator Allocator to be used when populating the `topic_names_and_types` array.
* \param[in] node_name Name of the remote node to get information for.
* \param[in] node_namespace Namespace of the remote node to get information for.
* \param[in] no_demangle Whether to demangle all topic names following ROS conventions or not.
* \param[out] topic_names_and_types Array of topic names and types the remote node has created
* \param[out] topic_names_and_types Array of topic names, types, and type hashes the remote node has created
* a publisher 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().
Expand Down Expand Up @@ -175,9 +175,9 @@ rmw_get_publisher_names_and_types_by_node(
bool no_demangle,
rmw_names_and_types_t * topic_names_and_types);

/// Return all service names and types for which a given remote node has servers.
/// Return all service names, types, and type hashes for which a given remote node has servers.
/**
* This function returns an array of service names and types for which a given remote
* This function returns an array of service names, types, and type hashes for which a given remote
* node has servers, as discovered so far by the given local node.
*
* <hr>
Expand All @@ -199,8 +199,8 @@ rmw_get_publisher_names_and_types_by_node(
* \par 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.
* However, when querying served service names, types, and type hashes:
* - Access to the array of names, types, and type hashes is not synchronized.
* It is not safe to read or write `service_names_and_types`
* while rmw_get_service_names_and_types_by_node() uses it.
* - Access to node name and namespace is read-only but it is not synchronized.
Expand All @@ -213,7 +213,7 @@ rmw_get_publisher_names_and_types_by_node(
* \param[in] allocator Allocator to be used when populating the `service_names_and_types` array.
* \param[in] node_name Name of the remote node to get information for.
* \param[in] node_namespace Namespace of the remote node to get information for.
* \param[out] service_names_and_types Array of service names and types the remote node has
* \param[out] service_names_and_types Array of service names, types, and type hashes the remote node has
* created a service server 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().
Expand Down Expand Up @@ -244,9 +244,9 @@ rmw_get_service_names_and_types_by_node(
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.
/// Return all service names, types, and type hashes for which a given remote node has clients.
/**
* This function returns an array of service names and types for which a given remote
* This function returns an array of service names, types, and type hashes for which a given remote
* node has clients, as discovered so far by the given local node.
*
* <hr>
Expand All @@ -268,8 +268,8 @@ rmw_get_service_names_and_types_by_node(
* \par 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.
* However, when querying served service names, types, and type hashes:
* - Access to the array of names, types, and type hashes 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.
Expand All @@ -282,7 +282,7 @@ rmw_get_service_names_and_types_by_node(
* \param[in] allocator Allocator to be used when populating the `service_names_and_types` array.
* \param[in] node_name Name of the remote node to get information for.
* \param[in] node_namespace Namespace of the remote node to get information for.
* \param[out] service_names_and_types Array of service names and types the remote node has
* \param[out] service_names_and_types Array of service names, types, and type hashes 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().
Expand Down
12 changes: 6 additions & 6 deletions rmw/include/rmw/get_service_names_and_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C"
#include "rmw/types.h"
#include "rmw/visibility_control.h"

/// Return all service names and types in the ROS graph.
/// Return all service names, types, and type hashes in the ROS graph.
/**
* This function returns an array of all service names and types in the ROS graph
* This function returns an array of all service names, types, and type hashes in the ROS graph
* i.e. for which a server and/or client exists, as discovered so far by the given
* local node.
*
Expand All @@ -50,20 +50,20 @@ extern "C"
* \par 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 services names and types:
* - Access to the array of names and types is not synchronized.
* However, when querying services names, types, and type hashes:
* - Access to the array of names, types, and type hashes is not synchronized.
* It is not safe to read or write `service_names_and_types`
* while rmw_get_service_names_and_types() uses it.
* - The default allocators are thread-safe objects, but any custom `allocator` may not be.
* Check your allocator documentation for further reference.
*
* \pre Given `node` must be a valid node handle, as returned by rmw_create_node().
* \pre Given `services_names_and_types` must be a zero-initialized array of names and types,
* \pre Given `services_names_and_types` must be a zero-initialized array of names, types, and type hashes,
* as returned by rmw_get_zero_initialized_names_and_types().
*
* \param[in] node Node to query the ROS graph.
* \param[in] allocator Allocator to be used when populating the `service_names_and_types` array.
* \param[out] service_names_and_types Array of service names and their types,
* \param[out] service_names_and_types Array of service names, their types, and their type hashes,
* 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().
Expand Down
10 changes: 5 additions & 5 deletions rmw/include/rmw/get_topic_names_and_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C"
#include "rmw/types.h"
#include "rmw/visibility_control.h"

/// Return all topic names and types in the ROS graph.
/// Return all topic names, types, and type hashes in the ROS graph.
/**
* This function returns an array of all topic names and types in the ROS graph
* This function returns an array of all topic names, types, and type hashes in the ROS graph
* i.e. for which a publisher and/or a subscription exists, as discovered so far
* by the given local node.
*
Expand Down Expand Up @@ -57,15 +57,15 @@ extern "C"
* \par 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 topic names and types:
* - Access to the array of names and types is not synchronized.
* However, when querying topic names, types, and type hashes:
* - Access to the array of names, types, and type hashes is not synchronized.
* It is not safe to read or write `topic_names_and_types`
* while rmw_get_topic_names_and_types() uses it.
* - The default allocators are thread-safe objects, but any custom `allocator` may not be.
* Check your allocator documentation for further reference.
*
* \pre Given `node` must be a valid node handle, as returned by rmw_create_node().
* \pre Given `topic_names_and_types` must be a zero-initialized array of names and types,
* \pre Given `topic_names_and_types` must be a zero-initialized array of names, types, and type hashes,
* as returned by rmw_get_zero_initialized_names_and_types().
*
* \param[in] node Node to query the ROS graph.
Expand Down
22 changes: 15 additions & 7 deletions rmw/include/rmw/names_and_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@ extern "C"
#include "rmw/macros.h"
#include "rmw/types.h"
#include "rmw/visibility_control.h"
#include "rosidl_runtime_c/type_hash.h"

/// Associative array of topic or service names and types.
/// Associative array of topic or service names, types, and type hashes.
typedef struct RMW_PUBLIC_TYPE rmw_names_and_types_s
{
/// Array of names
rcutils_string_array_t names;

/// Dynamic array of arrays of type names, with the same length as `names`
rcutils_string_array_t * types;

/// Array of arrays of type hashes, with the same length as `names`.
/// `type_hashes[i][j]` corresponds to `types[i].data[j]`.
rosidl_type_hash_t ** type_hashes;
} rmw_names_and_types_t;

/// Return a zero initialized array of names and types.
/// Return a zero initialized array of names, types, and type hashes.
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_names_and_types_t
Expand All @@ -55,7 +60,7 @@ rmw_get_zero_initialized_names_and_types(void);
* Lock-Free | Yes
*
* \par Thread-safety
* Access to the array of names and types is read-only, but it is not synchronized.
* Access to the array of names, types, and type hashes is read-only, but it is not synchronized.
* Concurrent `names_and_types` reads are safe, but concurrent reads and writes are not.
*
* \param[in] names_and_types Array to be checked.
Expand All @@ -67,7 +72,7 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_names_and_types_check_zero(rmw_names_and_types_t * names_and_types);

/// Initialize an array of names and types.
/// Initialize an array of names, types, and type hashes.
/**
* This function initializes the string array for the names and allocates space
* for all the string arrays for the types according to the given size, but
Expand All @@ -84,11 +89,14 @@ rmw_names_and_types_check_zero(rmw_names_and_types_t * names_and_types);
*
* \par Thread-safety
* Initialization is a reentrant procedure, but:
* - Access to arrays of names and types is not synchronized.
* - Access to arrays of names, types, and type hashes is not synchronized.
* It is not safe to read or write `names_and_types` during initialization.
* - The default allocators are thread-safe objects, but any custom `allocator` may not be.
* Check your allocator documentation for further reference.
*
* \pre Given `names_and_types` must be a zero-initialized array,
* as returned by rmw_get_zero_initialized_names_and_types().
*
* \param[inout] names_and_types Array to be initialized on success,
* but left unchanged on failure.
* \param[in] size Size of the array.
Expand All @@ -111,7 +119,7 @@ rmw_names_and_types_init(
size_t size,
rcutils_allocator_t * allocator);

/// Finalize an array of names and types.
/// Finalize an array of names, types, and type hashes.
/**
* This function deallocates the string array of names and the array of string arrays of types,
* and zero initializes the given array.
Expand All @@ -128,7 +136,7 @@ rmw_names_and_types_init(
* Lock-Free | Yes
*
* \par Thread-safety
* Finalization is a reentrant procedure, but access to arrays of names and types
* Finalization is a reentrant procedure, but access to arrays of names, types, and type hashes
* is not synchronized.
* It is not safe to read or write `names_and_types` during initialization.
*
Expand Down
Loading