Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
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:

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.

firstElementIndex

Specifies the index of the first aggregate element to read. The legal index range for all aggregate types are:
0 <= index < number of elements in aggregate.

maxElementsToRead

Specifies max number of elements to read.

actualElementsRead

Address of a SdaiInteger variable that receives the actual number of elements read.

elementType

Address of a SdaiPrimitiveType variable that receives the data type (primitive type) of the elements in the memory buffer.

elementsValueSet

Address of a SdaiBoolean array. The index range of this array is:
0 <= index < membersInResult
An element value = sdaiTRUE means that the corresponding element in the memory buffer is set (is valid).
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.

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.

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 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);
. . .

  • No labels