GDIndex.gif Previous-2.gif Next-3.gif

GDget_refer_db- GD API


Synopsis

get or set a reference to an object

int   GDget_refer_db  ( parent_id ,   elem_name ,  OMobj_id * ref_id );
void   GDset_refer_db  ( parent_id ,   elem_name ,  OMobj_id ref_id );

OMobj_id   parent_id ;
char  * elem_name ;

Description

Several objects in the Graphics Display Kit are references to other objects. For example, consider the view object's camera subobject:


group GDview_templ {
...
GDcamera_templ &camera; // "&" means by-reference.
...

camera is a reference, or connection, to a camera object.

The routines described here enable you to get or set the reference to an object.

GDget_ref_db gets an object's reference. The routine returns into ref_id the id of the referenced object.

GDset_ref_db sets an object's reference to the object identified by ref_id .

Parameters

parent_id

The id of the target object's parent object.

elem_name

The name of the target object.

ref_id

In GDget_refer_db, an output argument set to the the id of the referenced object.

In GDset_refer_db, an input argument indicating the id of the new referenced object.

Returned value

(GDget_refer_db only)  1 if successful; 0 if GDget_refer_db failed.

Example


/* Get the id of the object referenced by a view's camera
  subobject. */
OMobj_id  view_id; /* Assume this has been set. */
OMobj_id camera_ref_id;
int status;
...
status = GDget_refer_db(view_id, "camera", &camera_ref_id);
if (status == 0) {
printf("Error getting the camera reference\n");
return(1);
};

 



GDIndex.gif Previous-2.gif Next-3.gif