sdaiAppend

valueType argument to specify what type of data caller wants to put Table 1 shows type of buffer the caller should provide depending on the valueType for sdaiAppend, and it works similarly for all put-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.

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

valueType               C/C++                                                       C#

sdaiINTEGER             int_t val = 123;                                            int_t val = 123;
                        sdaiAppend (aggr, sdaiINTEGER, &val);                       ifcengine.sdaiAppend (aggr, ifcengine.sdaiINTEGER, ref val);

sdaiREAL or sdaiNUMBER  double val = 123.456;                                       double val = 123.456;
                        sdaiAppend (aggr, sdaiREAL, &val);                          ifcengine.sdaiAppend (aggr, ifcengine.sdaiREAL, ref val);

sdaiBOOLEAN             bool val = true;                                            bool val = true;
                        sdaiAppend (aggr, sdaiBOOLEAN, &val);                       ifcengine.sdaiAppend (aggr, ifcengine.sdaiBOOLEAN, ref val);

sdaiLOGICAL             const TCHAR* val = "U";                                     string val = "U";
                        sdaiAppend (aggr, sdaiLOGICAL, val);                        ifcengine.sdaiAppend (aggr, ifcengine.sdaiLOGICAL, val);

sdaiENUM                const TCHAR* val = "NOTDEFINED";                            string val = "NOTDEFINED";
                        sdaiAppend (aggr, sdaiENUM, val);                           ifcengine.sdaiAppend (aggr, ifcengine.sdaiENUM, val);

sdaiBINARY              const TCHAR* val = "0123456ABC";                            string val = "0123456ABC";
                        sdaiAppend (aggr, sdaiBINARY, val);                         ifcengine.sdaiAppend (aggr, ifcengine.sdaiBINARY, val);

sdaiSTRING              const char* val = "My Simple String";                       string val = "My Simple String";
                        sdaiAppend (aggr, sdaiSTRING, val);                         ifcengine.sdaiAppend (aggr, ifcengine.sdaiSTRING, val);

sdaiUNICODE             const wchar_t* val = L"Any Unicode String";                 string val = "Any Unicode String";
                        sdaiAppend (aggr, sdaiUNICODE, val);                        ifcengine.sdaiAppend (aggr, ifcengine.sdaiSTRING, val);

sdaiEXPRESSSTRING       const char* val = "EXPRESS format, i.e. \\X2\\00FC\\X0\\";  string val = "EXPRESS format, i.e. \\X2\\00FC\\X0\\";
                        sdaiAppend (aggr, sdaiEXPRESSSTRING, val);                  ifcengine.sdaiAppend (aggr, ifcengine.sdaiEXPRESSSTRING, val);

sdaiINSTANCE            SdaiInstance val = sdaiCreateInstanceBN (model, "IFCSITE"); int_t val = ifcengine.sdaiCreateInstanceBN (model, "IFCSITE");
                        sdaiAppend (aggr, sdaiINSTANCE, val);                       ifcengine.sdaiAppend (aggr, ifcengine.sdaiINSTANCE, val);

sdaiAGGR                SdaiAggr val = sdaiCreateAggr (inst, 0);                    int_t val = sdaiCreateAggr (inst, 0);
                        sdaiAppend (val, sdaiINSTANCE, inst);                       ifcengine.sdaiAppend (val, ifcengine.sdaiINSTANCE, inst);
                        sdaiAppend (aggr, sdaiAGGR, val);                           ifcengine.sdaiAppend (aggr, ifcengine.sdaiAGGR, val);

sdaiADB                 int_t integerValue = 123;                                   int_t integerValue = 123;   
                        SdaiADB val = sdaiCreateADB (sdaiINTEGER, &integerValue);   int_t val = ifcengine.sdaiCreateADB (ifcengine.sdaiINTEGER, ref integerValue);
                        sdaiPutADBTypePath (val, 1, "INTEGER");                     ifcengine.sdaiPutADBTypePath (val, 1, "INTEGER");
                        sdaiAppend (aggr, sdaiADB, val);                            ifcengine.sdaiAppend (aggr, ifcengine.sdaiADB, val);    
                        sdaiDeleteADB (val);                                        ifcengine.sdaiDeleteADB (val);
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          .           .           .           .           .           .           .           .           .
sdaiREAL             .          Yes          .           .           .           .           .           .           .           .
sdaiNUMBER           .          Yes          .           .           .           .           .           .           .           .
sdaiBOOLEAN          .           .          Yes          .           .           .           .           .           .           .
sdaiLOGICAL          .           .          Yes         Yes          .           .           .           .           .           .
sdaiENUM             .           .          Yes         Yes         Yes          .           .           .           .           .
sdaiBINARY           .           .           .           .           .          Yes          .           .           .           .
sdaiSTRING           .           .           .           .           .           .          Yes          .           .           .
sdaiUNICODE          .           .           .           .           .           .          Yes          .           .           .
sdaiEXPRESSSTRING    .           .           .           .           .           .          Yes          .           .           .
sdaiINSTANCE         .           .           .           .           .           .           .          Yes          .           .
sdaiAGGR             .           .           .           .           .           .           .           .          Yes          .
sdaiADB             Yes         Yes         Yes         Yes         Yes         Yes         Yes         Yes         Yes          .

Syntax

//
//   Strong typing definition
//
void            sdaiAppend(
                        const SdaiAggr          aggregate,
                        SdaiPrimitiveType       valueType,
                        const void              * value
                    );

static  inline  void    sdaiAppend(
                                const SdaiAggr          aggregate,
                                SdaiPrimitiveType       valueType,
                                SdaiInstance            value
                            )
{
    return  sdaiAppend(
                    aggregate,
                    valueType,
                    (const void*) value
                );
}


//
//   Weak typing definition
//
void    __declspec(dllexport) __stdcall sdaiAppend(
                                                const int_t             * aggregate,
                                                int_t                   valueType,
                                                const void              * value
                                            );

static  inline  void    sdaiAppend(
                                const int_t             * aggregate,
                                int_t                   valueType,
                                int_t                   value
                            )
{
    return  sdaiAppend(
                    aggregate,
                    valueType,
                    (const void*) value
                );
}
    

Property aggregate

Size: 64 bit / 8 byte (reference)
...

Property valueType

Size: 64 bit / 8 byte (value)
...

Property value

Size: 64 bit / 8 byte (reference)
...

Example (based on pure API calls)

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

#include    "./include/ifcengine.h"
//
//  Created result when stored as IFC:
//  #31313 = IFCPOSTALADDRESS($, $, $, $, ('RDF Ltd.', 'Main Office'), '32', 'Bankya', 'Sofia', '1320', 'Bulgaria');
//
int_t   ifcPostalAddressInstance = sdaiCreateInstanceBN(model, "IFCPOSTALADDRESS");

int_t   * addressLines = sdaiCreateAggrBN(ifcPostalAddressInstance, "AddressLines");
sdaiAppend((int64_t) addressLines, sdaiSTRING, "RDF Ltd.");
sdaiAppend((int64_t) addressLines, sdaiSTRING, "Main Office");

sdaiPutAttrBN(ifcPostalAddressInstance, "PostalBox", sdaiSTRING, "32");
sdaiPutAttrBN(ifcPostalAddressInstance, "Town", sdaiSTRING, "Bankya");
sdaiPutAttrBN(ifcPostalAddressInstance, "Region", sdaiSTRING, "Sofia");         //  It is allowed to mix sdaiUNICODE and sdaiSTRING
sdaiPutAttrBN(ifcPostalAddressInstance, "PostalCode", sdaiUNICODE, L"1320");    //  as long as each call is consitent in itself.
sdaiPutAttrBN(ifcPostalAddressInstance, "Country", sdaiSTRING, "Bulgaria");