File identifier.hpp

FileList > astutedds > rmw > identifier.hpp

Go to the source code of this file

RMW implementation identifier, wire constants, and the identifier-check macro shared by every RMW entry point. More...

  • #include <cstdint>
  • #include <rmw/check_type_identifiers_match.h>
  • #include <rmw/error_handling.h>

Public Attributes

Type Name
constexpr uint8_t kCdrEncapHeader = { 0x00, 0x01, 0x00, 0x00 }
constexpr uint32_t kDomainId = 0
constexpr char kIdentifier = "rmw\_astutedds\_cpp"
String identifier for this RMW plugin. Compared by pointer, not by value.
constexpr char kSerializationFmt = "cdr"

Macros

Type Name
define ASTUTEDDS_CHECK_IDENTIFIER (handle, on_mismatch) /* multi line expression */

Detailed Description

The identifier is compared by pointer by every RMW argument-validation macro, so every translation unit MUST observe the exact same address. That is why kIdentifier is declared inline constexpr: the compiler is required to emit a single ODR-unique definition with external linkage shared across all translation units. A static constexpr would give each TU its own copy at a distinct address, and every identifier check would then spuriously fail.

Every RMW handle this plugin produces is stamped with kIdentifier at construction time; every entry point that receives a handle validates the pointer against kIdentifier. This is how the ROS 2 loader detects and rejects handles created by a different RMW implementation.

Public Attributes Documentation

variable kCdrEncapHeader

constexpr uint8_t kCdrEncapHeader[4];

CDR little-endian encapsulation header prepended to every serialized payload: 0x00 0x01 0x00 0x00 = XCDR1, little-endian, no options. See OMG DDS-XTypes ยง7.6.3 for the encapsulation-kind byte values.


variable kDomainId

constexpr uint32_t kDomainId;

Default ROS 2 domain ID used when the caller passes RMW_DEFAULT_DOMAIN_ID at rmw_init time.


variable kIdentifier

String identifier for this RMW plugin. Compared by pointer, not by value.

constexpr char kIdentifier[];


variable kSerializationFmt

constexpr char kSerializationFmt[];

Serialization format returned by rmw_get_serialization_format(). AstuteDDS uses CDR (XCDR1 little-endian) on the wire, so callers receive "cdr".


Macro Definition Documentation

define ASTUTEDDS_CHECK_IDENTIFIER

#define ASTUTEDDS_CHECK_IDENTIFIER (
    handle,
    on_mismatch
) `/* multi line expression */`

Verify the implementation_identifier on an RMW handle matches ours.

Wraps the upstream RMW_CHECK_TYPE_IDENTIFIERS_MATCH so every call site emits a consistent message and compares against kIdentifier. Intended for use inside rmw_* entry points that return rmw_ret_t.

Parameters:

  • handle Pointer to an RMW-provided handle (e.g. rmw_node_t *).
  • on_mismatch Statement executed when the identifier does NOT match (typically return RMW_RET_INCORRECT_RMW_IMPLEMENTATION;).


The documentation for this class was generated from the following file include/astutedds/rmw/identifier.hpp