sdaiGetAttr


Returns the data value of the specified attribute in the actual instance. The actual instance is specified by a numeric instanceID that uniquely identifies an instance in the EDMdatabase. The actual attribute is specified by a numeric attributeID that uniquely identifies an attribute definition instance in the EDMdatabase.
The specified primitive type <valueType> must be the same as the actual data type of the attribute value or a compatible data type. The primitive type sdaiSELECT can be used to get all data types. The primitive type sdaiADB can be used to get all data types except typed value. The primitive type sdaiINTEGER is compatible with sdaiREAL, and sdaiBOOLEAN is compatible with sdaiLOGICAL, hence conversion between these compatible data types will be performed when required.
The model that holds the actual instance must be open before this function can be successfully performed.
Related functions: sdaiGetAttrBN , sdaiGetAttrs , sdaiGetAttrsBN
Header:
#include "sdai.h"
Prototype:
void *sdaiGetAttr(SdaiInstance       instance,
                   SdaiAttr           attribute, 
                   SdaiPrimitiveType  valueType, 
                   void               *value); 
Arguments:

instance

A numeric instanceID that uniquely identifies an instance in the EDMdatabase.
The instanceID is defined by a sdaiCreateInstance or a sdaiCreateInstanceBN function.

attribute

A numeric attributerID that uniquely identifies an attribute definition instance in a dictionary model in the EDMdatabase.
The attributeID is returned from the sdaiGetAttrDefinition and sdaiGetAttrDefinitionBN functions.

valueType

The data type, i.e. the primitive type of the data value to be retrieved. This <valueType> must be the same or a compatible type of the primitive type of the actual attribute value. The primitive type sdaiSELECT can be used to read all data types. The primitive type sdaiADB can be used to read all data types except typed values.
The primitive type sdaiINTEGER is compatible with sdaiREAL, and sdaiBOOLEAN is compatible with sdaiLOGICAL, hence conversion between these compatible data types will be performed when required.

value

The variable that will hold a copy of the data value read from the actual attribute. The type of <value> must be the same or a compatible type of <valueType>.

Returns:
void * = address of <value> : operation successfully performed.
void * = NULL: error during operation – use sdaiErrorQuery function to get error reason.
Example:
SdaiInstance instance, anInst;
SdaiAttr attribute;
...
p = sdaiGetAttr (instance, attribute , sdaiINSTANCE, &anInst);
if (p == NULL) {
/* Error in operation */ 
printf("\nError: %s in sdaiGetAttr \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
}
. . .