next up previous
Next: Data Value Formats Up: Data Type Descriptor Formats Previous: Arrays


Structures

Structures are the most complex form of data stored in an IDL save file, because they can represent any combination of scalars, arrays, and structures. Thus, the format of the structure descriptor must be general enough to store any kind of data.


Format: TYPEDESC_STRUCT        (type descriptor for arrays)
Type Name Description
LONG TYPECODE IDL variable type code
LONG VARFLAGS Bit flags for a type descriptor, OR'd as follows:
'02'x System variable
'04'x Array
'10'x Unknown?
'20'x Structure
ARRAY_DESC -- Array descriptor segment
STRUCT_DESC -- Structure descriptor segment


The array descriptor is described in the previous section. All structures are also arrays, and hence every structure type description will have both an ARRAY_DESC and STRUCT_DESC segment. Even ``scalar'' structures are considered to be an array of length and dimension equal to 1.

IDL objects are special cases of structures. The values themselves are stored as structures. The definition of the class uses the STRUCT_DESC segments as well, with special fields which give the name of the class and define the class's superclasses. If the INHERITS or IS_SUPER bit fields are set, then STRUCT_DESC segment can be considered to define a class rather than a structure.

The structure (and class) descriptor is defined in the following table.


Format: STRUCT_DESC        (variable structure descriptor)
Type Name Description
LONG STRUCTSTART Indicates start of struct descriptor (= 9)
STRING NAME Name of structure (empty string indicates anonymous structure).
LONG PREDEF Structure definition bit flags, OR'd as follows:
'01'x PREDEF - field is predefined struct
'02'x INHERITS - field is a class
'04'x IS_SUPER - field is a superclass
'08'x Unknown?
See NBYTES for the meaning of the (PREDEF AND '01'x) field.
LONG NTAGS Number of tags in structure.
LONG NBYTES Number of bytes in structure, using IDL notation. Actual number of bytes may vary from architecture to architecture. If PREDEF bit 1 is set, then this STRUCT_DESC refers to a previous definition, and this is the last field that appears. If PREDEF bit 1 is not set then this is a definition and the following fields appear.
TAG_DESC $\times$NTAGS TAGTABLE Table of tag descriptors, which describe the types of each tag.
STRING $\times$NTAGS TAGNAMES Table of names for tags.
ARRAY_DESC $\times$NARRAYS ARRTABLE If any tag is an array type, then its dimensions are described by the following ARRAY_DESC entries. The entries appear in the order they are in the structure; NARRAYS is determined from the values in TAGTABLE.
STRUCT_DESC $\times$NSTRUCTS STRUCTTABLE If any tag is a structure type, then its tags are described by these STRUCT_DESC entries. The entries appear in the order they are in the structure; NSTRUCTS is determined from the values in TAGTABLE. (Thus, a STRUCT_DESC can contain recursive STRUCT_DESC definitions.)
STRING CLASSNAME This field is present if either of the INHERITS or IS_SUPER bits are set (see PREDEF field above). If so, then the structure being defined is a class with name CLASSNAME.
LONG NSUPCLASSES This field is present if either of the INHERITS or IS_SUPER bits are set (see PREDEF field above). If so, then NSUPCLASSES is the number of superclasses this class inherits from.
STRING $\times$ NSUPCLASSES SUPCLASSNAMES This field is present if NSUPCLASSES is present and greater than zero. It is a list of this class's superclass names.
STRUCTDESC $\times$ NSUPCLASSES SUPCLASSTABLE This field is present if NSUPCLASSES is present and greater than zero. It is a squential list of descriptors for each of this class's superclasses.


NOTES: The length of this segment depends on whether it is definitional or referential. A definitional structure descriptor describes a structure the first time it appears in the data stream, and in that case the full descriptor is used. After the first time the structure has been defined, other appearances of the same structure may refer to the first definition by setting PREDEF to a value of one.

The end of the structure descriptor can itself contain one or more array, structure or superclass descriptors. Any array descriptors appear first, in the order that they appear in the structure; followed by any structure descriptors, in the order they appear in enclosing the structure. Finally, if particular STRUCT_DESC segment is a class definition, the class's superclass definitions, if any, are appended.

The decision of whether a tag is a structure, array or scalar is described by the TAG_DESC segment.


Format: TAG_DESC        Descriptor of a structure tag
Type Name Description
LONG OFFSET Figurative ``offset'' of tag from start of struct. This number is typically meaningless since the true offset is architecture dependent.
LONG TYPECODE IDL variable type of tag value.
LONG TAGFLAGS Bit flags for variable type, OR'd together:
'20'x Tag is a structure
'10'x Tag may be an array (?)
'04'x Tag is an array


It is not clear what the '10'x bit flag of TAGFLAGS means. As noted in the table, the ``offset'' value is usually not meaningful because it depends on a platform-dependent layout of structures.


next up previous
Next: Data Value Formats Up: Data Type Descriptor Formats Previous: Arrays
Craig Markwardt 2011-12-21