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 »


 
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.
This argument can be set to zero, meaning that any role the actual <instance> plays will be returned by this function.

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 .
See detailed descriptions of the available options below.

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.
A numeric aggregateID that uniquely identifies the resulting scratch aggregate instance will be returned in the <result> argument.
AS_SCRATCH_AGGR is the default value of the <options> argument.

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.
The memory buffer will be an array of SdaiInstance.
The virtual memory in the calling application's memory will be allocated by EDMinterface. This virtual memory should be released by the calling application, using the EDMinterface operation edmiFree when the data is no longer needed by the application.

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

  • No labels