sdaiGetAttr

valueType argument to specify what type of data caller wants to get and value argument where the caller should provide a buffer, and the function will write the result to. Table 1 shows type of buffer the caller should provide depending on the valueType for sdaiGetAttr, and it works similarly for all get-functions. Note: with SDAI API it is impossible to check buffer type at compilation or execution time and this is responsibility of a caller to ensure that requested valueType is matching with the value argument, a mismatch will lead to unpredictable results. The Table 2 shows what valueType can be fulfilled depending on actual model data. If a get-function cannot get a value it will return 0, it may happen when model item is unset ($) or incompatible with requested valueType. To separate these cases you can use engiGetInstanceAttrType(BN), sdaiGetADBType, and engiGetAggrType. On success get-function will return non-zero. More precisely, according to ISO 10303-24-2001 on success they return content of value argument (*value) for sdaiADB, sdaiAGGR, or sdaiINSTANCE or value argument itself for other types (it has no useful meaning for C#).

Table 1 – Required value buffer depending on valueType (on the example of sdaiGetAttr but valid for all get-functions)

valueType               C/C++                                                   C#

sdaiINTEGER             int_t val;                                              int_t val;
                        sdaiGetAttr (inst, attr, sdaiINTEGER, &val);            ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiINTEGER, out val);

sdaiREAL or sdaiNUMBER  double val;                                             double val;
                        sdaiGetAttr (inst, attr, sdaiREAL, &val);               ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiREAL, out val);

sdaiBOOLEAN             bool val;                                               bool val;
                        sdaiGetAttr (inst, attr, sdaiBOOLEAN, &val);            ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiBOOLEAN, out val);

sdaiLOGICAL             const TCHAR* val;                                       string val;
                        sdaiGetAttr (inst, attr, sdaiLOGICAL, &val);            ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiLOGICAL, out val);

sdaiENUM                const TCHAR* val;                                       string val;
                        sdaiGetAttr (inst, attr, sdaiENUM, &val);               ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiENUM, out val);

sdaiBINARY              const TCHAR* val;                                       string val;
                        sdaiGetAttr (inst, attr, sdaiBINARY, &val);             ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiBINARY, out val);

sdaiSTRING              const char* val;                                        string val;
                        sdaiGetAttr (inst, attr, sdaiSTRING, &val);             ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiSTRING, out val);

sdaiUNICODE             const wchar_t* val;                                     string val;
                        sdaiGetAttr (inst, attr, sdaiUNICODE, &val);            ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiSTRING, out val);

sdaiEXPRESSSTRING       const char* val;                                        string val;
                        sdaiGetAttr (inst, attr, sdaiEXPRESSSTRING, &val);      ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiEXPRESSSTRING, out val);

sdaiINSTANCE            SdaiInstance val;                                       int_t val;
                        sdaiGetAttr (inst, attr, sdaiINSTANCE, &val);           ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiINSTANCE, out val);

sdaiAGGR                SdaiAggr aggr;                                          int_t aggr;
                        sdaiGetAttr (inst, attr, sdaiAGGR, &aggr);              ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiINSTANCE, out aggr);

sdaiADB                 SdaiADB adb = sdaiCreateEmptyADB();                     int_t adb = 0;  //  it is important to initialize
                        sdaiGetAttr (inst, attr, sdaiADB, adb);                 ifcengine.sdaiGetAttr (inst, attr, ifcengine.sdaiADB, out adb);     
                        sdaiDeleteADB (adb);

                        SdaiADB adb = nullptr;  //  it is important to initialize
                        sdaiGetAttr (inst, attr, sdaiADB, &adb);
TCHAR is “char” or “wchar_t” depending on setStringUnicode. (Non-standard behavior) sdaiLOGICAL behaves differently from ISO 10303-24-2001: it expects char* while standard declares int_t (Non-standard extension) sdiADB in C++ has an option to work without sdaiCreateEmptyADB and sdaiDeleteADB as shown in the table
Table 2 - valueType can be requested depending on actual model data.

valueType       Works for following values in the model
                  integer      real     .T. or .F.     .U.      other enum    binary      string     instance      list      $ (empty)
sdaiINTEGER         Yes         Yes *        .           .           .           .           .           .           .           .
sdaiREAL            Yes         Yes          .           .           .           .           .           .           .           .
sdaiNUMBER          Yes         Yes          .           .           .           .           .           .           .           .
sdaiBOOLEAN          .           .          Yes          .           .           .           .           .           .           .
sdaiLOGICAL          .           .          Yes         Yes          .           .           .           .           .           .
sdaiENUM             .           .          Yes         Yes         Yes          .           .           .           .           .
sdaiBINARY           .           .           .           .           .          Yes          .           .           .           .
sdaiSTRING          Yes         Yes         Yes         Yes         Yes         Yes         Yes          .           .           .
sdaiUNICODE         Yes         Yes         Yes         Yes         Yes         Yes         Yes          .           .           .
sdaiEXPRESSSTRING   Yes         Yes         Yes         Yes         Yes         Yes         Yes          .           .           .
sdaiINSTANCE         .           .           .           .           .           .           .          Yes          .           .
sdaiAGGR             .           .           .           .           .           .           .           .          Yes          .
sdaiADB             Yes         Yes         Yes         Yes         Yes         Yes         Yes         Yes         Yes          .
Note: sdaiGetAttr, stdaiGetAttrBN, engiGetElement will success with any model data, except non-set($) (Non-standard extensions) sdaiGetADBValue: sdaiADB is allowed and will success when sdaiGetADBTypePath is not NULL, returning ABD value has type path element removed.

Syntax

//
//   Strong typing definition
//
void            * sdaiGetAttr(
                        SdaiInstance            instance,
                        const SdaiAttr          attribute,
                        SdaiPrimitiveType       valueType,
                        void                    * value
                    );


//
//   Weak typing definition
//
void    __declspec(dllexport) * __stdcall sdaiGetAttr(
                                                                        int_t                   instance,
                                                                        const void              * attribute,
                                                                        int_t                   valueType,
                                                                        void                    * value
                                                                    );
    

Property instance

Size: 32 bit / 4 byte (value)
...

Property attribute

Size: 32 bit / 4 byte (reference)
...

Property valueType

Size: 32 bit / 4 byte (value)
...

Property value

Size: 32 bit / 4 byte (reference)
...

Example (based on pure API calls)

Here you can find code snippits that show how the API call sdaiGetAttr can be used.

#include    "./include/ifcengine.h"
{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : REAL;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(1.23);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue);
    assert(rValue && iValue == 1);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue);
    assert(rValue && dValue == 1.23);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue);
    assert(rValue && dValue == 1.23);

    ..

    bool    bValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && atof(strValue) == 1.23);

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && wtof(strValue) == 1.23);

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && atof(strValue) == 1.23);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : INTEGER;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(123);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue);
    assert(rValue && iValue == 123);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue);
    assert(rValue && dValue == 123.);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue);
    assert(rValue && dValue == 123.);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && atoi(strValue) == 1.23);

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && wtoi(strValue) == 1.23);

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && atoi(strValue) == 123);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : BOOLEAN;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(.T.);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    void    * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue);
    assert(rValue && bValue == true);
    
    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue);
    assert(rValue && equal(strValue, "T"));

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue);
    assert(rValue && equal(strValue, "T"));

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".T."));

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && equal(strValue, L".T."));

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".T."));

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : LOGICAL;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(.U.);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue);
    assert(rValue && equal(strValue, "U"));

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue);
    assert(rValue && equal(strValue, "U"));

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".U."));

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && equal(strValue, L".U."));

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".U."));

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      TYPE MyEnum = ENUMERATION OF
    //          (EXAMPLE
    //          ,NOTDEFINED);
    //      END_TYPE;
    //
    //      ENTITY MyEntity
    //          MyAttribute : MyEnum;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(.EXAMPLE.);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue);
    assert(rValue && equal(strValue, "EXAMPLE"));

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".EXAMPLE."));

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && equal(strValue, L".EXAMPLE."));

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, ".EXAMPLE."));

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : BINARY;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY('abc');
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);
    assert(rValue && equal(strValue, "abc"));

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, "abc"));

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && equal(strValue, L"abc"));

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, "abc"));

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : STRING;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY('K\X2\00F6\X0\ln');
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, "K?ln"));

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue);
    assert(rValue && equal(strValue, L"Koln"));

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && equal(strValue, "K\X2\00F6\X0\ln"));

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : MyEntity;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY(#101);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    void            * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &instValue);
    assert(rValue && instValue == myEntityInstance);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}

{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : SET [0:?] OF ...;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY((.., .., ..));
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &strValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    void        * rValue = sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &aggregate);
    assert(rValue && aggregate && sdaiGetMemberCount(aggregate) == 3);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}


{
    //
    //  Schema data
    //      ENTITY MyEntity
    //          MyAttribute : OPTIONAL ...;
    //      END_ENTITY;
    //
    //  Instance data
    //      #101 = MYENTITY($);
    //

    SdaiInstance    myEntityInstance = 0;
    sdaiGetAggrByIndex(sdaiGetEntity(model, "MyEntity"), 0 /* index */, sdaiINSTANCE, &myEntityInstance);
    SdaiAttr    attribute = sdaiGetAttrDefinition(sdaiGetEntity(model, "MyEntity"), "MyAttribute");

    int_t   iValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiINSTANCE, (void*) &strValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiAGGR, (void*) &strValue) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttr(myEntityInstance, attribute, sdaiADB, (void*) &attributeDataBlock) == nullptr);
}