OpenModelA

This function opens the model via an array.
References inside to other ontologies will be included.
A handle to the model will be returned, or 0 in case something went wrong.

Syntax

//
//   Strong typing definition
//
OwlModel        OpenModelA(
                        const unsigned char     * content,
                        int64_t                 size
                    );

static  inline  OwlModel    OpenModelA(
                                    const unsigned char     * content
                                )
{
    return  OpenModelA(
                    content,
                    strlen((const char*) content)   //    size
                );
}


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall OpenModelA(
                                                const unsigned char     * content,
                                                int64_t                 size
                                            );

static  inline  int64_t OpenModelA(
                                const unsigned char     * content
                            )
{
    return  OpenModelA(
                    content,
                    strlen((const char*) content)   //    size
                );
}
    

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: 64 bit / 8 byte (value)
The size of the content as defined in number of bytes.

Example (based on pure API calls)

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

#include    "./include/engine.h"
#include    <assert.h>

int64_t OpenModelByArray(wchar_t * fileName)
{
    FILE    * myFileRead = nullptr;

    _wfopen_s(&myFileRead, fileName, L"rb");
    if (&myFileRead) {
        fseek(myFileRead, 0L, SEEK_END);
        int_t   size = ftell(myFileRead);
        rewind(myFileRead);

        int64_t model;
        if (size) {
            unsigned char   * content = new unsigned char[size];
            size = fread(content, 1, size, myFileRead);

            model = OpenModelA(content, (int64_t) size);
            delete[] content;
        }
        else {
            assert(false);

            model = OpenModelA(0, 0);
        }

        fclose(myFileRead);
        myFileRead = nullptr;

        return  model;
    }

    assert(false);
    return  0;
}