Cross-vendor dynamic XTypes
Decoding a foreign vendor's topic with no compile-time type: a runtime
DynamicTypebuilt from out-of-band IDL, walked by the reflective XCDR codec.
- Example:
cross-vendor-dynamic-xtypes - Repository: zero-dds-snippets
What it shows
zerodds-spylearns each writer'stype_namefrom discovery, builds aDynamicTypefrom--type-fileand prints decoded samples as JSON.- Four publishers decoded live: eProsima Fast DDS 3.x (XCDR1 and XCDR2), CycloneDDS (XCDR2), RTI Connext 7.7 (XCDR1), OpenDDS 3.34 (XCDR2).
- Two IDL variants ship because the vendor compilers disagree:
dyn.idlwith a@mutableunion (onlyfastddsgenaccepts it) anddyn_app.idlwith an@appendableunion for Cyclone, OpenDDS and RTI. - The example's README catalogues four reflective-codec bugs it surfaced — a skipped
unionin the IDL→DynamicType loader, branch matching by member id instead of position, a missingPL_CDR2DHEADER, and an XCDR2-only codec that mis-read XCDR1 wire.
Run it
# vendor side (example: CycloneDDS)
cc -I<cyclone>/include cyclone/pub.c dyn.c -L<cyclone>/lib -lddsc -o cyc_pub && ./cyc_pub 0
# ZeroDDS side — reflective decode, no compiled type
zerodds-spy -t TrackTopic --type-file dyn_app.idl --decode
Output
$ zerodds-spy -t TrackTopic --type-file dyn.idl --decode
zerodds-spy: attached topic=TrackTopic type=dyn::Track
[1] writer=… type=dyn::Track {"color":2,"command":{"speed":7006},"id":106,"name":"track-6","path":[6,12,18]}
Taken verbatim from the example's own README.
See also
Cross-Vendor — dynamische XTypes
Das Topic eines fremden Vendors ohne Compile-Zeit-Typ decodieren: ein zur Laufzeit aus Out-of-Band-IDL gebauter
DynamicType, den der reflektive XCDR-Codec abläuft.
- Beispiel:
cross-vendor-dynamic-xtypes - Repository: zero-dds-snippets
Was es zeigt
zerodds-spylernt dentype_namejedes Writers aus dem Discovery, baut aus--type-fileeinenDynamicTypeund gibt decodierte Samples als JSON aus.- Vier Publisher live decodiert: eProsima Fast DDS 3.x (XCDR1 und XCDR2), CycloneDDS (XCDR2), RTI Connext 7.7 (XCDR1), OpenDDS 3.34 (XCDR2).
- Zwei IDL-Varianten, weil die Vendor-Compiler sich uneinig sind:
dyn.idlmit@mutable-Union (nurfastddsgennimmt sie) unddyn_app.idlmit@appendable-Union für Cyclone, OpenDDS und RTI. - Das README des Beispiels führt vier Fehler im reflektiven Codec auf, die dabei sichtbar wurden — eine im IDL→DynamicType-Loader übersprungene
union, Branch-Auswahl über Member-Id statt Position, ein fehlenderPL_CDR2-DHEADER und ein reiner XCDR2-Codec, der XCDR1-Wire falsch las.
Ausführen
# Vendor-Seite (Beispiel: CycloneDDS)
cc -I<cyclone>/include cyclone/pub.c dyn.c -L<cyclone>/lib -lddsc -o cyc_pub && ./cyc_pub 0
# ZeroDDS-Seite — reflektiver Decode, kein kompilierter Typ
zerodds-spy -t TrackTopic --type-file dyn_app.idl --decode
Ausgabe
$ zerodds-spy -t TrackTopic --type-file dyn.idl --decode
zerodds-spy: attached topic=TrackTopic type=dyn::Track
[1] writer=… type=dyn::Track {"color":2,"command":{"speed":7006},"id":106,"name":"track-6","path":[6,12,18]}
Wörtlich aus dem README des Beispiels übernommen.