SaveModelS

This function saves the current model in a stream.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall SaveModelS(
            __int64             model,
            const void          * callback,
            __int64             size
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t SaveModelS(
            int64_t             model,
            const void          * callback,
            int64_t             size
        );    

Property model

Size: 64 bit / 8 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: 64 bit / 8 byte (value)
The (maximum) size of the content handled by the callback function.

Example

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

#include "engine/include/engine.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(int64_t model, wchar_t * fileName)
{
    assert(myFileWrite == nullptr);

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

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