engiSaveModelByStream

This function saves the model as a stream.

Syntax

//
//   Strong typing definition
//
void            engiSaveModelByStream(
                        SdaiModel               model,
                        const void              * callback,
                        int_t                   size
                    );


//
//   Weak typing definition
//
void    __declspec(dllexport) __stdcall   engiSaveModelByStream(
                                                                        int_t                   model,
                                                                        const void              * callback,
                                                                        int_t                   size
                                                                    );
    

Property model

Size: 32 bit / 4 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property callback

Size: 32 bit / 4 byte (reference)
The pointer to the function that will be called within this function. Please look at the examples how to create the callback function and how it will be called. In case this is not possible or complex there is an array call, technically the same call, however the callback function is embedded within the library.

Property size

Size: 32 bit / 4 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 engiSaveModelByStream can be used.

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

const int_t BLOCK_LENGTH_WRITE = 20000; //  no maximum limit

FILE        * myFileWrite = nullptr;

void    __stdcall   WriteCallBackFunction(unsigned char * content, int64_t size)
{
    fwrite(content, (size_t) size, 1, myFileWrite);
}

void    SaveModelByStream(SdaiModel model, wchar_t * fileName)
{
    assert(myFileWrite == nullptr);

    _wfopen_s(&myFileWrite, fileName, L"wb");
    if (&myFileWrite) {
        engiSaveModelByStream(model, &WriteCallBackFunction, BLOCK_LENGTH_WRITE);

        fclose(myFileWrite);
    }
    else {
        assert(false);
    }
}