OMget_ptr_val

OMset_ptr_val

OMget_name_ptr_val

OMset_name_ptr_val


Synopsis


int  OMget_ptr_val (
OMobj_id  object_id,
void  **value,
0  );

int  OMset_ptr_val (
OMobj_id  object_id,
void  *value,
0 );

int  OMget_name_ptr_val (
OMobj_id  parent_id,
OMobj_name  object_name,
void  **value,
0  );

int  OMset_name_ptr_val (
OMobj_id  parent_id,
OMobj_name  object_name,
void  *value,
0 );

Description

These routines get and set a pointer object's value. AVS/Express does not perform any manipulation on the pointer provided. It will not free the pointer when the object is destroyed. If your pointer was allocated with malloc, you will have to free it yourself when the object is destroyed with a method that is executed when the deinstanced event occurs.

The caller must be in the same process as the object for this routine to work. A -1 status is returned if the OMget_ptr_val or OMset_ptr_val routines are used with an object that is not in the same process.

Arguments

object_id

The id of an object.

value

In OMget_ptr_val, an output argument containing the object's value.

In OMset_int_val, an input argument specifying the new value.

0

The mode argument for the OMget_ptr_val and OMset_ptr_val routines is always passed as 0.

Returned value

The status code (see Return Status ).

Example

Given the V code


ptr my_id;

this C code can be used to store the pointer to a structure in the object my_id:


OMobj_id  my_id;
int status;
my_id = ...
my_struct *ptr = (my_struct *)malloc(sizeof(my_struct));
...
status = OMset_ptr_val(my_id, (void *)ptr, 0);

This code can be used to retrieve the value later:


status = OMget_ptr_val(my_id, (void **) &ptr, 0);