Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  Using IDL  >  Array Variables


Array Variables

Array Variables

Array variables have the IDL_V_ARR bit of their flags field set, and the value.arr field points to an array descriptor defined by the IDL_ARRAY structure:

typedef struct { 
  IDL_MEMINT elt_len; 
  IDL_MEMINT arr_len; 
  IDL_MEMINT n_elts; 
  UCHAR *data;
  UCHAR n_dim;
  UCHAR flags; 
  short file_unit; 

The meaning of the fields of an array descriptor are:


The length of each array element in bytes (chars). The array descriptor does not keep track of the types of the array elements, only their lengths. Single elements can get quite long in the case of structures.

For IDL structures, this value includes any padding necessary to properly align the data along required boundaries. On a given platform, IDL creates structures the same way a C compiler does on that platform. As a result, you should not assume that the size of a structure is the sum of the sizes of the structure fields, or that the field offsets are in specific locations.


The length of the entire array in bytes. This value could be calculated as (elt_len * n_elts), but is used so frequently that it is maintained as a separate field in the IDL_ARRAY struct.


The number of elements in the array.


A pointer to the data area for the array. This is a region of dynamically allocated memory arr_len bytes long. This pointer should be cast to be a pointer of the correct type for the data being manipulated. For example, if the array variable being processed is pointed at by an IDL_VPTR named v and contains IDL_TYP_INT data:

IDL_INT *data;	/* Declare a pointer variable */
data = (IDL_INT *) v->value.arr->data;


The number of array dimensions. The constant IDL_MAX_ARRAY_DIM defines the upper limit of this value.


A bit mask that specifies characteristics of the array. Allowed values are:

  • IDL_A_FILE — This flag indicates that the array is a file variable, as created by the ASSOC function. The variable has an array block to specify the structure of the variable, but it has no data area. The data field of the IDL_ARRAY structure does not contain useful information, and should not be used.
  • IDL_A_PACKED — If array is an IDL_A_FILE variable and the data type is IDL_TYP_STRUCT, then Input/Output to this struct should use a packed data layout compatible with WRITEU instead of being a direct mapping onto the struct (which reflects the C compiler layout of the structure including its alignment holes).


When the IDL_A_FILE bit is set in the flags field, file_unit contains the IDL Logical Unit Number associated with the variable.


An array that contains the dimensions of the IDL variable. There can be up to IDL_MAX_ARRAY_DIM dimensions. The number of dimensions in the current array is given by the n_dim field.

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us