A general access on input control parameter without any implicite conversion is provided by the routine HGetPElem (see figure 5.25). HGetPElem returns in elem a reference to the input array of arbitrary type of the input control parameter with the index par (1… n). The length of the array is returned in num. type holds the array type of the returned array and can take the values LONG_PAR, DOUBLE_PAR, STRING_PAR, and MIXED_PAR, coding arrays of type INT4_8, double, char*, and Hcpar, respectively.
Figure 5.27 shows the usage of HGetPElem.
const void *restrict ctrl1; INT4_8 n1; int t1; /* Read all values of parameter number 1 */ HGetPElem(proc_handle, 1, &e1, &n1, &t1); switch( t1) { case LONG_PAR: { INT4_8 const *l = (INT4_8 const *)e1; ... break; } case DOUBLE_PAR: { double const *d = (double const *)e1; ... break; } case STRING_PAR: { char const *const *s = (char const *const *)e1; ... break; } case MIXED_PAR: { Hcpar const *cpar = (Hcpar const *)e1; ... break; } default: return H_ERR_WIPT1; } ...
Figure 5.27: Read the control parameter values of the first control parameter of an operator using HGetPElem.