File validation.hpp
FileList > astutedds > rmw > validation.hpp
Go to the source code of this file
Shared argument-validation helpers used across multiple RMW entry points. More...
#include <rmw/names_and_types.h>#include <rmw/qos_profiles.h>#include <rmw/rmw.h>#include <rosidl_runtime_c/service_type_support_struct.h>
Public Functions
| Type | Name |
|---|---|
| rmw_ret_t | validate_by_node_args (const rmw_node_t * node, rcutils_allocator_t * allocator, const char * node_name, const char * node_namespace, rmw_names_and_types_t * out) |
| rmw_ret_t | validate_count_args (const rmw_node_t * node, const char * name, size_t * count) |
| rmw_ret_t | validate_srv_create_args (const rmw_node_t * node, const rosidl_service_type_support_t * type_support, const char * service_name, const rmw_qos_profile_t * qos_profile) |
Detailed Description
Every RMW entry point must validate its arguments before touching any DDS state: a null pointer, empty name, or a handle from a different RMW must yield a well-defined error code (RMW_RET_INVALID_ARGUMENT or RMW_RET_INCORRECT_RMW_IMPLEMENTATION) and set a helpful message via RMW_SET_ERROR_MSG.
These helpers consolidate the checks shared by families of RMW calls (the rmw_count_* functions, the rmw_create_service/rmw_create_client pair, and the _by_node graph queries) so each entry point stays focused on its own responsibility.
Public Functions Documentation
function validate_by_node_args
rmw_ret_t validate_by_node_args (
const rmw_node_t * node,
rcutils_allocator_t * allocator,
const char * node_name,
const char * node_namespace,
rmw_names_and_types_t * out
)
Validate the arguments common to the four rmw_get_*_names_and_types_by_node queries and confirm the requested node exists in the context registry.
Checks: all pointers non-null; allocator valid; identifier matches ours; node_name valid per rmw_validate_node_name; node_namespace valid per rmw_validate_namespace; out zero-initialised; and the (name, namespace) pair present in AstuteDDSContext::nodes.
Returns:
RMW_RET_OK on success; RMW_RET_INVALID_ARGUMENT on argument problems; RMW_RET_NODE_NAME_NON_EXISTENT when the node is absent.
function validate_count_args
rmw_ret_t validate_count_args (
const rmw_node_t * node,
const char * name,
size_t * count
)
Validate the arguments common to rmw_count_publishers, rmw_count_subscribers, rmw_count_clients, and rmw_count_services.
Checks: node, name, count non-null; identifier matches ours; name non-empty and fully qualified (starts with /).
Returns:
RMW_RET_OK when valid; otherwise a specific error code with RMW_SET_ERROR_MSG already called.
function validate_srv_create_args
rmw_ret_t validate_srv_create_args (
const rmw_node_t * node,
const rosidl_service_type_support_t * type_support,
const char * service_name,
const rmw_qos_profile_t * qos_profile
)
Validate the arguments common to rmw_create_service and rmw_create_client.
Checks: node, type_support, service_name, qos_profile non-null; identifier matches ours; service_name non-empty and (unless the caller opts out) valid per rmw_validate_full_topic_name; qos_profile is not the rmw_qos_profile_unknown sentinel; and the type-support identifier names a rosidl backend we accept.
Returns:
RMW_RET_OK when valid; otherwise a specific error code with RMW_SET_ERROR_MSG already called.
The documentation for this class was generated from the following file include/astutedds/rmw/validation.hpp