- extract a data element from an EV_AttrValue structure
#include <$OV_HEADER/ecs/EV/value.h> int32 EV_extractElement ( const EV_AttrValue *AV, int32 elementNum, EV_AttrType *attrType, int32 *size, const void **elementData );
This function can be used to extract a data element from an EV_AttrValue structure of type EV_LIST or EV_TUPLE.
A pointer to an EV_AttrValue and an element number must be specified. The function returns the attribute type and size in bytes of the specified element, plus a pointer to it. The data pointer should be cast to the data type corresponding to the returned attribute type (corresponding to ECDL types) as follows:
EV_STRING (char *) EV_INTEGER (int32 *) EV_REAL (real64 *) EV_BOOLEAN (ecsbool *) ecstrue = 1, ecsfalse = 0 EV_TIME (EV_Time *) EV_DURATION (EV_Duration *) EV_OID (u_int32 *) EV_NULL - EV_TUPLE (EV_AttrValue *) EV_LIST (EV_AttrValue *)
The data types EV_Time, EV_Duration are defined in the $OV_HEADERS/ecs/EV/value_struct.h header file.
If the specified element has an attribute type of EV_NULL, the returned size is zero, and the returned pointer value is NULL and size is 0.
If the specified element has an attribute type of EV_TUPLE or EV_LIST, the returned size is zero, and elementData is a pointer to another EV_AttrValue.
This can be decoded with further calls to EV_extractElement.
const EV_AttrValue *AV
EV_AttrValue structure of typeEV_LIST orEV_TUPLE to extract data from.
int32 elementNum
EV_AttrType *attrType
int32 *size
EV_LIST and EV_TUPLE types.
const void **elementData
EV_AttrValue structure, and is valid until the AV is freed (using EV_deleteValue).
ECS_SUCCESS
ECS_BAD_PARAMETER
ElementNum is less than 1.
EV_INCORRECT_AV_TYPE
AV is not an EV_AttrValue of EV_LIST or EV_TUPLE type.
EV_NO_SUCH_ELEMENT
ElementNum does not exist in AV.