sdaiGetAttrBN

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 sdaiGetAttrBN, 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 sdaiGetAttrBN but valid for all get-functions)

valueType               C/C++                                                       C#

sdaiINTEGER             int_t val;                                                  int_t val;
                        sdaiGetAttrBN (inst, "attrName", sdaiINTEGER, &val);        ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiINTEGER, out val);

sdaiREAL or sdaiNUMBER  double val;                                                 double val;
                        sdaiGetAttrBN (inst, "attrName", sdaiREAL, &val);           ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiREAL, out val);

sdaiBOOLEAN             bool val;                                                   bool val;
                        sdaiGetAttrBN (inst, "attrName", sdaiBOOLEAN, &val);        ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiBOOLEAN, out val);

sdaiLOGICAL             const TCHAR* val;                                           string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiLOGICAL, &val);        ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiLOGICAL, out val);

sdaiENUM                const TCHAR* val;                                           string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiENUM, &val);           ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiENUM, out val);

sdaiBINARY              const TCHAR* val;                                           string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiBINARY, &val);         ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiBINARY, out val);

sdaiSTRING              const char* val;                                            string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiSTRING, &val);         ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiSTRING, out val);

sdaiUNICODE             const wchar_t* val;                                         string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiUNICODE, &val);        ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiSTRING, out val);

sdaiEXPRESSSTRING       const char* val;                                            string val;
                        sdaiGetAttrBN (inst, "attrName", sdaiEXPRESSSTRING, &val);  ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiEXPRESSSTRING, out val);

sdaiINSTANCE            SdaiInstance val;                                           int_t val;
                        sdaiGetAttrBN (inst, "attrName", sdaiINSTANCE, &val);       ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiINSTANCE, out val);

sdaiAGGR                SdaiAggr aggr;                                              int_t aggr;
                        sdaiGetAttrBN (inst, "attrName", sdaiAGGR, &aggr);          ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiINSTANCE, out aggr);

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

                        SdaiADB adb = nullptr;  //  it is important to initialize
                        sdaiGetAttrBN (inst, "attrName", 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. Technically sdaiGetAttrBN will transform into the following call
    sdaiGetAttr(
            instance,
            sdaiGetAttrDefinition(
                    sdaiGetInstanceType(
                            instance
                        ),
                    attributeName
                ),
            valueType,
            value
        );

Syntax

//
//   Strong typing definition
//
void            * sdaiGetAttrBN(
                        SdaiInstance            instance,
                        const char              * attributeName,
                        SdaiPrimitiveType       valueType,
                        void                    * value
                    );

static  inline  void    * sdaiGetAttrBN(
                                SdaiInstance            instance,
                                char                    * attributeName,
                                SdaiPrimitiveType       valueType,
                                void                    * value
                            )
{
    return  sdaiGetAttrBN(
                    instance,
                    (const char*) attributeName,
                    valueType,
                    value
                );
}


//
//   Weak typing definition
//
void    __declspec(dllexport) * __stdcall   sdaiGetAttrBN(
                                                    int_t                   instance,
                                                    const char              * attributeName,
                                                    int_t                   valueType,
                                                    void                    * value
                                                );

static  inline  void    * sdaiGetAttrBN(
                                int_t                   instance,
                                char                    * attributeName,
                                int_t                   valueType,
                                void                    * value
                            )
{
    return  sdaiGetAttrBN(
                    instance,
                    (const char*) attributeName,
                    valueType,
                    value
                );
}
    

Property instance

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

Property attributeName

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

    int_t   iValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue);
    assert(rValue && iValue == 1);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue);
    assert(rValue && dValue == 1.23);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue);
    assert(rValue && dValue == 1.23);

    ..

    bool    bValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiSTRING, (void*) &strValue);
    assert(rValue && atof(strValue) == 1.23);

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiUNICODE, (void*) &strValue);
    assert(rValue && wtof(strValue) == 1.23);

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && atof(strValue) == 1.23);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue);
    assert(rValue && iValue == 123);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue);
    assert(rValue && dValue == 123.);

    ..

    double  dValue;
    void    * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue);
    assert(rValue && dValue == 123.);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    void        * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiSTRING, (void*) &strValue);
    assert(rValue && atoi(strValue) == 1.23);

    ..

    const wchar_t   * strValue;
    void            * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiUNICODE, (void*) &strValue);
    assert(rValue && wtoi(strValue) == 1.23);

    ..
    
    const char  * strValue;
    void        * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiEXPRESSSTRING, (void*) &strValue);
    assert(rValue && atoi(strValue) == 123);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

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

    ..

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

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

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

    ..

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

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

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

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

    ..

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

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

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

    ..

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

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

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

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

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

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

    ..

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

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

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

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

    ..

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

    ..

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

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

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);
    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

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

    ..

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

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

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    void            * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &instValue);
    assert(rValue && instValue == myEntityInstance);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &strValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    void        * rValue = sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &aggregate);
    assert(rValue && aggregate && sdaiGetMemberCount(aggregate) == 3);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", 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);

    int_t   iValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINTEGER, (void*) &iValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiREAL, (void*) &dValue) == nullptr);

    ..

    double  dValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiNUMBER, (void*) &dValue) == nullptr);

    ..

    bool    bValue; 
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBOOLEAN, (void*) &bValue) == nullptr);
    
    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiLOGICAL, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiENUM, (void*) &strValue) == nullptr);

    ..

    const char * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiBINARY, (void*) &strValue) == nullptr);

    ..

    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiSTRING, (void*) &strValue) == nullptr);

    ..

    const wchar_t   * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiUNICODE, (void*) &strValue) == nullptr);

    ..
    
    const char  * strValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiEXPRESSSTRING, (void*) &strValue) == nullptr);

    ..

    SdaiInstance    instValue;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiINSTANCE, (void*) &strValue) == nullptr);

    ..

    SdaiAggr    aggregate;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiAGGR, (void*) &strValue) == nullptr);

    ..

    SdaiADB     attributeDataBlock = nullptr;
    assert(sdaiGetAttrBN(myEntityInstance, "MyAttribute", sdaiADB, (void*) &attributeDataBlock) == nullptr);
}