fixed<P,S> decimal on the wire

IDL's exact decimal type, carried across ZeroDDS bindings in the CORBA/GIOP §9.3.2.7 packed-BCD form.

What it shows

  • A fixed<P,S> value is (P+2)/2 octets of BCD: the P digit nibbles most-significant first, then a sign nibble (0xC positive, 0xD negative), with a leading 0x0 pad when P+1 is odd. The byte count is static, so there is no length prefix and the octets read the same in either byte order.
  • 123.45 as fixed<5,2> is 12 34 5c; 1234 as fixed<4,0> is 01 23 4c; -1.50 as fixed<6,2> is 00 00 15 0d.
  • The codec is byte-validated against JacORB 3.9 and omniORB 4.3 — these are not bytes ZeroDDS invented.
  • fixed is a CORBA type absent from DDS-XTypes 1.3: there is no TK_FIXED, so the member has no TypeIdentifier/TypeObject. CycloneDDS idlc reports a syntax error on it and fastddsgen raises a NullPointerException.

The wire

# Order{ id=7, qty=1234 } — @appendable, XCDR2-LE
07 00 00 00   DHEADER = 7 (body length)
07 00 00 00   id = 7
01 23 4c      qty = 1234   (BCD)

# Price{ sku=7, amount=123.45 } — @final, no DHEADER
07 00 00 00 12 34 5c

See also

fixed<P,S>-Dezimal auf der Leitung

Der exakte Dezimaltyp der IDL, über die ZeroDDS-Bindings hinweg in der Packed-BCD-Form nach CORBA/GIOP §9.3.2.7 getragen.

Was es zeigt

  • Ein fixed<P,S>-Wert sind (P+2)/2 Oktette BCD: die P Ziffern-Nibbles höchstwertig zuerst, dann ein Vorzeichen-Nibble (0xC positiv, 0xD negativ), mit führendem 0x0-Pad, wenn P+1 ungerade ist. Die Byte-Zahl ist statisch, also gibt es kein Längenpräfix, und die Oktette lesen sich in beiden Byte-Reihenfolgen gleich.
  • 123.45 als fixed<5,2> ist 12 34 5c; 1234 als fixed<4,0> ist 01 23 4c; -1.50 als fixed<6,2> ist 00 00 15 0d.
  • Der Codec ist byte-validiert gegen JacORB 3.9 und omniORB 4.3 — das sind keine von ZeroDDS erfundenen Bytes.
  • fixed ist ein CORBA-Typ und fehlt in DDS-XTypes 1.3: Es gibt kein TK_FIXED, also hat der Member keinen TypeIdentifier/TypeObject. CycloneDDS idlc meldet darauf einen Syntaxfehler, fastddsgen eine NullPointerException.

Die Leitung

# Order{ id=7, qty=1234 } — @appendable, XCDR2-LE
07 00 00 00   DHEADER = 7 (Body-Länge)
07 00 00 00   id = 7
01 23 4c      qty = 1234   (BCD)

# Price{ sku=7, amount=123.45 } — @final, kein DHEADER
07 00 00 00 12 34 5c

Verwandt