Type Codes

Every IDL variable has a data type. The possible type codes and their mapping to C language types are listed in the following table. The undefined type code (IDL_TYP_UNDEF) will always have the value zero.

Although it is rare, the number of types could change someday. Therefore, you should always use the symbolic names when referring to any type except IDL_TYP_UNDEF. Even in the case of IDL_TYP_UNDEF, using the symbolic name will add clarity to your code. Note that all IDL structures are considered to be of a single type (IDL_TYP_STRUCT).

Clearly, distinctions must be made between various structures, but such distinctions are made at a different level. There are a few constants that can be used to make your code easier to read and less likely to break if/when the idl_export.h file changes. These are:

Type Masks

There are some situations in which it is necessary to specify types in the form of a bit mask rather than the usual type codes, for example when a single argument to a function can represent more than a single type. For any given type, the bit mask value can be computed as: Mask = 2TypeCode

The IDL_TYP_MASK preprocessor macro is provided to calculate these masks. Given a type code, it returns the bit mask. For example, to specify a bit mask for all the integer types:

IDL_TYP_MASK(IDL_TYP_BYTE)|IDL_TYP_MASK(IDL_TYP_INT)| 
                           IDL_TYP_MASK(IDL_TYP_LONG) 

Specifying all the possible types would require a long statement similar to the one above. To avoid having to type so much for this common case, the IDL_TYP_B_ALL constant is provided.