Implements the Express built in function UsedIn as defined in section 15.26 UsedIn – general function; in ISO 10303-11:1994(E) : The EXPRESS Language Reference Manual.
This operation is only applicable on data models. The actual data model must be open before this operation can be successfully performed.
Related functions: edmiUsedIn
Header:
#include "sdai.h"
Prototype:
EdmiError edmiUsedInBN(SdaiAppInstance instance,
SdaiString roleName,
SdaiInteger options,
SdaiInteger *membersInResult,
void *result);
Arguments:
instance |
A numeric instanceID that uniquely identifies the instance of interest in the EDMdatabase. |
roleName |
Specifies the name of the role of interest. Role names are case insensitive. A role name is the same as an attribute name. |
options |
Specifies the options that are enabled in the invocation of the edmiUsedInBN function. The <options> value should be specified as a bitwise OR between the options to enable. All options name are defined in the header file sdai.h . |
membersInResult |
Address of a variable that will receive the returned number of elements in the result data set. |
result |
Address of a variable that will receive the aggregateID of the scratch aggregate or address of the memory buffer that holds the resulting data set. |
Option Description
AS_SCRATCH_AGGR |
The result of the operation will be returned in a new created scratch aggregate. The scratch aggregate will be a BAG OF ENTITY_INSTANCE. |
AS_MEMORY_BUFFER |
The operation result aggregate will be returned as a memory buffer in the calling application's virtual memory. The memory address (byte address) of the memory buffer will be returned in the <result> argument. |
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;
SdaiAppInstance instance, result, *p;
SdaiInteger membersInResult;
int i;
. . .
if (rstat = edmiUsedInBN (instance,
"Father",
AS_MEMORY_BUFFER,
&membersInResult,
(void *) &result)) {
/* Error in operation */
printf("\nError: %s in edmiUsedInBN\n",
edmiGetErrorText(rstat));
goto error;
}
/* Printing out all the instances that uses the specified instance
in the specified role */
p = result;
for (i = 0; i < membersInResult; i++) {
printf("\nInstanceId: %lu", *p);
++p;
}
edmiFree((void *) result);
. . .