engiOpenModelByArray

This function opens the model via an array.
Attribute repository will be ignored, they are their because of backward compatibility.
A handle to the model will be returned, or 0 in case something went wrong.

Syntax

//
//   Strong typing definition
//
SdaiModel       engiOpenModelByArray(
                        SdaiRep                 repository,
                        const unsigned char     * content,
                        int_t                   size,
                        SdaiString              schemaName
                    );

static  inline  SdaiModel   engiOpenModelByArray(
                                    SdaiRep                 repository,
                                    const unsigned char     * content,
                                    int_t                   size,
                                    char                    * schemaName
                                )
{
    return  engiOpenModelByArray(
                    repository,
                    content,
                    size,
                    (SdaiString) schemaName
                );
}

static  inline  SdaiModel   engiOpenModelByArray(
                                    SdaiRep                 repository,
                                    const unsigned char     * content,
                                    SdaiString              schemaName
                                )
{
    return  engiOpenModelByArray(
                    repository,
                    content,
                    strlen((const char*) content),  //    size
                    schemaName
                );
}


//
//   Weak typing definition
//
int_t   __declspec(dllexport) __stdcall engiOpenModelByArray(
                                                int_t                   repository,
                                                const unsigned char     * content,
                                                int_t                   size,
                                                const char              * schemaName
                                            );

static  inline  int_t   engiOpenModelByArray(
                                int_t                   repository,
                                const unsigned char     * content,
                                int_t                   size,
                                char                    * schemaName
                            )
{
    return  engiOpenModelByArray(
                    repository,
                    content,
                    size,
                    (const SdaiString) schemaName
                );
}

static  inline  int_t   engiOpenModelByArray(
                                int_t                   repository,
                                const unsigned char     * content,
                                const char              * schemaName
                            )
{
    return  engiOpenModelByArray(
                    repository,
                    content,
                    strlen((const char*) content),  //    size
                    schemaName
                );
}
    

Property repository

Size: 32 bit / 4 byte (value)
Ignore this attribute, the value will be ignored in the current implementation, present for backwards compatibility.

Property content

Size: 32 bit / 4 byte (reference)
The content of this IO call, the size of the content is defined by attribute size.

Property size

Size: 32 bit / 4 byte (value)
The size of the content as defined in number of bytes.

Property schemaName

Size: 32 bit / 4 byte (reference)
The schema name of the file as available in the file system in ASCII (char *). The given char array will not be adjusted, on each OS the size of a char element is 8 bit / 1 byte.

Example (based on pure API calls)

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

#include    "./include/ifcengine.h"

void    OpenModelByArray(
            )
{
    const std::string model_text{
            "ISO-10303-21;\n"
            "HEADER;\n"
            "FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); \n"
            "FILE_NAME ($, $, (), (), $, $, $);\n"
            "FILE_SCHEMA (('IFC4'));\n"
            "ENDSEC;\n"
            "DATA;\n"
            "#1 = IFCPROPERTYSINGLEVALUE('PropertyName', $, IFCTEXT('test'), #2);\n"
            "#2 = IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);\n"
            "ENDSEC;\n"
            "END-ISO-10303-21;\n"
        };

    SdaiModel   model = engiOpenModelByArray(0, model_text, "");

    if (model) {
        SdaiInteger entityCount = engiGetEntityCount(model), instanceCount = 0;

        std::cout << "entity count (schema): " << entityCount << "\n";

        sdaiCloseModel(model);
    }
}