HGetPElemL, HGetPElemD, and HGetPElemS (see
figure 5.25) return a reference in
elem to the value array of the input control
parameter at the position par
(1… n). According to the expected type of the array,
HGetPElemL is used to get LONG_PAR arrays,
HGetPElemD for DOUBLE_PAR, and
HGetPElemS for STRING_PAR arrays. The
behavior of the routines in case of passing array types different to
the expected can be specified by the convert
parameter. Following values are supported:
- CONV_NONE
- supports no conversion and accepts only the
requested element type. Otherwise, the error 'wrong type of input parameter x'
(H_ERR_WIPTx) will be returned.
- CONV_CAST
- provides conversion of LONG_PAR and
DOUBLE_PAR values to the requested type by a cast. In case of
conversion, the array is copied to an ad hoc allocated memory
buffer. This buffer is freed automatically when the operator
returns. LONG_PAR and
DOUBLE_PAR value types can not be casted to type
STRING_PAR and vice versa. In this case, error
'wrong type of input parameter x' (H_ERR_WIPTx) will be returned.
- CONV_IDNT
- converts DOUBLE_PAR values of a
DOUBLE_PAR or MIXED_PAR array to
type LONG_PAR when passed to HGetPElemL. This
conversion is performed only if all double values of the
input array have no fraction, i.e., the
cast is reversible. When passed to HGetPElemD, values of
type LONG_PAR are casted to type
DOUBLE_PAR.
Any other conversion is not supported and in this case the error
'wrong type of input parameter x' (H_ERR_WIPTx)
is returned. In case of conversion,
the array is copied to an ad hoc allocated memory
buffer. This buffer is freed automatically when the operator
returns.
- CONV_RND
- provides conversion by rounding when
DOUBLE_PAR values have to be converted to LONG_PAR
type (HGetPElemD). LONG_PAR values are casted to
DOUBLE_PAR if passed to HGetPElemD. Otherwise,
the error 'wrong type of input parameter x'
(H_ERR_WIPTx) will be returned. In case of conversion, the array is copied to an ad hoc allocated memory
buffer. This buffer is freed automatically when the operator
returns.
Any conversion of input array types will be paid for by performance and memory consumption. Refer to HGetPElem (see section “HGetPElem”) if efficient support of different array types is important.
The current number of parameter values is returned in num.
Note that HGetPElemL, HGetPElemD, and HGetPElemS
automatically check the result state of the underlying procedure similarly
to the macro HCkP (see section “HCkP”). Thus,
you must not use HCkP on
HGetPElemL, HGetPElemD, or HGetPElemS yourself.
Figure 5.26 shows the usage of
HGetPElemL andHGetPElemS together with
HGetPPar (compare section “HGetPPar”).