Difference between revisions of "OpenIGTLink/ProtocolV2/Type/AssociativeArray"

From NAMIC Wiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 84: Line 84:
  
 
==GET_AARRAY==
 
==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.
  
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
Line 90: Line 91:
 
| 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 2:int8 3:uint8 4:int16 5:uint16 6:int32 7:uint32 10:float32 11:float64)
 +
|-
 +
| align="left" | NAMELEN 0
 +
| align="left" | uint 8
 +
| align="left" | Name length
 +
|-
 +
| align="left" | SIZE 0
 +
| align="left" | uint 16
 +
| align="left" | Data 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
 +
|-
 +
| align="left" | SIZE (NELEMENTS-1)
 +
| align="left" | uint 16
 +
| align="left" | Data 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 (NELEMENTS-1)
 +
| align="left" | char[NAMELEN (NELEMENTS-1)]
 +
| align="left" | Name
 
|-
 
|-
 
|}
 
|}
 
  
 
==STT_AARRAY==
 
==STT_AARRAY==
 
+
Same as GET_AARRAY.
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
|-
 
| align="left style="background:#e0e0e0;" | Data
 
| align="left style="background:#e0e0e0;" | Type
 
| align="left style="background:#e0e0e0;" | Description
 
|-
 
|}
 
  
 
==STP_AARRAY==
 
==STP_AARRAY==

Latest revision as of 22:40, 17 November 2010

Home < OpenIGTLink < ProtocolV2 < Type < AssociativeArray

<< Version 2 Draft Page

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

Comments