OpenIGTLink/ProtocolV2/Type/AssociativeArray
Contents
Summary
Associative Array type is designed to transfer multiple pairs of key and values (associative array) to the receiver. The message format supports key as an array of ASCII code with length less than 255 bytes, and value as an N-dimensional array of 8-, 16-, 32- and 64-bit singed and unsigned integer and 32- and 64-bit float. Maximum 255 dimensions is supported and up to 65536 pairs can be listed in the format. The format consists of data table, which specifies type and size of keys and values, followed by an array of key strings and values.
Message Types
AARRAY
Data | Type | Description |
NELEMENTS | uint16 | Number of elements |
FORMAT 0 | ||
TYPE 0 | uint8 | Data type (0: string 2:int8 3:uint8 4:int16 5:uint16 6:int32 7:uint32 10:float32 11:float64) |
NAMELEN 0 | uint 8 | Name length |
SIZE 0 | uint 16 | Data length |
... | ||
FORMAT (NELEMENTS-1) | ||
TYPE (NELEMENTS-1) | uint8 | Data type (0: string, 1: scalar, 2: vector) |
NAMELEN (NELEMENTS-1) | uint 8 | Name length |
SIZE (NELEMENTS-1) | uint 16 | Data length |
NAME Table | ||
NAME 0 | char[NAMELEN] | Name |
... | ||
NAME (NELEMENTS-1) | char[NAMELEN (NELEMENTS-1)] | Name |
Padding* | uint8 or none | padding to align DATA with WORD |
DATA | ||
DATA 0 | TYPE 0 [ SIZE 0 ] | Data array |
DATA 1 | TYPE 1 [ SIZE 1 ] | Data array |
... | ||
DATA (NELEMENTS-1) | TYPE (NELEMENTS-1) [SIZE (NELEMENTS -1)] | Data array |
In C/C++, the size of padding is determined by:
((NAMELEN0 + NAMELEN1 + ... ) % 2 == 0) ? 0 : 1
GET_AARRAY
GET_ARRAY is used to request the receiver for associative array data. If a GET_ARRAY message does not have a body, it requests all data.
Data | Type | Description |
NELEMENTS | uint16 | Number of elements |
FORMAT 0 | ||
TYPE 0 | uint8 | Data type (0: string 2:int8 3:uint8 4:int16 5:uint16 6:int32 7:uint32 10:float32 11:float64) |
NAMELEN 0 | uint 8 | Name length |
SIZE 0 | uint 16 | Data length |
... | ||
FORMAT (NELEMENTS-1) | ||
TYPE (NELEMENTS-1) | uint8 | Data type (0: string, 1: scalar, 2: vector) |
NAMELEN (NELEMENTS-1) | uint 8 | Name length |
SIZE (NELEMENTS-1) | uint 16 | Data length |
NAME Table | ||
NAME 0 | char[NAMELEN] | Name |
... | ||
NAME (NELEMENTS-1) | char[NAMELEN (NELEMENTS-1)] | Name |
STT_AARRAY
Same as GET_AARRAY.
STP_AARRAY
Data | Type | Description |
RTS_AARRAY
Implementations
The AARRAY message type is implemented in the following source code.
Contributors
Junichi Tokuda, Yuichiro Hayashi