Version:

Last Modified: January 12, 2018

Converts variant data into a flattened array of unsigned bytes.

Each byte in the array has the value of the corresponding character in the string. This node flattens only the variant and discards all of its contents, including attributes.

The variant data you want to convert.

An array of numeric integers that identifies the data type of **data string**.

Data Type Descriptions

Each wire and terminal on the diagram represents a data type. A *
type descriptor* is an internal structure that keeps track of each type with a sequence of 32-bit integers.

A type can be aggregate, meaning it can consist of different types. For example, in an array of Booleans, the array is a type and its elements are another type (Boolean). All type descriptors for such complex types are stored in a list.

The format of the type descriptor save buffer is as follows:

32 bits nTDs TDs var size nTypesUsed var size TypesUsed

**nTDs**—number of elemental type descriptors contained in the buffer**TDs**—list of nTDs type descriptors**nTypesUsed**—actual number of type descriptors types used by the entity referencing the buffer**TypesUsed**—list of indexes for all the types of TDs used

Variable size fields are stored in either 16 or 32 bits, depending on the value being represented. If the value is less than 32768, it is stored in 2 bytes. If the value is greater than or equal to 32768, it is stored in 4 bytes with the high bit set to 1.

Type Descriptor Format

A type descriptor uses the following format:

[size][type code][type code specific info]

Type Descriptor Reference

The following tables list numeric and non-numeric data types, type codes, and type descriptors.

*n*=length; *x*=reserved; *k*=number; *k pstrs*=number of Pascal strings; *k base-exp*=number of base-exponent pairs.

Data Type | Type Code (numbers in hexadecimal) | Type Descriptor (numbers in hexadecimal) |
---|---|---|

8-bit Integer | 01 | 0004 xx01 xx |

16-bit Integer | 02 | 0004 xx02 xx |

32-bit Integer | 03 | 0004 xx03 xx |

64-bit Integer | 04 | 0004 xx04xx |

Unsigned 8-bit Integer | 05 | 0004 xx05 xx |

Unsigned 16-bit Integer | 06 | 0004 xx06xx |

Unsigned 32-bit Integer | 07 | 0004 xx07xx |

Unsigned 64-bit Integer | 08 | 0004 xx08 xx |

Single-Precision Floating-Point Number | 09 | 0004 xx09 xx |

Double-Precision Floating-Point Number | 0A | 0004 xx0A xx |

Extended-Precision Floating-Point Number | 0B | 0004 xx0B xx |

Single-Precision Complex Floating-Point Number | 0C | 0004 xx0C xx |

Double-Precision Complex Floating-Point Number | 0D | 0004 xx0D xx |

Extended-Precision Complex Floating-Point Number | 0E | 0004 xx0E xx |

Enumerated 8-bit Integer | 15 | <nn> xx15 <k> <k pstrs> |

Enumerated 16-bit Integer | 16 | <nn> xx16 <k> <k pstrs> |

Enumerated 32-bit Integer | 17 | <nn> xx17 <k> <k pstrs> |

Single-Precision Physical Quantity | 19 | <nn> xx19 <k> <k base-exp> |

Double-Precision Physical Quantity | 1A | <nn> xx1A <k> <k base-exp> |

Extended-Precision Physical Quantity | 1B | <nn> xx1B <k> <k base-exp> |

Single-Precision Complex Physical Quantity | 1C | <nn> xx1C <k> <k base-exp> |

Double-Precision Complex Physical Quantity | 1D | <nn> xx1D <k> <k base-exp> |

Extended-Precision Complex Physical Quantity | 1E | <nn> xx1E <k> <k base-exp> |

The minimum value in the size field of a type descriptor is 4, as shown in the table. However, any type descriptor can have a name (a Pascal string) appended, in which case the size field is larger by the length of the name rounded up to a multiple of two.

*n*=length; *x*=reserved; *k*=number; *k pstrs*=number of Pascal strings; *k base-exp*=number of base-exponent pairs. A *dim* is a 32-bit integer. The following sections have examples of data and type descriptors.

Data Type | Type Code (numbers in hexadecimal) | Type Descriptor (numbers in hexadecimal) |
---|---|---|

Boolean | 21 | 0004 xx21 |

String | 30 | 0008 xx30 <dim> |

Path | 32 | 0008 xx32 <dim> |

Picture | 33 | 0008 xx33 <dim> |

Array | 40 | <nn> xx40 <k> <k dims> <k elems> <element type descriptor> |

Cluster | 50 | <nn> xx50 <k> <k members> <k element type descriptors> |

Waveform | 54 | <nn> xx54 <waveform type> <element type descriptors> |

Refnum | 70 | <nn> <refnum type code><specific type code information> |

Variant | 53 | <nn> xx53 |

Type Descriptor Examples: Enumerated 8-Bit Integer

In the following example of an enumerated 8-bit integer for the items am, fm, and fm stereo, each group of characters represents a 16-bit word. The space enclosed in quotation marks (" ") represents an ASCII space.

0016 0015 0003 02a m02 fm 09f m" " st er eo

**0016**—indicates 22 bytes total**0015**—indicates an enumerated 8-bit integer**0003**— indicates there are three items

Type Descriptor Examples: Physical Quantity

In the following example of a double-precision physical quantity with units m/s, each group represents a 16-bit word.

000E 001A 0002 0002 FFFF 0003 0001

**000E**—indicates 14 bytes total**001A**—indicates this is a double-precision physical quantity**0002**—indicates two base-exponent pairs**0002**—denotes the seconds base index**FFFF (-1)**—the exponent of seconds**0003**—denotes the meters base index**0001**—the exponent of meters

The node stores all physical quantities internally in terms of base units, regardless of the units used to display them.

The following table shows the nine bases that are represented by indexes 0 through 8 for radians through candela.

Quantity Name | Unit | Abbreviation | Base Value |
---|---|---|---|

plane angle | radian | rad | 0 |

solid angle | steradian | sr | 1 |

time | second | s | 2 |

length | meter | m | 3 |

mass | kilogram | kg | 4 |

electric current | ampere | A | 5 |

thermodynamic temperature | kelvin | K | 6 |

amount of substance | mole | mol | 7 |

luminous intensity | candela | cd | 8 |

Type Descriptor Examples: String, Path, and Picture Data Types

The string, path, and picture data types have a 32-bit length, similar to the array dimension size. However, the only value currently encoded is FFFFFFFF (-1), which indicates variable sized. Currently, all strings, paths, and pictures are variable sized. The actual length is stored with the data.

Type Descriptor Examples: Array and Cluster Data Types

The array and cluster data types each have their own type code. They also contain additional information about the data types of their elements and the dimensionality for arrays or number of elements for clusters.

Type Descriptor Examples: Array

The type code for an array is 40. A word that contains the number of dimensions of the array immediately follows the type code. Then, for each dimension, an integer contains the size in elements of that dimension. Finally, after all of the dimension sizes, the type descriptor for the element appears. The element type can be any type except an array. Currently all sizes are FFFFFFFF (-1), which means the array dimension size is variable. The node stores the actual dimension size, which is always greater than or equal to zero, with the data.

The following example is a type descriptor for a 1D array of double-precision floating-point numbers:

Number of type descriptors: | 0000 0002 | The total number of unique type descriptors is 2. |

Type descriptor 0: | 0005 000A 00 | The first type descriptor (0005 000A 00) represents the element type and appears exactly as it does for a scalar of the same type. |

Type descriptor 1: | 000C 0040 0001 FFFF FFFF 0000 | The second type descriptor represents the array. 000C is the length of the entire type descriptor, including the element type index. The array is variable sized, so the dimension size is FFFFFFFF. |

Number of types used: | 0002 | The total number of types used is 2. |

Types used: | 0000 0001 | The types used are 0 and 1. |

The following example is a type descriptor for a 2D array of Boolean values:

Number of type descriptors: | 0000 0002 |

Type descriptor 0: | 0004 0021 |

Type descriptor 1: | 0010 0040 0002 FFFF FFFF FFFF FFFF 0000 |

Number of types used: | 0002 |

Types used: | 0000 0001 |

Type Descriptor Examples: Cluster

The type code for a cluster is 50. A word that contains the number of items in the cluster immediately follows the type code. The type descriptor for each element in cluster order follows this word. For example, consider a cluster of two integers, a 16-bit signed integer and a 32-bit unsigned integer:

Number of type descriptors: | 0000 0003 | The total number of unique type descriptors is 3. |

Type descriptor 0: | 0005 0002 00 | The first type descriptor is for a 16-bit integer type and appears exactly as it does for a scalar of the same type. |

Type descriptor 1: | 0005 0007 00 | The second type descriptor is for a 32-bit unsigned integer type and appears exactly as it does for a scalar of the same type. |

Type descriptor 2: | 000A 0050 0002 0000 0001 | The third type descriptor is for the cluster. 000A is the length of the entire type descriptor, including the cluster type indexes. |

Number of types used: | 0003 | The total number of types used is 3. |

Types used: | 0000 0001 0002 | The types used are 0, 1, and 2 |

Because array and cluster type descriptors contain other type descriptors, they might become deeply nested. For example, the following is a type descriptor for a multi-plot graph. The numeric types can vary.

Number of type descriptors: | 0000 0005 | The total number of unique type descriptors is 5. |

Type descriptor 0: | 0005 000A 00 | The first type descriptor is for a double precision floating point type and appears exactly as it does for a scalar of the same type. |

Type descriptor 1: | 0005 0003 00 | The second type descriptor is for a 32-bit integer type and appears exactly as it does for a scalar of the same type. |

Type descriptor 2: | 000A 0050 0002 0000 0001 | The third type descriptor is for a two-component cluster. 000A is the length of the entire type descriptor, including the cluster typed indexes. The cluster contains 2 elements, one of the double type index 0 and another of type index 1. |

Type descriptor 3: | 000C 0040 0001 FFFF FFFF 0002 | The fourth type descriptor is for an array. 000C is the length of the entire type descriptor, including the element type index. The array is variable sized, so the dimension size is FFFFFFFF. The type of array element is the cluster at index 2. |

Type descriptor 4: | 000C 0040 0001 FFFF FFFF 0003 | The fifth type descriptor is for an array. 000C is the length of the entire type descriptor, including the element type index. The array is variable sized, so the dimension size is FFFFFFFF. The type of array element is the cluster at index 3. |

Number of types used: | 0005 | The total number of types used is 5. |

Types used: | 0000 0001 0002 0003 0004 | The types used are 0, 1, 2, 3, and 4. |

Note that duplicate types are not included in the type list. The following example is a type descriptor list of a 1D array of double-precision floating-point numbers and a cluster with one double-precision floating-point number.

Number of type descriptors: | 0000 0003 | The total number of unique type descriptors is 3. |

Type descriptor 0: | 0005 000A 00 | The first type descriptor is for the element type and appears exactly as it does for a scalar of the same type. |

Type descriptor 1: | 000C 0040 0001 FFFF FFFF 0000 | The second type descriptor is for the array. 000C is the length of the entire type descriptor, including the element type index. The array is variable sized, so the dimension size is FFFFFFFF. |

Type descriptor 2: | 0008 0050 0001 0002 | The third type descriptor is for the cluster. 0008 is the length of the entire type descriptor, including the cluster type index. The cluster contains 1 element by the type at index 2. |

Number of types used: | 0004 | The total number of types used is 4. |

Types used: | 0000 0001 0000 0002 | The types used are 0, 1, 0, and 2. |

Note that the type referenced in the cluster at index 2 must be looked up in the types used array to make sense. The second element in types used is 0, which corresponds to type descriptor 0.

Type Descriptor Examples: Analog Waveforms

The type code for a waveform is 54. A word that contains the type of waveform immediately follows the type code. The type descriptor of the cluster of the waveforms elements follows this word. There are five categories of waveforms:

The following table lists the types of analog waveforms.

Type | Subtype Code |
---|---|

8-bit signed | 14 |

16-bit signed | 2 |

32-bit signed | 15 |

64-bit signed | 19 |

Double-Precision | 3 |

Single-Precision | 5 |

Extended-Precision | 10 |

8-bit unsigned | 11 |

16-bit unsigned | 12 |

32-bit unsigned | 13 |

64-bit unsigned | 20 |

Complex Single-Precision | 16 |

Complex Double-Precision | 17 |

Complex Extended-Precision | 18 |

For example, consider a double-precision waveform:

0006 0054 0003 //size of waveform, type code, and subtype code 0080 0050 0005 //size of cluster, cluster code, and number of elements <type descriptor of time stamp> <type descriptor of dt> <type descriptor of array of element type> <type descriptor of unused error cluster> <type descriptor of attributes>

The type descriptor of the other types of analog waveforms is similar to the double-precision waveform. The difference is a different type for the array element and a different subtype.

Type Descriptor Examples: Digital Waveform and Digital Data

The digital waveform is the only type of waveform that has a subtype code 8.

For example:

00B6 0054 0008 //size of digital waveform, type code, and subtype code <type descriptor of time stamp> <type descriptor of dt> <type descriptor of digital data> <type descriptor of unused error cluster> <type descriptor of attributes>

Digital data is the only data type with a waveform type code and a subtype code of 7.

For example:

003E 0054 0007 //size of digital data, type code, and subtype code <type descriptor of transitions> <type descriptor of data>

Type Descriptor Examples: Time Stamp

The time stamp has a subtype code of 6. The time stamp is a 128-bit fixed-point number with a 64-bit radix. The node stores a time stamp as a cluster of four integers where the first two signed integers (64 bits) represent the number of whole seconds after 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. The next two unsigned integers (64 bits) represent the fractions of seconds.

For example:

001C 0054 0006 <type descriptor of an analog waveform>

The converted array of flattened data.