Writes a memory buffer to the specified aggregate. The memory buffer can be written to any aggregate types with the following operations:
ARRAY: The argument < firstElementIndex> specifies the first element number in the ARRAY to write into. The argument <elementsSet> specifies element value set/element value unset.
LIST: The memory buffer elements will be appended to the specified LIST.
BAG and SET: The memory buffer elements will be added to the specified BAG or SET.
This operation is only applicable to data models.
The actual data model must be open for write access before this operation can be successfully performed.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiWriteAggrElements(SdaiAggr aggrId,
SdaiInteger firstElementIndex,
SdaiInteger numberOfElements,
SdaiPrimitiveType elementType,
SdaiBoolean **elementsValueSet,
void *dataAdress);
Arguments:
aggrId |
A numeric aggregateID that uniquely identifies the aggregate of interest in the EDMdatabase. |
firstElementIndex |
A SdaiInteger variable that defines the first index of an ARRAY to write into. The first index in an ARRAY is equal to the lower index in the ARRAY declaration in the actual dictionary model (Express schema). |
numberOfElements |
A SdaiInteger variable that defines the number of elements to write into the specified aggregate. |
elementType |
Specifies the data type ( primitive type) of the elements to write into the aggregate |
elementsValueSet |
Address to an array of SdaiBoolean that contains one element for each memory buffer element. An element value of sdaiTRUE means a set (valid) element, an element value of sdaiFALSE means an unset element. The corresponding ARRAY aggregate elements will be set/unset according to the value of the corresponding element number in <elementsValueSet> array. |
dataAddress |
The address of the memory buffer that contains the elements to write into the aggregates. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
SdaiAggr aggrId;
SdaiInteger integerBuffer[MAX_ELEMENTS];
. . .
if (rstat = edmiWriteAggrElements (&aggrId,
0,
256,
sdaiINTEGER,
NULL, /* Assume aggrId is not ARRAY */
(void *) integerBuffer)) {
/* Error in operation */
printf("\nError: %s in edmiWriteAggrElements\n",
edmiGetErrorText(rstat));
goto error;
}
. . .