HGetSPar is a simplified version of HGetCPar. In contrast to the latter, a fixed number of parameter values is read, see figure 5.33. Therefore, the routine does not return the actual number17) of values.
Note that HGetSPar automatically checks the result state of the underlying procedure similarly to the macro HCkP (see section “HCkP”). Thus, you must not use HCkP on HGetSPar yourself.
Hcpar par1,par2; Hcpar par3[3]; /* allocate memory for strings */ HAllocStringMem(proc_handle,1000); /* read a short/int/long value in parameter 1 */ HGetSPar(proc_handle,1,LONG_PAR,&par1,1); /* now par1.par.l == 5 */ /* read a string in parameter 2 */ HGetSPar(proc_handle,2,STRING_PAR,&par2,1); /* now par2.par.s == "Text" */ /* read a tuple of 3 float values in parameter 3 */ HGetSPar(proc_handle,3,DOUBLE_PAR,par3,3); for (i=0; i<num; i++) { /* par3[i].par.d == 0.5,1.7,4.4 */ ...
Figure 5.33: Read the control parameter values of the operator call demo(5,'Text',[0.5,1.7,4.4]) using HGetSPar.
| 17) This number is
fixed. If more or less values are passed to the HALCON operator,
HGetSPar exits the supply procedure with an error.
|