Definition
AVS/Express assigns each object a unique id.
In a C function, the id's type is OMobj_id.
For example, the following V code defines group object grp1 and two subobjects, a and b:
group grp1 {
int a;
int b;
};
A C program can obtain the object ids of grp1, a, and b. Assume that grp1's parent id is parent_id:
OMobj_id parent_id, grp1_id, a_id, b_id;
...
grp1_id = OMfind_subobj(parent_id, OMstr_to_name("grp1"),
OM_OBJ_RW);
a_id = OMfind_subobj(grp1_id, OMstr_to_name("a"),
OM_OBJ_RW);
b_id = OMfind_subobj(grp1_id, OMstr_to_name("b"),
OM_OBJ_RW);
OMobj_id is a structure
OMobj_id is a two-value structure defined in the header file <avs/om.h> as follows:
typedef struct _OMobj_id {
OMobj_id_type obj_id; /* Pointer within a process. */
OMproc_id proc_id; /* Process id. */
} OMobj_id;
Initializing a OMobj_id
You generally can ignore the fact that OMobj_id is a structure. But be aware that on some compilers, you cannot initialize a OMobj_id in its declaration:
OMobj_id id = OMnull_obj; /* Error on some compilers. */
Instead, do the following:
OMobj_id id;
id = OMnull_obj;
Comparing ids
To compare object ids, use the routine OMequal_objs:
if (OMequal_objs(obj_id1, obj_id2))
...
Determining whether an id is null
To determine whether an object id is null, use the routine OMis_null_obj:
if (OMis_null_obj(obj_id))
...
Predefined object ids
The following are variables of type OMobj_id. They are provided by the Object Manager, in <avs/om.h>, and initialized at system start-up.
This predefined variable...
|
is set to...
|
The id of the Applications object | |
A null object id | |
The id of the Root object | |
The id of the Templates object |