Wire Format Datatypes
Wire Format Type |
Type Description |
Notes |
Special Types
|
||
Rendezvous message |
||
Rendezvous datetime |
||
opaque byte sequence |
||
ISO 8859-1 character string (also called Latin-1) |
|
|
XML data (byte sequence) |
||
Scalar Types
|
||
|
boolean |
|
|
8-bit integer |
|
|
16-bit integer |
|
|
32-bit integer |
|
|
64-bit integer |
|
|
8-bit unsigned integer |
|
|
16-bit unsigned integer |
|
32-bit unsigned integer |
||
64-bit unsigned integer |
||
|
32-bit floating point |
|
|
64-bit floating point |
|
4-byte IP address |
Network byte order. String representation is four-part dot-delimited notation. |
|
2-byte IP port |
Network byte order. String representation is a 16-bit decimal integer. |
|
Array Types
|
||
|
8-bit integer array |
The |
|
16-bit integer array |
|
|
32-bit integer array |
|
|
64-bit integer array |
|
|
8-bit unsigned integer array |
|
|
16-bit unsigned integer array |
|
|
32-bit unsigned integer array |
|
|
64-bit unsigned integer array |
|
|
32-bit floating point array |
|
|
64-bit floating point array |
C Datatypes
C Type |
Type Description |
Notes |
boolean |
|
|
|
32-bit floating point |
|
64-bit floating point |
||
|
8-bit integer |
|
|
16-bit integer |
|
|
32-bit integer |
|
|
64-bit integer |
|
|
8-bit unsigned integer |
|
|
16-bit unsigned integer |
|
32-bit unsigned integer |
||
|
64-bit unsigned integer |
|
|
4-byte IP address |
Stored in network byte order. String representation is four-part dot-delimited notation. |
|
2-byte IP port |
Stored in network byte order. String representation is a decimal integer (all 16-bits). |
|
Rendezvous datetime struct |
See TibrvMsgDateTime. See also |
|
32-bit floating point array |
|
|
64-bit floating point array |
|
|
8-bit integer array |
|
|
16-bit integer array |
|
|
32-bit integer array |
|
|
64-bit integer array |
|
|
8-bit unsigned integer array |
|
|
16-bit unsigned integer array |
|
|
32-bit unsigned integer array |
|
|
64-bit unsigned integer array |
|
|
Rendezvous message |
See TibrvMsg. See also |
|
character string |
ISO 8859-1 (Latin-1) character encoding |
|
opaque byte sequence |
Datatype Conversion
Rendezvous software converts datatypes in two situations:
• | As it translates a message to wire format (when sending a message). |
• | As it extracts data from a message field. |
Convenience methods that extract a field from a Rendezvous message automatically decode the field’s data to a homologous C type. Figure 14 specifies the homologous decodings as well as conversions to other types. See also, TibrvMsg::getField()TibrvMsg::getField().
Convenience methods that add a field to a Rendezvous message or update an existing field severely restrict type encoding. These methods encode only to homologous types (the solid dots along the diagonal of Wire Format to C Datatype Conversion Matrix indicate pairs of homologous types).
General Rules
These general rules govern most conversions.
Supported
• | All wire format types decode to the homologous C datatypes (in get calls), and all C datatypes encode to the homologous wire format types (in add and update calls). |
• | All wire format numeric scalar types convert to all C numeric scalar types. |
• | All wire format numeric array types convert to all C numeric array types. |
Caution
• | Converting a wire format opaque or XML byte sequence to a C character string creates a printable string, but the string does not capture any of the opaque data bytes (it captures only the number of bytes). |
• | Converting a wire format signed integer to a C unsigned integer discards the sign. |
• | Converting a wire format numeric type to a C numeric type with fewer bits risks loss of precision. |
• | Converting wire format floating point numbers to C integer types discards the fractional part. |
• | Converting large (out-of-range) wire format floating point numbers to C integers results in the maximum integer of the C target size. |
Not Supported
• | Array types do not convert to scalar types. |
• | Scalar types do not convert to array types. |
• | C types do not convert to non-homologous wire format types (when adding or updating a field). |
Converting to Boolean
• | When converting a string to a boolean, all strings in which the first character is either t or T map to boolean true . All other strings map to boolean false . |
• | When converting a numeric value to a boolean, zero maps to boolean false . All non-zero numeric values map to boolean true . |
Figure 230: Wire Format to C Datatype Conversion Matrix