SaveModelS

This function saves the current model in a stream.

Syntax

public const string enginedll = @"engine.dll";

[DllImport(enginedll, EntryPoint = "SaveModelS")]
public static extern Int64 SaveModelS(Int64 model, [MarshalAs(UnmanagedType.FunctionPtr)] WriteCallBackFunction callback, Int64 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: 64 bit / 8 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 (based on pure API calls)

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

using RDF;      //  include at least engine.cs within your solution

    ...

    public class OUT
    {
        public const int BLOCK_LENGTH_WRITE = 20000;    //  no maximum limit

        public FileStream fs;

        public OUT(Int64 myModel)
        {

            // define a progress callback delegate
            RDF.engine.WriteCallBackFunction callback =
                (value, size) =>
                {
                    byte[] buffer = new byte[size];

                    Marshal.Copy(value, buffer, 0, (int) size);

                    fs.Write(buffer, 0, (int) size);
                };

            fs = File.Open("exportedFile.bin", FileMode.Create);

            RDF.engine.SaveModelS(myModel, callback, BLOCK_LENGTH_WRITE);

            fs.Close();
        } 
    }

    ...