Implements the Express Aggregate Intersection> operation as defined in section 12.6.2 Intersection operator; in ISO 10303-11:1994(E) : The EXPRESS Language Reference Manual.
This operation is only applicable to aggregates in data models. The actual data models must be open before this function can be successfully performed.
When any of the options values IN_OPERAND1 or IN_OPERAND2 is specified, then the actual model must be opened for write access,
Related functions: edmiAggrDifference, edmiAggrInstanceCompare , edmiAggrUnion , edmiAggrValueCompare , edmiIsAggrSubset , edmiIsAggrSuperset
Header:
#include "sdai.h"
Prototype:
EdmiError edmiAggrIntersection(SdaiAggr operand1,
SdaiAggr operand2,
SdaiInteger options,
SdaiInteger *membersInResult,
SdaiPrimitiveType *elementType,
void *result);
Arguments:
operand1 |
A numeric aggregateID that uniquely identifies the aggregate instance used as operand1 (left operand) in the operation. |
operand2 |
A numeric aggregateID that uniquely identifies the aggregate instance used as operand2 (right operand) in the operation. |
options |
Specifies the options to be used in the invocation of the edmiAggrIntersection function. The <options> value can be specified as a bitwise OR between the actual options to enable. All option names are defined in the header file sdai.h. |
membersInResult |
Address of a variable that will receive the returned number of elements in the result aggregate. |
elementType |
Address of a variable that will receive the data type of the resulting data of the operation. |
result |
Address of a variable that will receive the result of the aggregate intersection operation. The data type of the <result> argument is dependent of the <options> argument. |
Options Description
AS_SCRATCH_AGGR |
The result of the operation will be returned in a new created scratch aggregate. The aggregate type is dependent of the aggregate type of the operands and will be according to the definition of the operation in the Express language. |
AS_MEMORY_BUFFER |
The operation result aggregate will be returned as a memory aggregate in the calling application's virtual memory. The memory address (byte address) will be returned in the <result> argument. |
IN_OPERAND1 |
The result of the operation will be in the aggregate specified in the <operand1> argument. Hence the original value in the <operand1> aggregate will be overwritten. |
IN_OPERAND2 |
The result of the operation will be in the aggregate specified in the <operand2> argument. Hence the original value in the <operand2> aggregate will be overwritten. |
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
int i;
EdmiError rstat;
void *result;
SdaiAggr operand1, operand2;
SdaiInteger membersInResult;
SdaiPrimitiveType elementType;
SdaiInstance *pi;
. . .
If (rstat = edmiAggrIntersection (operand1,
operand2,
AS_MEMORY_BUFFER,
&membersInResult,
&elementType,
(void *)&result)) {
/* Error in operation */
printf("\nError: %s in edmiAggrIntersection \n",
edmiGetErrorText(rstat));
goto error;
}
/* Assuming that the resulting data set is of type SdaiInstance,
i.e., elementType = sdaiINSTANCE
print out instanceId of resulting data set */
pi = (SdaiInstance *) pi;
for (i = 0; i < membersInResult; i++) {
print("\n%lu",*p);
++pi;
}
. . .
edmiFree(result); /* free memory buffer */
. . .