Names
HCopyElemL, HCopyElemD, HGetCPar
Conversion Flags
CONV_NONE /* no conversion; do only consider original element types */ CONV_CAST /* <INT4_8>=(INT4_8)<double>; <double>=(double)<INT4_8> */ CONV_IDNT /* convert double to INT4_8, if double has no fraction */ CONV_RND /* <INT4_8>=(INT4_8)(<double>+0.5) */
Synopsis
#include "Halcon.h" HCopyElemL( Hproc_handle proc_handle, int par, int convert, INT4_8 *restrict elem, INT4_8 *num); HCopyElemD( Hproc_handle proc_handle, int par, int convert, double *restrict elem, INT4_8 *num); HGetCPar( Hproc_handle proc_handle, int par, int type, Hcpar *val, INT4_8 min, INT4_8 max, INT4_8 *num)
Figure 5.30: Routines for reading control input parameters by copy to a preallocated array.
HCopyElemL and HCopyElemD (see figure 5.30) read the parameter values of the input control parameter with the index par (1… n) and write them to the array elem that must have been allocated before with a suitable size (see HGetCParNum for information on getting the actual array length). According to the routine's suffix, HCopyElemL expects LONG_PAR, HCopyElemD DOUBLE_PAR arrays. The behavior of the routines in case of passing array types different to the expected can be specified by the convert parameter according to the description in section “HGetPElemL, HGetPElemD, HGetPElemS”. The number of elements that have been allocated for elem must be passed to num. In return, num will hold the number of actually copied array indices.
Note that HCopyElemL and HCopyElemD automatically check the result state of the underlying procedure similarly to the macro HCkP (see section “HCkP”). Thus, you must not use HCkP on HCopyElemL and HCopyElemD yourself.
INT4_8 l[10]; /* maximum array length of 10 */ INT4_8 num = 10; /* read a short/int/long value in parameter 1 */ HCopyElemL(proc_handle,1,CONV_RND,l,&num); /* now l == [2,4], num = 2 */ ...
Figure 5.31: Read the parameter values [1.7,4] of control parameter 1 using HCopyElemL.