HGetObjNum (see figure 5.9) returns the number of iconic objects which are stored in the input iconic parameter denoted by its index par_num (from 1 to n). It is an alternative to the usage of HReadGVA (compare this page). By using HGetObjNum, the example of figure 5.3 looks as follows (see figure 5.14).
Note that HGetObjNum automatically checks the result state of the underlying procedure with the macro HCkP (see section “HCkP”). Thus, you must not use HCkP on HGetObjNum yourself.
int inp_pars; INT4_8 num_objs; Hkey key; int p,o; ... /* get number of input iconic parameters: */ /* note: This number is known in general - it is specified by */ /* the operator header in the corresponding def-file of the */ /* operator */ HReadGV(proc_handle,HGinp_obj,&inp_pars); for (p=1; p<=inp_pars; p++) { /* get number of iconic objects per input iconic parameter: */ HGetObjNum(proc_handle,p,&num_objs); for (o=1; o<=num_objs; o++) { HGetObj(proc_handle,p,o,&key); /* get key of iconic object */ /* further processing ... */ } }
Figure 5.14: Application of HGetObjNum: Access the number of iconic objects of an input iconic parameter.