FLDadd_int_array


Synopsis

create/get/set an integer subobject to an object


int FLDadd_int_array (
OMobj_id field,
const char *name,
int size);

int FLDset_array_int (
OMobj_id field,
const char *name,
int size,
int *array,
int mode);

int FLDget_array_int (
OMobj_id field,
const char *name,
int **array,
int *size,
int mode);

Description

These routines add a new integer array subobject to an existing field data schema object, and then set/get its values. They could also be used when you want to construct and reference an entirely new data object and add int array subobjects to it, but you want to do this within the code of a function, rather than using V.

Note: If you are accessing an existing, defined subobject, use the specific routine for that subobject (for example, FLDget_coord_extent). Use FLDadd/set/ get_array_int only when you have created your own, unique, named subobject, or when no FLD routine exists for a pre-defined subobject.

FLDadd_int_array adds an integer array subobject to the object specified by OMobj_id field. The object is named in the Object Manager by the string name. size indicates the total number of array values. For example, a [100][2] array would have size 200. The new subobject is flagged as "not set."

FLDset_array_int sets the integer array object named name within field equal to the first size values found in a integer array pointed to by array.

FLDget_array_int returns the value of the integer subobject name within field in via the double pointer array.

Parameters

OMobj_id field

The OMobj_id of an object. This can be any object, not just a "Field".

const char *name

In FLDadd_int_array, a character string that names the new int subobject.

In FLDset_array_int and FLDget_array_int, a character string that specifies the name of the integer array subobject of field to get/set.

int size
int *size

In FLDadd_int_array, size is the total number of array values to create. A [100][3] array would have size=300.

In FLDset_array_int, size is how many sequential values to take from array and assign to the subobject.

In FLDget_array_int, size is a pointer to an integer in which the size of the subobject array will be returned.

int mode

An integer constant that establishes the access mode for the array subobject. Constants for the possible values are defined in avs/om.h as follows.

For FLDset_array_int:

Mode

 

Value

 

Meaning

 

OM_SET_ARRAY_COPY

0

Copy the array into the Object Manager

OM_SET_ARRAY_FREE

1

If possible, do not copy the array. Instead, set the object's array pointer to node_data. AVS/Express copies the array anyway if the function is running in an external process or if data type conversion is required.

AVS/Express manages the array and will determine when the array can be freed.

You must allocate space for the array with a call to ARRalloc.

OM_SET_ARRAY_STATIC

2

If possible, do not copy the array. Instead, set the object's array pointer to node_data. AVS/Express copies the array anyway if the function is running in an external process or if data type conversion is required.

AVS/Express does not manage the array. You must ensure that the array is valid for the life of the object or until the object replaces the array.

 

For FLDget_array_int:

Mode

 

Value

 

Meaning

 

OM_GET_ARRAY_RD

0

The program intends to read the array, but not write to it.

OM_GET_ARRAY_WR

1

The program intends to write to the array, completely replacing it, but not read it.

OM_GET_ARRAY_RW

2

The program intends to both read and write to the array.

OM_GET_ARRAY_RD_
COPY

3

The program requires a copy of the array for its own, private use (reading or writing).

 

int *array
int **array

In FLDset_array_int, array is an array of integers of size size. Those values will be assigned to the name subobject.

In FLDget_array_int, array should be the address of a pointer to integers; upon return, *array will be filled in with a pointer to the values. You must call ARRfree on the returned pointer (*array) when you are done with that array.

Examples

modules/int_data.c
modules/nmap.c
modules/iso.c
modules/isotrace.c
modules/slice.c

Related routines