![]() |
![]() ![]() |
get or set a reference to an object
void GDset_refer_db ( parent_id , elem_name , OMobj_id ref_id );
OMobj_id parent_id ;
char * elem_name ;
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 .
The id of the target object's parent object.
The name of the target object.
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.
(GDget_refer_db only) 1 if successful; 0 if GDget_refer_db failed.
/* 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);
};
![]() |
![]() ![]() |