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 TypeOf as defined in section 15.25 TypeOf – 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.
The actual argument to the TypeOf function is the attribute value <attrId> in the specified instance <instance>.
Dependent of the <options> argument, each returned element will either be a string as defined in the Express TypeOf function, or as an SdaiInstance that uniquely identify the type in an EDMdatabase.
Related functions: edmiTypeOfAttrBN, edmiTypeOfAggrByIterator , edmiTypeOfAggrByIndex
Header:
#include "sdai.h"
Prototype:
EdmiError edmiTypeOfAttr (SdaiAppInstance instance,
                           SdaiAttr        attrId, 
                           SdaiInteger     options, 
                           SdaiInteger     *membersInResult, 
                           void            *result); 
Arguments:

instance

A numeric instanceID that uniquely identifies the instance of interest in the EDMdatabase.

attrId

A numeric attributeID that uniquely identifies an attribute definition instance in the EDMdatabase.
The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.

options

Specifies the options that are enabled in the invocation of the edmiTypeOfAttr 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 .
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 SET OF STRING or SET OF Entiy_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 SdaiString or 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.

AS_STRINGS

The resulting data set will be a memory buffer of SdaiString or a SET OF STRING (scratch aggregate)

AS_INSTANCE_IDS

The resulting data set will be a memory buffer of SdaiInstance or a SET OF ENTITY_INSTANCE (scratch aggregate)

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;
SdaiInteger membersInResult;
SdaiAttr attrId;
SdaiAggr result;
SdaiString str;
int i;
. . .
if (rstat = edmiTypeOfAttr (instance,
attrId, 
AS_STRINGS | AS_SCRATCH_AGGR, 
&membersInResult, 
(void *) &result)) { 
/* Error in operation */ 
printf("\nError: %s in edmiTypeOfAttr\n", 
edmiGetErrorText(rstat)); 
goto error; 
}
/* Printing out the returned (string) type */
for (i = 0; i < membersInResult; i++) {
edmiGetAggrElement(result, i, sdaiSTRING, &str);
if (str == NULL) { 
/* Error in operation */ 
printf("\nError: %s in edmiGetAggrElement \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 

printf("\n%s", str); 
edmiFree(str); 
}
sdaiDeleteAggr(result); /* Delete scratch aggregate */
. . .

  • No labels