Function
Access or typecheck a component in a Field.
Syntax
#include <dx/dx.h>
Error DXComponentReq(Array a, Pointer *data, int *n, int nreq, Type t, int
dim)
Error DXComponentOpt(Array a, Pointer *data, int *n, int nreq, Type t, int
dim)
Error DXComponentReqLoc(Array a, Pointer *data, int *n, int nreq, Type t, int
dim)
Error DXComponentOptLoc(Array a, Pointer *data, int *n, int nreq, Type t, int
dim)
Functional Details
Note: | These routines will become obsolete in a future version of Data Explorer. In their place, it is recommended that you now use DXGetComponentValue and DXGetArrayInfo. |
The four routines have identical calling sequences, but differ as follows.
First, DXComponentOpt and DXComponentReq return pointers to the global copy of the Array data, while DXComponentOptLoc and DXComponentReqLoc return pointers to a local copy of the Array data, and should be matched by a DXFreeArrayDataLocal call.
Second, DXComponentReq and DXComponentReqLoc consider it an error if the component is missing (a is NULL), while DXComponentOpt and DXComponentOptLoc consider the component optional and do not consider a NULL a to be an error.
If data is not NULL, a pointer to a global or local copy of the data is returned in *data. If n is not NULL, the number of items in the Array is returned in *n. If n is NULL, the number of Array items must be nreq. The type of the Array must be t. If dim is 0, the Array must have rank 0 (scalar). If dim is nonzero, the Array must have rank 1 and shape equal to dim.
The type is one of the following:
TYPE_BYTE TYPE_HYPER TYPE_SHORT TYPE_UBYTE TYPE_INT TYPE_USHORT TYPE_DOUBLE TYPE_UINT TYPE_STRING TYPE_FLOAT
Note: | These functions will expand compact data Arrays and use extra memory. |
Return Value
Returns OK or returns ERROR and sets an error code.
See Also
DXGetArrayData, DXGetArrayInfo, DXGetComponentValue