Difference between revisions of "OpenIGTLink/ProtocolV2/Type/AssociativeArray"
From NAMIC Wiki
Line 7: | Line 7: | ||
=Message Types= | =Message Types= | ||
==AARRAY== | ==AARRAY== | ||
+ | |||
{| border="1" cellpadding="5" cellspacing="0" align="center" | {| border="1" cellpadding="5" cellspacing="0" align="center" | ||
|- | |- | ||
− | | align="left style="background:#e0e0e0;" | Data | + | | align="left" style="background:#e0e0e0;" | Data |
− | | align="left style="background:#e0e0e0;" | Type | + | | align="left" style="background:#e0e0e0;" | Type |
− | | align="left style="background:#e0e0e0;" | Description | + | | align="left" style="background:#e0e0e0;" | Description |
+ | |- | ||
+ | | align="left" | NELEMENTS | ||
+ | | align="left" | uint16 | ||
+ | | align="left" | Number of elements | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#e0e0e0;" |FORMAT 0 | ||
+ | |- | ||
+ | | align="left" | TYPE 0 | ||
+ | | align="left" | uint8 | ||
+ | | align="left" | Data type (0: string, 1: scalar, 2: vector) | ||
+ | |- | ||
+ | | align="left" | NAMELEN 0 | ||
+ | | align="left" | uint 8 | ||
+ | | align="left" | Name length | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#f0f0f0;"|... | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#e0e0e0;" |FORMAT (NELEMENTS-1) | ||
+ | |- | ||
+ | | align="left" | TYPE (NELEMENTS-1) | ||
+ | | align="left" | uint8 | ||
+ | | align="left" | Data type (0: string, 1: scalar, 2: vector) | ||
+ | |- | ||
+ | | align="left" | NAMELEN (NELEMENTS-1) | ||
+ | | align="left" | uint 8 | ||
+ | | align="left" | Name length | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#e0e0e0;" |NAME Table | ||
+ | |- | ||
+ | | align="left" | NAME 0 | ||
+ | | align="left" | char[NAMELEN] | ||
+ | | align="left" | Name | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#f0f0f0;"|... | ||
+ | |- | ||
+ | | align="left" | NAME (NSENSORS-1) | ||
+ | | align="left" | char[NAMELEN (NSENSORS-1)] | ||
+ | | align="left" | Name | ||
+ | |- | ||
+ | | align="left" | Padding* | ||
+ | | align="left" | uint8 or none | ||
+ | | align="left" | padding to align DATA with WORD | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#e0e0e0;" |DATA | ||
+ | |- | ||
+ | | align="left" | DATA 0 | ||
+ | | align="left" | TYPE 0 | ||
+ | | align="left" | Data content | ||
+ | |- | ||
+ | | align="left" | DATA 1 | ||
+ | | align="left" | TYPE 1 | ||
+ | | align="left" | Data content | ||
+ | |- | ||
+ | | colspan=3 align="left" style="background:#f0f0f0;"|... | ||
+ | |- | ||
+ | | align="left" | DATA (NELEMENTS-1) | ||
+ | | align="left" | TYPE (NELEMENTS-1) | ||
+ | | align="left" | Data content | ||
|- | |- | ||
|} | |} | ||
+ | |||
+ | In C/C++, the size of padding is determined by: | ||
+ | ((NAMELEN0 + NAMELEN1 + ... ) % 2 == 0) ? 0 : 1 | ||
==GET_AARRAY== | ==GET_AARRAY== |
Revision as of 22:07, 17 November 2010
Home < OpenIGTLink < ProtocolV2 < Type < AssociativeArrayContents
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 256 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 256 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, 1: scalar, 2: vector) |
NAMELEN 0 | uint 8 | Name length |
... | ||
FORMAT (NELEMENTS-1) | ||
TYPE (NELEMENTS-1) | uint8 | Data type (0: string, 1: scalar, 2: vector) |
NAMELEN (NELEMENTS-1) | uint 8 | Name length |
NAME Table | ||
NAME 0 | char[NAMELEN] | Name |
... | ||
NAME (NSENSORS-1) | char[NAMELEN (NSENSORS-1)] | Name |
Padding* | uint8 or none | padding to align DATA with WORD |
DATA | ||
DATA 0 | TYPE 0 | Data content |
DATA 1 | TYPE 1 | Data content |
... | ||
DATA (NELEMENTS-1) | TYPE (NELEMENTS-1) | Data content |
In C/C++, the size of padding is determined by:
((NAMELEN0 + NAMELEN1 + ... ) % 2 == 0) ? 0 : 1
GET_AARRAY
Data | Type | Description |
STT_AARRAY
Data | Type | Description |
STP_AARRAY
Data | Type | Description |
RTS_AARRAY
Implementations
The AARRAY message type is implemented in the following source code.
Contributors
Junichi Tokuda, Yuichiro Hayashi