OpenModelS

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

Syntax

public const string EngineDLL = @"engine.dll";[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate Int64 ReadCallBackFunction(IntPtr value);

[DllImport(EngineDLL, EntryPoint = "OpenModelS")]
public static extern Int64 OpenModelS([MarshalAs(UnmanagedType.FunctionPtr)] ReadCallBackFunction callback);    

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.

Example

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

using Engine;

    ...

    public class IN
    {
        public const int BLOCK_LENGTH_READ = 65535; // MAX: 65535

        public FileStream fs;

        public Int64 myModel = 0;

        public IN()
        {

            // define a progress callback delegate
            Engine.x86_64.ReadCallBackFunction callback =
                (value) =>
                {
                    byte[] buffer = new byte[BLOCK_LENGTH_READ]; 

                    int size = fs.Read(buffer, 0, BLOCK_LENGTH_READ);

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

                    return (Int64) size;
                };

            fs = File.Open("exampleFile.bin", FileMode.Open);
            
            myModel = Engine.x86_64.OpenModelS(callback);

            fs.Close();
        } 
    }

    ...