OMget_obj_val, OMget_obj_pval, and OMset_obj_val
Synopsis
int OMget_obj_val (OMobj_id object_id, OMobj_id *value_id);
int OMget_obj_pval (OMobj_id object_id, OMobj_id *value_id,int mode);
int OMget_obj_ref (OMobj_id object_id, OMobj_id *value_id,int mode);
int OMset_obj_val (OMobj_id object_id, OMobj_id value_id,int mode);
Description
These routines get or set a pointer or reference object's value. You use these routines when an object's mode is by-reference or by-pointer, to determine the pointed-to object.
The OMget_obj_ xxx routines differ in the id they return. The examples in the table below refer to the following sample V code:
group a;
group *p1 = a; // p1 points to object a.
group *p2 = p1; // p2 points to object p1.
Routine
|
returns the id of...
|
OMget_obj_val |
The object at the end of the chain of references. For example, OMget_obj_val on object p2 returns the id of object a. |
OMget_obj_pval |
The first object in the chain, including internal objects. AVS/Express maintains internal objects that link objects in a chain of references. So an internal object exists between objects p2 and p1, and another internal object exists between p1 and a. OMget_obj_pval on object p2 returns the id of the internal object between p2 and p1. OMget_obj_pval on that internal object returns the id of p1. |
OMget_obj_ref |
The first object in the chain, skipping over internal objects. OMget_obj_ref on object p2 returns the id of object p1. |
OMset_obj_val sets the value of object_id to the value defined by value_id . This is equivalent to the `=' operator in V. This is a one-time assignment, not a connection. If you have defined two objects in V:
-> int a = 3;
-> int b;
and you make the call
-> OMset_obj_val(b_id, a_id, 0);
the results are the same as declaring (in V):
-> b = a;
For group objects that are not references or pointers, the OMset_obj_val call will be performed on subobjects with corresponding names in the two groups.
You can also use OMset_obj_val to unset an object's value by setting the value_id argument to OMnull_obj. For example, if you have an object defined in V:
-> int a = 3;
and you make the call:
-> OMset_obj_val(a_id, OMnull_obj, 0);
the resulting object will be:
-> int a;
Arguments
object_id
The id of an object.
value_id
For OMget_obj_val, OMget_obj_pval, and OMget_obj_ref, the id of the returned value. For OMset_obj_val, the id of the value that you want object_id to take.
mode
Reserved for future use. Set to 0 in all cases.
Returned value
The status code (see Return Status ).
Example
/* Get the value pointed to by var1_id. AVS/Express
returns the id
of the object at the end of the chain. */
OMobj_id var1_id;
int status;
OMobj_id var1_value_id;
...
status = OMget_obj_val(var1_id, &var1_value_id);
See also