...
Reads
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiReadAggrElements(SdaiAggr aggrId,
SdaiInteger firstElementIndex,
SdaiInteger maxElementsToRead,
SdaiInteger *actualElementsRead,
SdaiPrimitiveType *elementType,
SdaiBoolean **elementsValueSet,
void **dataAddress);
|
Reads the specified elements from the specified aggregate and store the result as a memory buffer in the calling application.
The space required to hold the memory buffer and optionally the <elementsValueSet> array are allocated by the operation and should be released by the caller when appropriate by invoking the edmiFree operation.
The memory buffer will be an array of the <elementType> data type, i.e., an array of SdaiInteger, SdaiReal, SdaiString, SdaiInstance, SdaiAggr, SdaiBoolean, SdaiLogical, SdaiBinary, SdaiEnumeration or SdaiSelect.
Related functions: edmiWriteAggrElements, edmiGetAggrElement, edmiFindAggrElements
Header: #include "sdai.h"
Prototype:
EdmiError edmiReadAggrElements(SdaiAggr aggrId,
SdaiInteger firstElementIndex,
SdaiInteger maxElementsToRead,
SdaiInteger *actualElementsRead,
SdaiPrimitiveType *elementType,
SdaiBoolean **elementsValueSet,
void **dataAddress);
Arguments:
Arguments
...
Type | Name | Comment | ||
SdaiAggr | aggrId | A numeric aggregateID that uniquely identifies the aggregate of interest in the EDMdatabase. | The aggregateID is returned when the aggregate is created or it can be retrieved with an EDMinterface get operation. | |
SdaiInteger | firstElementIndex | Specifies the index of the first aggregate element to read. The legal index range for all aggregate types are: | ||
SdaiInteger | maxElementsToRead | Specifies max number of elements to read. | ||
SdaiInteger | actualElementsRead | Address of a SdaiInteger variable that receives the actual number of elements read. | ||
SdaiPrimitiveType | elementType | Address of a SdaiPrimitiveType variable that receives the data type (primitive type) of the elements in the memory buffer. | ||
SdaiBoolean | elementsValueSet | Address of a SdaiBoolean array. The index range of this array is: | This argument is only valid when the aggregate type of <aggrId> is ARRAY. | This virtual memory occupied by the <elementsValueSet> argument should be released by the calling application, using the EDMinterface operation edmiFree when the data is no longer needed by the application. |
void | dataAddress | Address of a void* variable that receives the address of the returned memory buffer. This address should be used as the argument in the edmiFree operation to release the virtual memory holding the memory buffer. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; SdaiAggr aggrId; SdaiInteger firstElementIndex,maxElementsToRead,actualElementsRead; |
...
SdaiPrimitiveType elementType; |
...
SdaiBoolean *elementsValueSet; |
...
SdaiString *p,*dataAddress; |
...
int i; |
...
. . . |
...
firstElementIndex = 0; |
...
maxElementsToRead = 1000; |
...
if (rstat = edmiReadAggrElements (aggrId, |
...
firstElementIndex, |
...
maxElementsToRead, |
...
&actualElementsRead, |
...
&elementType, |
...
&elementsValueSet, |
...
(void *) &dataAdress)) { |
...
/* Error in operation */ |
...
printf("\nError: %s in edmiReadAggrElements\n", |
...
edmiGetErrorText(rstat)); |
...
goto error; |
...
} /* Expecting a memory buffer of SdaiString data type */ |
...
if (elementType == sdaiSTRING) { |
...
/* Print out the returned strings */ |
...
p = dataAdress; |
...
for (i = 0; i < actualElementsRead; i++) { |
...
printf("\n%s",*p); |
...
++p; |
...
} } edmiFree(dataAddress); |
...
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|