cniElementValue group

Use one or more of the functions in this group to retrieve the value of the specified syntax element.

Specify the appropriate function from this group that matches the type of data to be retrieved:

  • cniElementBitArrayValue
  • cniElementBooleanValue
  • cniElementByteArrayValue
  • cniElementCharacterValue
  • cniElementDateValue
  • cniElementDecimalValue
  • cniElementGmtTimestampValue
  • cniElementGmtTimeValue
  • cniElementIntegerValue
  • cniElementRealValue
  • cniElementTimestampValue
  • cniElementTimeValue

Syntax

CciSize cniElementBitArrayValue(
  int*           returnCode,
  CciElement*    targetElement,
  const struct   CciBitArray* value);
CciBool cniElementBooleanValue(
  int*           returnCode,
  CciElement*    targetElement);
CciSize cniElementByteArrayValue(
  int*           returnCode,
  CciElement*    targetElement,
  const struct   CciByteArray* value);
CciSize cniElementCharacterValue(
  int*           returnCode,
  CciElement*    targetElement,
  const CciChar* value,
  CciSize        length);
struct CciDate cniElementDateValue(
  int*           returnCode,
  CciElement*    targetElement);
CciSize cniElementDecimalValue(
  int*           returnCode,
  CciElement*    targetElement,
  const CciChar* value,
  CciSize        length);
struct CciTimestamp cniElementGmtTimestampValue(
  int*           returnCode,
  CciElement*    targetElement);
struct CciTime cniElementGmtTimeValue(
  int*           returnCode,
  CciElement*    targetElement);
CciInt cniElementIntegerValue(
  int*           returnCode,
  CciElement*    targetElement);
CciReal cniElementRealValue(
  int*           returnCode,
  CciElement*    targetElement);
struct CciTimestamp cniElementTimestampValue(
  int*           returnCode,
  CciElement*    targetElement);
struct CciTime cniElementTimeValue(
  int*           returnCode,
  CciElement*    targetElement);

Parameters

returnCode
The return code from the function (output).
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
  • CCI_INV_BUFFER_TOO_SMALL
targetElement
The address of the target syntax element object (input).
value
The address of an output buffer into which the value of the syntax element is stored (input). Used on relevant function calls only.
length
The length of the output buffer, in characters, specified by the value parameter (input). Used on relevant function calls only.

Return values

  • If successful, the value of the target element is returned.
  • If the size of an element's data can vary, the correct data size is returned.
  • If the specified length is too small, the error code is set to CCI_BUFFER_TOO_SMALL.
  • If an error occurs, the returnCode parameter indicates the reason for the error.

Example

 numberOfChars = cniElementCharacterValue(
		 		 &rc, firstChild, (CciChar*)&elementValue, sizeof(elementValue)
		 		 );

if (rc==CCI_BUFFER_TOO_SMALL) {
    free(elementValue);
    elementValue      = (CciChar*)malloc(numberOfChars * sizeof(CciChar));
    numberOfChars     = cniElementCharacterValue(
                  &rc, firstChild, (CciChar*)&elementValue, sizeof(elementValue));
  }