Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Type Descriptors

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

LabVIEW associates each wire and terminal on the block diagram with a data type. LabVIEW keeps track of this type with a structure in memory called a type descriptor. This type descriptor is a sequence of 32-bit integers that can describe any data type in LabVIEW. Numeric values are written in hexadecimal format, unless otherwise noted.

Note  The format in which LabVIEW stores type descriptors changed in LabVIEW 8.0. LabVIEW 7.x and earlier stores type descriptors in 16-bit flat representation. LabVIEW 8.0 and later stores type descriptors in 32-bit flat representation. The information for LabVIEW 7.x and earlier applies if you use the Convert 7.x Data mode of the Flatten To String function. The following information applies for LabVIEW 8.0 or later. National Instruments recommends that you use the variant data type to avoid any conflicts these format changes might cause.

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). In LabVIEW, all type descriptors for such complex types are stored in a list.

The format of the type descriptor save buffer is

32 bits nTDs
TDs
var size nTypesUsed
var size TypesUsed

where:

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

Variable size fields are stored in a variable number of bits (either 16 or 32) depending on the value being represented. If the value is less than 32768, it is stored in two bytes. If the value is greater than or equal to 32768, it is stored in four bytes with the high bit set to one.

The generic format of a type descriptor in LabVIEW 8.0 and later is

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

Some type descriptors have additional information following the type code. Arrays and clusters are structured or aggregate data types because they include references to other types. For example, the cluster type contains additional information about the type of each of its elements.

The first word (16 bits or 32 bits) in any type descriptor is the size, in bytes, of that type descriptor, including the size word.

The second word (16 bits) is the type code. LabVIEW reserves the high-order byte of the type code (the xx in the following tables) for internal use. When comparing two type descriptors for equality, you should ignore this byte. Two type descriptors are equal even if the high-order bytes of the type codes are not.

Information on the possible values of [type specific info] appears below.

The type code encodes the actual type information, such as single-precision or extended-precision, floating-point number, as listed in the following table. These type code values might change in future versions of LabVIEW.

Data Types

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

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 xx04 xx

Unsigned 8-bit Integer

05

0004 xx05 xx

Unsigned 16-bit Integer

06

0004 xx06 xx

Unsigned 32-bit Integer

07

0004 xx07 xx

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>

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)

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

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 provide examples of data and type descriptors.

The minimum value in the size field of a type descriptor is 4, as shown in the previous 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.

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.

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) is the exponent of seconds. 0003 denotes the meters base index. 0001 is the exponent of meters.

LabVIEW 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

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.

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.

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. LabVIEW 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

Type descriptor 0:
0005 000A 00

Type descriptor 1:
000C 0040 0001 FFFF FFFF 0000

Number of types used:
0002

Types used:
0000 0001

The total number of unique type descriptors is 2.

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

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.

The total number of types used is 2, and 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

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

Type descriptor 0:
0005 0002 00

Type descriptor 1:
0005 0007 00

Type descriptor 2:
000A 0050 0002 0000 0001

Number of types used:
0003

Types used:
0000 0001 0002

The total number of unique type descriptors is 3.

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

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

The third type descriptor is for the cluster. 000A is the length of the entire type descriptor, including the cluster type indexes.

The total number of types used is 3, and 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

Type descriptor 0:
0005 000A 00

Type descriptor 1:
0005 0003 00

Type descriptor 2:
000A 0050 0002 0000 0001

Type descriptor 3:
000C 0040 0001 FFFF FFFF 0002

Type descriptor 4:
000C 0040 0001 FFFF FFFF 0003

Number of types used:
0005

Types used:
0000 0001 0002 0003 0004

The total number of unique type descriptors is 5.

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

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

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.

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.

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.

The total number of types used is 5, and 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

Type descriptor 0:
0005 000A 00

Type descriptor 1:
000C 0040 0001 FFFF FFFF 0000

Type descriptor 2:
0008 0050 0001 0002

Number of types used:
0004

Types used:
0000 0001 0000 0002

The total number of unique type descriptors is 3.

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

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.

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.

The total number of types used is 4, and 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.

Waveform

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:

  • Analog
  • Digital
  • Digital Data
  • Time Stamp
  • Dynamic

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, followed by type 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.

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>

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. LabVIEW 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. Refer to the NI Developer Zone at ni.com for more information about time stamps.

001C 0054 0006

<type descriptor of an analog waveform>


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit