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: edmiUsedInBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiUsedIn(SdaiAppInstance instance,
SdaiAttr roleId,
SdaiInteger options,
SdaiInteger *membersInResult,
void *result);
Arguments:
instance |
A numeric instanceID that uniquely identifies the instance of interest in the EDMdatabase. |
roleId |
The SdaiAttr instance that uniquely specifies a role in a dictionary model. A role is the same as an attributeID. The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions. |
options |
Specifies the options that are enabled in the invocation of the edmiUsedIn function. The <options> value should be specified as a bitwise OR between the options to enable. All option names are defined in the header file sdai.h . |
membersInResult |
Address of a SdaiInteger 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;
SdaiAttr roleId;
int i;
. . .
if (rstat = edmiUsedIn (instance,
roleId,
AS_MEMORY_BUFFER,
&membersInResult,
(void *) &result)) {
/* Error in operation */
printf("\nError: %s in edmiUsedIn\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);
. . .