File type_support.hpp
FileList > astutedds > rmw > type_support.hpp
Go to the source code of this file
Introspection type-support resolution plus DDS topic-name and DDS type-name derivation. More...
#include <cstdint>#include <string>#include <rosidl_runtime_c/message_type_support_struct.h>#include <rosidl_runtime_c/service_type_support_struct.h>#include <rosidl_runtime_c/string.h>#include <rosidl_runtime_c/string_functions.h>#include <rosidl_typesupport_introspection_c/field_types.h>#include <rosidl_typesupport_introspection_c/identifier.h>#include <rosidl_typesupport_introspection_c/message_introspection.h>#include <rosidl_typesupport_introspection_c/service_introspection.h>#include <rosidl_typesupport_introspection_cpp/identifier.hpp>#include <rosidl_typesupport_introspection_cpp/message_introspection.hpp>#include <rosidl_typesupport_introspection_cpp/service_introspection.hpp>
Classes
| Type | Name |
|---|---|
| struct | TypeSupportHandle |
Public Types
| Type | Name |
|---|---|
| typedef rosidl_typesupport_introspection_c__MessageMember | MemberC C-backend MessageMember (a single field description). |
| typedef rosidl_typesupport_introspection_cpp::MessageMember | MemberCpp C++-backend MessageMember . |
| typedef rosidl_typesupport_introspection_c__MessageMembers | MembersC C-backend MessageMembers (walks C-generated message structs). |
| typedef rosidl_typesupport_introspection_cpp::MessageMembers | MembersCpp C++-backend MessageMembers (walks C++-generated message classes). |
| typedef rosidl_typesupport_introspection_c__ServiceMembers | ServiceMembersC C-backend ServiceMembers (request + response pair). |
| typedef rosidl_typesupport_introspection_cpp::ServiceMembers | ServiceMembersCpp C++-backend ServiceMembers (request + response pair). |
Public Functions
| Type | Name |
|---|---|
| std::string | dds_topic_name (const char * ros_topic) |
| std::string | dds_type_name (const TypeSupportHandle & ts) |
| std::string | demangle_ros_service_name (const std::string & dds_topic) |
| std::string | demangle_ros_topic (const std::string & dds_topic) |
| std::string | demangle_ros_type (const std::string & dds_type_name) |
| bool | get_service_type_support (const rosidl_service_type_support_t * type_support, TypeSupportHandle & request_out, TypeSupportHandle & response_out) |
| TypeSupportHandle | get_type_support (const rosidl_message_type_support_t * type_support) |
| bool | is_regular_ros_topic (const std::string & dds_topic) |
| bool | is_ros_service_reply_topic (const std::string & dds_topic) |
| bool | is_ros_service_request_topic (const std::string & dds_topic) |
Detailed Description
This RMW uses introspection type support (rosidl_typesupport_introspection_c and _cpp) rather than a DDS-vendor-specific type support. Any ROS 2 IDL type works without vendor-generated glue: the introspection tables describe the message layout at runtime and the CDR codec (see serialization.hpp) walks those tables. Either the C or C++ backend is accepted, depending on which one the caller pinned into the rosidl_message_type_support_t handed to us.
TypeSupportHandle is the small tagged handle carried inside every RMW publisher / subscription / service / client PIMPL so that serialization and name derivation need not re-resolve the type support on every call.
Public Types Documentation
typedef MemberC
C-backend MessageMember (a single field description).
using MemberC = rosidl_typesupport_introspection_c__MessageMember;
typedef MemberCpp
C++-backend MessageMember .
using MemberCpp = rosidl_typesupport_introspection_cpp::MessageMember;
typedef MembersC
C-backend MessageMembers (walks C-generated message structs).
using MembersC = rosidl_typesupport_introspection_c__MessageMembers;
typedef MembersCpp
C++-backend MessageMembers (walks C++-generated message classes).
using MembersCpp = rosidl_typesupport_introspection_cpp::MessageMembers;
typedef ServiceMembersC
C-backend ServiceMembers (request + response pair).
using ServiceMembersC = rosidl_typesupport_introspection_c__ServiceMembers;
typedef ServiceMembersCpp
C++-backend ServiceMembers (request + response pair).
using ServiceMembersCpp = rosidl_typesupport_introspection_cpp::ServiceMembers;
Public Functions Documentation
function dds_topic_name
std::string dds_topic_name (
const char * ros_topic
)
Convert a ROS 2 topic name into its on-the-wire DDS topic name.
ROS 2 uses a mandatory rt/ prefix for regular topics and rq//rr/ for service request/reply topics. Names already carrying one of those prefixes are returned unchanged; otherwise leading slashes are stripped and rt/ is prepended.
Parameters:
ros_topicROS 2 topic name (e.g."/chatter").
Returns:
DDS topic name (e.g. "rt/chatter").
function dds_type_name
std::string dds_type_name (
const TypeSupportHandle & ts
)
Build the DDS type name for a given message type support.
The DDS type-name format is <namespace>::dds_::<Type>_; the rosidl introspection namespace uses __ as separator, converted to :: here.
Parameters:
tsA valid TypeSupportHandle.
Returns:
DDS type name (e.g. "std_msgs::msg::dds_::String_"), or a placeholder when ts.valid() is false.
function demangle_ros_service_name
std::string demangle_ros_service_name (
const std::string & dds_topic
)
Recover the ROS 2 service name from a service request or reply DDS topic name (e.g. "rq/add_two_intsRequest" → "/add_two_ints"). Names that do not match either convention are returned unchanged.
function demangle_ros_topic
std::string demangle_ros_topic (
const std::string & dds_topic
)
Recover the ROS 2 topic name from a DDS topic name that carries the rt/ prefix (e.g. "rt/chatter" → "/chatter"). Names without the prefix are returned unchanged.
function demangle_ros_type
std::string demangle_ros_type (
const std::string & dds_type_name
)
Recover the ROS 2 type name from a DDS type name (e.g. "std_msgs::msg::dds_::String_" → "std_msgs/msg/String"). The mechanical inverse of dds_type_name.
function get_service_type_support
bool get_service_type_support (
const rosidl_service_type_support_t * type_support,
TypeSupportHandle & request_out,
TypeSupportHandle & response_out
)
Resolve a service-type-support pointer into a request/response pair of message handles.
Parameters:
type_supportNon-null service type support supplied by the caller.request_outOn success, the request-type handle.response_outOn success, the response-type handle.
Returns:
true on success; false if neither backend recognised the service or a members pointer was null.
function get_type_support
TypeSupportHandle get_type_support (
const rosidl_message_type_support_t * type_support
)
Resolve a message-type-support pointer into a TypeSupportHandle.
Tries the C++ introspection backend first, then the C backend. On success the returned handle has valid() == true and points at the members table owned by the caller's type-support object (do not free).
Parameters:
type_supportNon-null message type support supplied by the caller.
Returns:
A handle; valid() is false when neither backend recognised the type.
function is_regular_ros_topic
bool is_regular_ros_topic (
const std::string & dds_topic
)
Returns:
true iff dds_topic carries the rt/ prefix used for regular (non-service) ROS 2 topics.
function is_ros_service_reply_topic
bool is_ros_service_reply_topic (
const std::string & dds_topic
)
Returns:
true iff dds_topic is a service reply topic (rr/…Reply).
function is_ros_service_request_topic
bool is_ros_service_request_topic (
const std::string & dds_topic
)
Returns:
true iff dds_topic is a service request topic (rq/…Request).
The documentation for this class was generated from the following file include/astutedds/rmw/type_support.hpp