forked from I-Sokolov/RDFGeomApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine.cs
3487 lines (3048 loc) · 187 KB
/
engine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace RDF
{
/// <summary>
/// ENGINE FORMAT SPECIFICATION
/// </summary>
public class FORMAT
{
// control precision / data size
/// <summary>Vertex items returned as double (8 byte/64 bit) else - as float (4 byte/32 bit)</summary>
public const Int64 SIZE_VERTEX_DOUBLE = (1<<2);
/// <summary>Index items returned as int64_t (8 byte/64 bit) (only available in 64 bit mode) - else as int32_t (4 byte/32 bit)</summary>
public const Int64 SIZE_INDEX_INT64 = (1<<3);
// control vertex data
/// <summary>Vertex contains 3D point info</summary>
public const Int64 VERTEX_POINT = (1<<4);
/// <summary>Vertex contains normal info</summary>
public const Int64 VERTEX_NORMAL = (1<<5);
/// <summary>Vertex contains first 2D texture info</summary>
public const Int64 VERTEX_TEXTURE_UV = (1<<6);
/// <summary>Vertex does contain tangent vector for first texture</summary>
public const Int64 VERTEX_TEXTURE_TANGENT = (1<<28);
/// <summary>Vertex does contain binormal vector for first texture</summary>
public const Int64 VERTEX_TEXTURE_BINORMAL = (1<<29);
/// <summary>Vertex contains second 2D texture info</summary>
public const Int64 VERTEX_TEXTURE2_UV = (1<<7);
/// <summary>Vertex does contain tangent vector for second texture (only 64 bit platform)</summary>
public const Int64 VERTEX_TEXTURE2_TANGENT = (1<<30);
/// <summary>Vertex does contain binormal vector for second texture (only 64 bit platform)</summary>
public const Int64 VERTEX_TEXTURE2_BINORMAL = (1<<31);
/// <summary>Vertex does contain Ambient color information</summary>
public const Int64 VERTEX_COLOR_AMBIENT = (1<<24);
/// <summary>Vertex does contain Diffuse color information</summary>
public const Int64 VERTEX_COLOR_DIFFUSE = (1<<25);
/// <summary>Vertex does contain Emissive color information</summary>
public const Int64 VERTEX_COLOR_EMISSIVE = (1<<26);
/// <summary>Vertex does contain Specular color information</summary>
public const Int64 VERTEX_COLOR_SPECULAR = (1<<27);
// control CalculateInstance behaviour
/// <summary>Object form triangles are exported (effective if instance contains faces and/or solids)(triangulated surface representation)</summary>
public const Int64 EXPORT_TRIANGLES = (1<<8);
/// <summary>Object polygon lines are exported (effective if instance contains line representations)</summary>
public const Int64 EXPORT_LINES = (1<<9);
/// <summary>Object points are exported (effective if instance contains point representations)</summary>
public const Int64 EXPORT_POINTS = (1<<10);
/// <summary>Object face polygon lines (dense wireframe) are exported (requires FORMAT_FLAG_CONTAINS_TRIANGLES)</summary>
public const Int64 EXPORT_FACE_POLYGONS = (1<<12);
/// <summary>Object conceptual face polygon lines (wireframe) are exported </summary>
public const Int64 EXPORT_CONCEPTUAL_FACE_POLYGONS = (1<<13);
/// <summary>Polygon lines (wireframe) exported as tuples (edges) - else as list (loop)</summary>
public const Int64 EXPORT_POLYGONS_AS_TUPLES = (1<<14);
/// <summary>Normals are exported to be in line with the original semantic form description (orthogonal to conceprual face, could be non orthogonal to the planar face or triangle) - else all normals of triangles are transformed orthogonal to the palnar face or triangle they belong to</summary>
public const Int64 EXPORT_ADVANCED_NORMALS = (1<<15);
/// <summary>Where possible DirectX compatibility is given to exported data. Unsets FORMAT_FLAG_OPENGL, FORMAT_FLAG_VERSION_0001, FORMAT_FLAG_VERSION_0010</summary>
public const Int64 EXPORT_DIRECTX = (1<<16);
/// <summary>Where possible OpenGL compatibility is given to exported data. Unsets FORMAT_FLAG_DIRECTX. Sets FORMAT_FLAG_VERSION_0001, FORMAT_FLAG_VERSION_0010</summary>
public const Int64 EXPORT_OPENGL = (1<<17);
/// <summary>Every face has exactly one opposite face (normally both index and vertex array are doubled in size)</summary>
public const Int64 EXPORT_DOUBLE_SIDED = (1<<18);
/// <summary>Opposite Triangle Rotation (RHS as expected by OpenGL) - else Standard Triangle Rotation (LHS as expected by DirectX)</summary>
public const Int64 EXPORT_VERSION_0001 = (1<<20);
/// <summary>X, Y, Z (nX, nY, nZ) formatted as , i.e. X, -Z, Y (nX, -nZ, nY) considering internal concepts (OpenGL) - else X, Y, Z (nX, nY, nZ) formatted as considering internal concepts</summary>
public const Int64 EXPORT_VERSION_0010 = (1<<21);
public const Int64 EXPORT_VERSION_0100 = (1<<22);
public const Int64 EXPORT_VERSION_1000 = (1<<23);
}
/// <summary>
/// Color pack/unpack conversion methods
/// </summary>
public class COLOR
{
/// <summary> get color from its components in range 0..255 </summary>
public static UInt32 RGBW255(byte r, byte g, byte b, byte w) { return (UInt32)r << 24 | (UInt32)g << 16 | (UInt32)b << 8 | (UInt32)w; }
/// <summary>get color from its components in range 0..1</summary>
public static UInt32 RGBW(double r, double g, double b, double w) { return RGBW255((byte)(r * 255), (byte)(g * 255), (byte)(b * 255), (byte)(w * 255)); }
/// <summary>get color red component in range 0..255</summary>
public static byte GET_R255(UInt32 clr) { return (byte)((clr >> 24) & 0xFF); }
/// <summary>get color green component in range 0..255</summary>
public static byte GET_G255(UInt32 clr) { return (byte)((clr >> 16) & 0xFF); }
/// <summary>get color blue component in range 0..255</summary>
public static byte GET_B255(UInt32 clr) { return (byte)((clr >> 8) & 0xFF); }
/// <summary>get color transparency in range 0..255</summary>
public static byte GET_W255(UInt32 clr) { return (byte)(clr & 0xFF); }
/// <summary>get color red component in range 0..1</summary>
public static double GET_R(UInt32 clr) { return GET_R255(clr) / 255.0; }
/// <summary>get color green component in range 0..1</summary>
public static double GET_G(UInt32 clr) { return GET_G255(clr) / 255.0; }
/// <summary>get color blue component in range 0..1</summary>
public static double GET_B(UInt32 clr) { return GET_B255(clr) / 255.0; }
/// <summary>get color trancparency in range 0..1</summary>
public static double GET_W(UInt32 clr) { return GET_W255(clr) / 255.0; }
/// <summary>get color from array of 4 components in range 0..255</summary>
public static UInt32 RGBW255(byte[] r) { return RGBW255(r[0], r[1], r[2], r[3]); }
/// <summary>get color from array of 4 components in range 0..1</summary>
public static UInt32 RGBW(double[] r) { return RGBW(r[0], r[1], r[2], r[3]); }
/// <summary>get color comonents in range 0..255 to arry of 4 elements</summary>
public static byte[] GET_COMPONENTS255(UInt32 clr)
{
var r = new byte[4];
r[0] = GET_R255(clr);
r[1] = GET_G255(clr);
r[2] = GET_B255(clr);
r[3] = GET_W255(clr);
return r;
}
/// <summary>get color comonents in range 0..1 to arry of 4 elements</summary>
public static double[] GET_COMPONENTS(UInt32 clr)
{
var r = new double[4];
r[0] = GET_R(clr);
r[1] = GET_G(clr);
r[2] = GET_B(clr);
r[3] = GET_W(clr);
return r;
}
}//COLOR
class engine
{
public const Int64 OBJECTPROPERTY_TYPE = 1;
public const Int64 DATATYPEPROPERTY_TYPE_BOOLEAN = 2;
public const Int64 DATATYPEPROPERTY_TYPE_CHAR = 3;
public const Int64 DATATYPEPROPERTY_TYPE_INTEGER = 4;
public const Int64 DATATYPEPROPERTY_TYPE_DOUBLE = 5;
public const string enginedll = @"engine.dll";
//
// Meta information API Calls
//
/// <summary>
/// GetRevision (http://rdf.bg/gkdoc/CS64/GetRevision.html)
///
/// Returns the revision number.
/// The timeStamp is generated by the SVN system used during development.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetRevision")]
public static extern Int64 GetRevision(out IntPtr timeStamp);
public static Int64 GetRevision()
{
IntPtr timeStamp = IntPtr.Zero;
return RDF.engine.GetRevision(out timeStamp);
}
/// <summary>
/// GetRevisionW (http://rdf.bg/gkdoc/CS64/GetRevisionW.html)
///
/// Returns the revision number.
/// The timeStamp is generated by the SVN system used during development.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetRevisionW")]
public static extern Int64 GetRevisionW(out IntPtr timeStamp);
public static Int64 GetRevisionW()
{
IntPtr timeStamp = IntPtr.Zero;
return RDF.engine.GetRevisionW(out timeStamp);
}
/// <summary>
/// GetProtection (http://rdf.bg/gkdoc/CS64/GetProtection.html)
///
/// This call is required to be called to enable the DLL to work if protection is active.
///
/// Returns the number of days (incl. this one) that this version is still active or 0 if no protection is embedded.
/// In case no days are left and protection is active this call will return -1.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetProtection")]
public static extern Int64 GetProtection();
/// <summary>
/// GetEnvironment (http://rdf.bg/gkdoc/CS64/GetEnvironment.html)
///
/// Returns the revision number similar to the call GetRevision.
/// The environment variables will show known environment variables
/// and if they are set, for example environment variables ABC known
/// and unset and DEF as well as GHI known and set:
/// environmentVariables = "ABC:F;DEF:T;GHI:T"
/// Development variables are depending on the build environment
/// As an example in windows systems where Visual Studio is used:
/// developmentVariables = "...."
/// </summary>
[DllImport(enginedll, EntryPoint = "GetEnvironment")]
public static extern Int64 GetEnvironment(out IntPtr environmentVariables, out IntPtr developmentVariables);
/// <summary>
/// GetEnvironmentW (http://rdf.bg/gkdoc/CS64/GetEnvironmentW.html)
///
/// Returns the revision number similar to the call GetRevision[W].
/// The environment variables will show known environment variables
/// and if they are set, for example environment variables ABC known
/// and unset and DEF as well as GHI known and set:
/// environmentVariables = "ABC:F;DEF:T;GHI:T"
/// Development variables are depending on the build environment
/// As an example in windows systems where Visual Studio is used:
/// developmentVariables = "...."
/// </summary>
[DllImport(enginedll, EntryPoint = "GetEnvironmentW")]
public static extern Int64 GetEnvironmentW(out IntPtr environmentVariables, out IntPtr developmentVariables);
/// <summary>
/// SetAssertionFile (http://rdf.bg/gkdoc/CS64/SetAssertionFile.html)
///
/// This function sets the file location where internal assertions should be written to.
/// If the file name is not set (default) many internal control procedures are not executed
/// and the code will be faster.
/// </summary>
[DllImport(enginedll, EntryPoint = "SetAssertionFile")]
public static extern void SetAssertionFile(string fileName);
[DllImport(enginedll, EntryPoint = "SetAssertionFile")]
public static extern void SetAssertionFile(byte[] fileName);
/// <summary>
/// SetAssertionFileW (http://rdf.bg/gkdoc/CS64/SetAssertionFileW.html)
///
/// This function sets the file location where internal assertions should be written to.
/// If the file name is not set (default) many internal control procedures are not executed
/// and the code will be faster.
/// </summary>
[DllImport(enginedll, EntryPoint = "SetAssertionFileW")]
public static extern void SetAssertionFileW(string fileName);
[DllImport(enginedll, EntryPoint = "SetAssertionFileW")]
public static extern void SetAssertionFileW(byte[] fileName);
/// <summary>
/// GetAssertionFile (http://rdf.bg/gkdoc/CS64/GetAssertionFile.html)
///
/// This function gets the file location as stored/set internally where internal assertions should be written to.
/// It works independent if the file location is set through SetAssertionFile() or SetAssertionFileW().
/// </summary>
[DllImport(enginedll, EntryPoint = "GetAssertionFile")]
public static extern void GetAssertionFile(out IntPtr fileName);
public static string GetAssertionFile()
{
IntPtr fileName = IntPtr.Zero;
RDF.engine.GetAssertionFile(out fileName);
return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(fileName);
}
/// <summary>
/// GetAssertionFileW (http://rdf.bg/gkdoc/CS64/GetAssertionFileW.html)
///
/// This function gets the file location as stored/set internally where internal assertions should be written to.
/// It works independent if the file location is set through SetAssertionFile() or SetAssertionFileW().
/// </summary>
[DllImport(enginedll, EntryPoint = "GetAssertionFileW")]
public static extern void GetAssertionFileW(out IntPtr fileName);
public static string GetAssertionFileW()
{
IntPtr fileName = IntPtr.Zero;
RDF.engine.GetAssertionFileW(out fileName);
return System.Runtime.InteropServices.Marshal.PtrToStringUni(fileName);
}
/// <summary>
/// SetCharacterSerialization (http://rdf.bg/gkdoc/CS64/SetCharacterSerialization.html)
///
/// This call defines how characters for names, strings will be serializaed and how
/// they are expected to be serialized. An exception are the Open / Import / Save calls,
/// these calls have a fixed way of serialization of path / file names.
///
/// If the encoding value is non-zero the following values are possible (if zero encoding is kept as defined)
/// 32 [default] encoding ignored
/// 64 encoding Windows 1250
/// 65 encoding Windows 1251
/// 66 encoding Windows 1252
/// 67 encoding Windows 1253
/// 68 encoding Windows 1254
/// 69 encoding Windows 1255
/// 70 encoding Windows 1256
/// 71 encoding Windows 1257
/// 72 encoding Windows 1258
/// 128 encoding ISO8859 1
/// 129 encoding ISO8859 2
/// 130 encoding ISO8859 3
/// 131 encoding ISO8859 4
/// 132 encoding ISO8859 5
/// 133 encoding ISO8859 6
/// 134 encoding ISO8859 7
/// 135 encoding ISO8859 8
/// 136 encoding ISO8859 9
/// 137 encoding ISO8859 10
/// 138 encoding ISO8859 11
/// encoding ISO8859 12 => does not exist
/// 140 encoding ISO8859 13
/// 141 encoding ISO8859 14
/// 142 encoding ISO8859 15
/// 143 encoding ISO8859 16
/// 160 encoding MACINTOSH CENTRAL EUROPEAN
/// 192 encoding SHIFT JIS X 213
///
/// The wcharBitSizeOverride value overrides the OS based size of wchar_t, the following values can be applied:
/// 0 wcharBitSizeOverride is ignored, override is not changed
/// 16 wchar_t interpreted as being 2 bytes wide (size of wchar_t in bits)
/// 32 wchar_t interpreted as being 4 bytes wide (size of wchar_t in bits)
/// Any other value will reset the override and wchar_t will follow the OS based size of wchar_t
/// Note: this setting is independent from the model, this call can also be called without a model defined.
///
/// The ascii value defines
/// true [default] 8 bit serializatiom (size of char returned in bits)
/// false 16/32 bit serialization (depending on the operating system, i.e. sizeof of wchar_t returned in number of bits)
/// Note: this setting is model-dependent and requires a model present to have any effect.
///
/// The return value is the size of a single character in bits, i.e. 1 byte is 8 bits, the value for a wchar_t can be 16 or 32 depending on settings and operating system
/// </summary>
[DllImport(enginedll, EntryPoint = "SetCharacterSerialization")]
public static extern Int64 SetCharacterSerialization(Int64 model, Int64 encoding, Int64 wcharBitSizeOverride, byte ascii);
/// <summary>
/// GetCharacterSerialization (http://rdf.bg/gkdoc/CS64/GetCharacterSerialization.html)
///
/// This call retrieves the values as set by
///
/// The returns the size of a single character in bits, i.e. 1 byte is 8 bits, this can be 8, 16 or 32 depending on settings and operating system
/// </summary>
[DllImport(enginedll, EntryPoint = "GetCharacterSerialization")]
public static extern Int64 GetCharacterSerialization(Int64 model, out Int64 encoding, out byte ascii);
/// <summary>
/// SetModellingStyle (http://rdf.bg/gkdoc/CS64/SetModellingStyle.html)
///
/// This call sets the modelling style.
/// </summary>
[DllImport(enginedll, EntryPoint = "SetModellingStyle")]
public static extern void SetModellingStyle(Int64 model, Int64 setting, Int64 mask);
/// <summary>
/// GetModellingStyle (http://rdf.bg/gkdoc/CS64/GetModellingStyle.html)
///
/// This call gets the modelling style.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetModellingStyle")]
public static extern Int64 GetModellingStyle(Int64 model, Int64 mask);
/// <summary>
/// AbortModel (http://rdf.bg/gkdoc/CS64/AbortModel.html)
///
/// This function abort running processes for a model. It can be used when a task takes more time than
/// expected / available, or in case the requested results are not relevant anymore.
/// </summary>
[DllImport(enginedll, EntryPoint = "AbortModel")]
public static extern Int64 AbortModel(Int64 model, Int64 setting);
/// <summary>
/// GetSessionMetaInfo (http://rdf.bg/gkdoc/CS64/GetSessionMetaInfo.html)
///
/// This function is meant for debugging purposes and return statistics during processing.
/// The return value represents the number of active models within the session (or zero if the model was not recognized).
/// </summary>
[DllImport(enginedll, EntryPoint = "GetSessionMetaInfo")]
public static extern Int64 GetSessionMetaInfo(out Int64 allocatedBlocks, out Int64 allocatedBytes, out Int64 nonUsedBlocks, out Int64 nonUsedBytes);
/// <summary>
/// GetModelMetaInfo (http://rdf.bg/gkdoc/CS64/GetModelMetaInfo.html)
///
/// This function is meant for debugging purposes and return statistics during processing.
/// The return value represents the number of active models within the session (or zero if the model was not recognized).
/// </summary>
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, out Int64 activeClasses, out Int64 removedClasses, out Int64 activeProperties, out Int64 removedProperties, out Int64 activeInstances, out Int64 removedInstances, out Int64 inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, out Int64 activeClasses, out Int64 removedClasses, out Int64 activeProperties, out Int64 removedProperties, IntPtr activeInstances, IntPtr removedInstances, IntPtr inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, out Int64 activeClasses, out Int64 removedClasses, IntPtr activeProperties, IntPtr removedProperties, out Int64 activeInstances, out Int64 removedInstances, out Int64 inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, out Int64 activeClasses, out Int64 removedClasses, IntPtr activeProperties, IntPtr removedProperties, IntPtr activeInstances, IntPtr removedInstances, IntPtr inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, IntPtr activeClasses, IntPtr removedClasses, out Int64 activeProperties, out Int64 removedProperties, out Int64 activeInstances, out Int64 removedInstances, out Int64 inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, IntPtr activeClasses, IntPtr removedClasses, out Int64 activeProperties, out Int64 removedProperties, IntPtr activeInstances, IntPtr removedInstances, IntPtr inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, IntPtr activeClasses, IntPtr removedClasses, IntPtr activeProperties, IntPtr removedProperties, out Int64 activeInstances, out Int64 removedInstances, out Int64 inactiveInstances);
[DllImport(enginedll, EntryPoint = "GetModelMetaInfo")]
public static extern Int64 GetModelMetaInfo(Int64 model, IntPtr activeClasses, IntPtr removedClasses, IntPtr activeProperties, IntPtr removedProperties, IntPtr activeInstances, IntPtr removedInstances, IntPtr inactiveInstances);
/// <summary>
/// GetInstanceMetaInfo (http://rdf.bg/gkdoc/CS64/GetInstanceMetaInfo.html)
///
/// This function is meant for debugging purposes and return statistics during processing.
/// The return value represents the number of active instances within the model (or zero if the instance was not recognized).
/// </summary>
[DllImport(enginedll, EntryPoint = "GetInstanceMetaInfo")]
public static extern Int64 GetInstanceMetaInfo(Int64 owlInstance, out Int64 allocatedBlocks, out Int64 allocatedBytes);
[DllImport(enginedll, EntryPoint = "GetInstanceMetaInfo")]
public static extern Int64 GetInstanceMetaInfo(Int64 owlInstance, out Int64 allocatedBlocks, IntPtr allocatedBytes);
[DllImport(enginedll, EntryPoint = "GetInstanceMetaInfo")]
public static extern Int64 GetInstanceMetaInfo(Int64 owlInstance, IntPtr allocatedBlocks, out Int64 allocatedBytes);
[DllImport(enginedll, EntryPoint = "GetInstanceMetaInfo")]
public static extern Int64 GetInstanceMetaInfo(Int64 owlInstance, IntPtr allocatedBlocks, IntPtr allocatedBytes);
/// <summary>
/// GetSmoothness (http://rdf.bg/gkdoc/CS64/GetSmoothness.html)
///
/// This function returns the smoothness of a line or surface.
/// In case the smoothness can be defined the degree will get assigned either
/// 0 - continuous curve / surface (i.e. degree 9)
/// 1 - the direction of the curve / surface is gradually changing (i.e. degree 1)
/// 2 - the change of direction of the curve / surface is gradually changing (i.e. degree 2)
/// In return value of this function retuns the dimension of the found smoothness:
/// 0 - smoothness could not be defined
/// 1 - found the smoothness of a curve
/// 2 - found the smoothness of a surface
/// </summary>
[DllImport(enginedll, EntryPoint = "GetSmoothness")]
public static extern Int64 GetSmoothness(Int64 owlInstance, out Int64 degree);
/// <summary>
/// AddState (http://rdf.bg/gkdoc/CS64/AddState.html)
///
/// This call will integrate the current state information into the model.
///
/// Model should be non-zero.
///
/// If owlInstance is given the state is only applied on the owlInstance and all its children.
/// If owlInstance is zero the state is applied on all owlInstances within a model.
/// </summary>
[DllImport(enginedll, EntryPoint = "AddState")]
public static extern void AddState(Int64 model, Int64 owlInstance);
/// <summary>
/// GetModel (http://rdf.bg/gkdoc/CS64/GetModel.html)
///
/// </summary>
[DllImport(enginedll, EntryPoint = "GetModel")]
public static extern Int64 GetModel(Int64 owlInstance);
/// <summary>
/// OrderedHandles (http://rdf.bg/gkdoc/CS64/OrderedHandles.html)
///
/// This call can be used in two ways. The optional arguments classCnt,
/// propertyCnt and instanceCnt can be used to get the total amount of active classes,
/// properies and instances available within the model.
///
/// The setting and mask can be used to order the handles given for classes,
/// properties and instances.
/// 1 - if set this will number all classes with possible values [1 .. classCnt]
/// 2 - if set this will number all classes with possible values [1 .. propertyCnt]
/// 4 - if set this will number all classes with possible values [1 .. instanceCnt]
///
/// Note: when enabling ordered handles be aware that classes, properties and instances
/// can share the same handles, using the correct argument cannot be checked anymore
/// by the library itself. This could result in crashes in case of incorrect assignments
/// by the hosting application.
/// Note: internally there is no performance gain / loss. This is purely meant for situations
/// where the hosting application can benefit performance wise from having an ordered list.
/// Note: use in combination with other libraries is not adviced, i.e. when combined with the
/// IFC generation from the IFC Engine component for example
/// </summary>
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, out Int64 classCnt, out Int64 propertyCnt, out Int64 instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, out Int64 classCnt, out Int64 propertyCnt, IntPtr instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, out Int64 classCnt, IntPtr propertyCnt, out Int64 instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, out Int64 classCnt, IntPtr propertyCnt, IntPtr instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, IntPtr classCnt, out Int64 propertyCnt, out Int64 instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, IntPtr classCnt, out Int64 propertyCnt, IntPtr instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, IntPtr classCnt, IntPtr propertyCnt, out Int64 instanceCnt, Int64 setting, Int64 mask);
[DllImport(enginedll, EntryPoint = "OrderedHandles")]
public static extern void OrderedHandles(Int64 model, IntPtr classCnt, IntPtr propertyCnt, IntPtr instanceCnt, Int64 setting, Int64 mask);
/// <summary>
/// PeelArray (http://rdf.bg/gkdoc/CS64/PeelArray.html)
///
/// This function introduces functionality that is missing or complicated in some programming languages.
/// The attribute inValue is a reference to an array of references. The attribute outValue is a reference to the same array,
/// however a number of elements earlier or further, i.e. number of elements being attribute elementSize. Be aware that as
/// we are talking about references the offset is depending on 32 bit / 64 bit compilation.
/// </summary>
[DllImport(enginedll, EntryPoint = "PeelArray")]
public static extern void PeelArray(ref byte[] inValue, out byte outValue, Int64 elementSize);
/// <summary>
/// SetInternalCheck (http://rdf.bg/gkdoc/CS64/SetInternalCheck.html)
///
/// This function allows to enable or disable several active consistency checks. Enabling the checks can
/// introduce performance effects; it is helpfull for and meant for debugging on client side.
/// If model is zero the consistency checks are set for all open and to be created models.
/// </summary>
[DllImport(enginedll, EntryPoint = "SetInternalCheck")]
public static extern void SetInternalCheck(Int64 model, Int64 setting, Int64 mask);
/// <summary>
/// GetInternalCheck (http://rdf.bg/gkdoc/CS64/GetInternalCheck.html)
///
/// This function returns all current enabled active consistency checks given the mask the function is
/// called for.
/// When leaving mask and settinbg zero it will return all bits that can be set.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetInternalCheck")]
public static extern Int64 GetInternalCheck(Int64 model, Int64 mask);
/// <summary>
/// GetInternalCheckIssueCnt (http://rdf.bg/gkdoc/CS64/GetInternalCheckIssueCnt.html)
///
/// This function returns all issues found and not retrieved by the hosting application through
/// GetInternalCheckIssue() / GetInternalCheckIssueW().
/// </summary>
[DllImport(enginedll, EntryPoint = "GetInternalCheckIssueCnt")]
public static extern Int64 GetInternalCheckIssueCnt(Int64 model);
/// <summary>
/// GetInternalCheckIssue (http://rdf.bg/gkdoc/CS64/GetInternalCheckIssue.html)
///
/// This function returns the oldest issues in the list of issues and reduces the list of issues with 1.
/// The name and description represent the issue as ASCII string, if relevant the relating owlInstance
/// will be returned through relatedOwlInstance.
/// Namer, Description and relatedOwlInstance are optional.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetInternalCheckIssue")]
public static extern void GetInternalCheckIssue(Int64 model, out IntPtr name, out IntPtr description, out Int64 relatedOwlInstance);
/// <summary>
/// GetInternalCheckIssueW (http://rdf.bg/gkdoc/CS64/GetInternalCheckIssueW.html)
///
/// This function returns the oldest issues in the list of issues and reduces the list of issues with 1.
/// The name and description represent the issue as Unicode string, if relevant the relating owlInstance
/// will be returned through relatedOwlInstance.
/// Namer, Description and relatedOwlInstance are optional.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetInternalCheckIssueW")]
public static extern void GetInternalCheckIssueW(Int64 model, out IntPtr name, out IntPtr description, out Int64 relatedOwlInstance);
/// <summary>
/// CloseSession (http://rdf.bg/gkdoc/CS64/CloseSession.html)
///
/// This function closes the session, after this call the geometry kernel cannot be used anymore.
/// </summary>
[DllImport(enginedll, EntryPoint = "CloseSession")]
public static extern Int64 CloseSession();
/// <summary>
/// CleanMemory (http://rdf.bg/gkdoc/CS64/CleanMemory.html)
///
/// This function ..
/// </summary>
[DllImport(enginedll, EntryPoint = "CleanMemory")]
public static extern void CleanMemory();
/// <summary>
/// ClearCache (http://rdf.bg/gkdoc/CS64/ClearCache.html)
///
/// This function ..
/// </summary>
[DllImport(enginedll, EntryPoint = "ClearCache")]
public static extern void ClearCache(Int64 model);
//
// File IO / Stream / Copy API Calls
//
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate Int64 ReadCallBackFunction(IntPtr value);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void WriteCallBackFunction(IntPtr value, Int64 size);
/// <summary>
/// CreateModel (http://rdf.bg/gkdoc/CS64/CreateModel.html)
///
/// This function creates and empty model.
/// References inside to other ontologies will be included.
/// A handle to the model will be returned, or 0 in case something went wrong.
/// </summary>
[DllImport(enginedll, EntryPoint = "CreateModel")]
public static extern Int64 CreateModel();
/// <summary>
/// OpenModel (http://rdf.bg/gkdoc/CS64/OpenModel.html)
///
/// This function opens the model on location file name.
/// References inside to other ontologies will be included.
/// A handle to the model will be returned, or 0 in case something went wrong.
/// </summary>
[DllImport(enginedll, EntryPoint = "OpenModel")]
public static extern Int64 OpenModel(string fileName);
[DllImport(enginedll, EntryPoint = "OpenModel")]
public static extern Int64 OpenModel(byte[] fileName);
/// <summary>
/// OpenModelW (http://rdf.bg/gkdoc/CS64/OpenModelW.html)
///
/// This function opens the model on location file name.
/// References inside to other ontologies will be included.
/// A handle to the model will be returned, or 0 in case something went wrong.
/// </summary>
[DllImport(enginedll, EntryPoint = "OpenModelW")]
public static extern Int64 OpenModelW(string fileName);
[DllImport(enginedll, EntryPoint = "OpenModelW")]
public static extern Int64 OpenModelW(byte[] fileName);
/// <summary>
/// OpenModelS (http://rdf.bg/gkdoc/CS64/OpenModelS.html)
///
/// 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.
/// </summary>
[DllImport(enginedll, EntryPoint = "OpenModelS")]
public static extern Int64 OpenModelS([MarshalAs(UnmanagedType.FunctionPtr)] ReadCallBackFunction callback);
/// <summary>
/// OpenModelA (http://rdf.bg/gkdoc/CS64/OpenModelA.html)
///
/// 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.
/// </summary>
[DllImport(enginedll, EntryPoint = "OpenModelA")]
public static extern Int64 OpenModelA(byte[] content, Int64 size);
/// <summary>
/// ImportModel (http://rdf.bg/gkdoc/CS64/ImportModel.html)
///
/// This function imports a design tree on location file name.
/// The design tree will be added to the given existing model.
/// The return value contains the first instance not referenced by any other instance or zero
/// if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is
/// unique and equal to the instance used within the call SaveInstanceTree().
/// </summary>
[DllImport(enginedll, EntryPoint = "ImportModel")]
public static extern Int64 ImportModel(Int64 model, string fileName);
[DllImport(enginedll, EntryPoint = "ImportModel")]
public static extern Int64 ImportModel(Int64 model, byte[] fileName);
/// <summary>
/// ImportModelW (http://rdf.bg/gkdoc/CS64/ImportModelW.html)
///
/// This function imports a design tree on location file name.
/// The design tree will be added to the given existing model.
/// The return value contains the first instance not referenced by any other instance or zero
/// if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is
/// unique and equal to the instance used within the call SaveInstanceTree().
/// </summary>
[DllImport(enginedll, EntryPoint = "ImportModelW")]
public static extern Int64 ImportModelW(Int64 model, string fileName);
[DllImport(enginedll, EntryPoint = "ImportModelW")]
public static extern Int64 ImportModelW(Int64 model, byte[] fileName);
/// <summary>
/// ImportModelS (http://rdf.bg/gkdoc/CS64/ImportModelS.html)
///
/// This function imports a design tree via a stream.
/// The design tree will be added to the given existing model.
/// The return value contains the first instance not referenced by any other instance or zero
/// if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is
/// unique and equal to the instance used within the call SaveInstanceTree().
/// </summary>
[DllImport(enginedll, EntryPoint = "ImportModelS")]
public static extern Int64 ImportModelS(Int64 model, [MarshalAs(UnmanagedType.FunctionPtr)] ReadCallBackFunction callback);
/// <summary>
/// ImportModelA (http://rdf.bg/gkdoc/CS64/ImportModelA.html)
///
/// This function imports a design tree via an array.
/// The design tree will be added to the given existing model.
/// The return value contains the first instance not referenced by any other instance or zero
/// if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is
/// unique and equal to the instance used within the call SaveInstanceTree().
/// </summary>
[DllImport(enginedll, EntryPoint = "ImportModelA")]
public static extern Int64 ImportModelA(Int64 model, byte[] content, Int64 size);
/// <summary>
/// SaveInstanceTree (http://rdf.bg/gkdoc/CS64/SaveInstanceTree.html)
///
/// This function saves the selected instance and its dependancies on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceTree")]
public static extern Int64 SaveInstanceTree(Int64 owlInstance, string fileName);
[DllImport(enginedll, EntryPoint = "SaveInstanceTree")]
public static extern Int64 SaveInstanceTree(Int64 owlInstance, byte[] fileName);
/// <summary>
/// SaveInstanceTreeW (http://rdf.bg/gkdoc/CS64/SaveInstanceTreeW.html)
///
/// This function saves the selected instance and its dependancies on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceTreeW")]
public static extern Int64 SaveInstanceTreeW(Int64 owlInstance, string fileName);
[DllImport(enginedll, EntryPoint = "SaveInstanceTreeW")]
public static extern Int64 SaveInstanceTreeW(Int64 owlInstance, byte[] fileName);
/// <summary>
/// SaveInstanceTreeS (http://rdf.bg/gkdoc/CS64/SaveInstanceTreeS.html)
///
/// This function saves the selected instance and its dependancies in a stream.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceTreeS")]
public static extern Int64 SaveInstanceTreeS(Int64 owlInstance, [MarshalAs(UnmanagedType.FunctionPtr)] WriteCallBackFunction callback, Int64 size);
/// <summary>
/// SaveInstanceTreeA (http://rdf.bg/gkdoc/CS64/SaveInstanceTreeA.html)
///
/// This function saves the selected instance and its dependancies in an array.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceTreeA")]
public static extern Int64 SaveInstanceTreeA(Int64 owlInstance, byte[] content, out Int64 size);
/// <summary>
/// SaveInstanceNetwork (http://rdf.bg/gkdoc/CS64/SaveInstanceNetwork.html)
///
/// This function saves the selected instance and its dependancies on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceNetwork")]
public static extern Int64 SaveInstanceNetwork(Int64 owlInstance, byte includeInverseRelations, string fileName);
[DllImport(enginedll, EntryPoint = "SaveInstanceNetwork")]
public static extern Int64 SaveInstanceNetwork(Int64 owlInstance, byte includeInverseRelations, byte[] fileName);
/// <summary>
/// SaveInstanceNetworkW (http://rdf.bg/gkdoc/CS64/SaveInstanceNetworkW.html)
///
/// This function saves the selected instance and its dependancies on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceNetworkW")]
public static extern Int64 SaveInstanceNetworkW(Int64 owlInstance, byte includeInverseRelations, string fileName);
[DllImport(enginedll, EntryPoint = "SaveInstanceNetworkW")]
public static extern Int64 SaveInstanceNetworkW(Int64 owlInstance, byte includeInverseRelations, byte[] fileName);
/// <summary>
/// SaveInstanceNetworkS (http://rdf.bg/gkdoc/CS64/SaveInstanceNetworkS.html)
///
/// This function saves the selected instance and its dependancies in a stream.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceNetworkS")]
public static extern Int64 SaveInstanceNetworkS(Int64 owlInstance, byte includeInverseRelations, [MarshalAs(UnmanagedType.FunctionPtr)] WriteCallBackFunction callback, Int64 size);
/// <summary>
/// SaveInstanceNetworkA (http://rdf.bg/gkdoc/CS64/SaveInstanceNetworkA.html)
///
/// This function saves the selected instance and its dependancies in an array.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveInstanceNetworkA")]
public static extern Int64 SaveInstanceNetworkA(Int64 owlInstance, byte includeInverseRelations, byte[] content, out Int64 size);
/// <summary>
/// SaveModel (http://rdf.bg/gkdoc/CS64/SaveModel.html)
///
/// This function saves the current model on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveModel")]
public static extern Int64 SaveModel(Int64 model, string fileName);
[DllImport(enginedll, EntryPoint = "SaveModel")]
public static extern Int64 SaveModel(Int64 model, byte[] fileName);
/// <summary>
/// SaveModelW (http://rdf.bg/gkdoc/CS64/SaveModelW.html)
///
/// This function saves the current model on location file name.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveModelW")]
public static extern Int64 SaveModelW(Int64 model, string fileName);
[DllImport(enginedll, EntryPoint = "SaveModelW")]
public static extern Int64 SaveModelW(Int64 model, byte[] fileName);
/// <summary>
/// SaveModelS (http://rdf.bg/gkdoc/CS64/SaveModelS.html)
///
/// This function saves the current model in a stream.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveModelS")]
public static extern Int64 SaveModelS(Int64 model, [MarshalAs(UnmanagedType.FunctionPtr)] WriteCallBackFunction callback, Int64 size);
/// <summary>
/// SaveModelA (http://rdf.bg/gkdoc/CS64/SaveModelA.html)
///
/// This function saves the current model in an array.
/// </summary>
[DllImport(enginedll, EntryPoint = "SaveModelA")]
public static extern Int64 SaveModelA(Int64 model, byte[] content, out Int64 size);
/// <summary>
/// SetOverrideFileIO (http://rdf.bg/gkdoc/CS64/SetOverrideFileIO.html)
///
/// This function overrides the type of file saved / exported independent of the extension given.
/// By default the extension of the file name will define the type saved / exported:
/// .rdf => generated RDF serialized content
/// .ttl => generated TTL serialized content
/// .bin => generated BIN/X serialized content
///
/// Available formats
/// RDF
/// TTL
/// BIN/L - readible but large BIN format
/// BIN/S - Optimized Binary, only running within given revision
/// BIN/X - Optimized Binary, running in all revisions supporting BIN/X
///
/// Force file type (overrides extension), works only on save (open selects correct type automatically)
/// bit0 bit1 bit2
/// 0 0 0 [default] unset forced file type
/// 0 0 1 RESERVED
/// 0 1 0 TTL
/// 0 1 1 RDF
/// 1 0 0 BIN/X
/// 1 0 1 BIN/S
/// 1 1 0 RESERVED
/// 1 1 1 BIN/L
///
/// Force exporting as Base64
/// bit4
/// 0 do not use Base64
/// 1 use Base64 (only works for BIN/S and BIN/X), on other formats no effect
/// </summary>
[DllImport(enginedll, EntryPoint = "SetOverrideFileIO")]
public static extern void SetOverrideFileIO(Int64 model, Int64 setting, Int64 mask);
/// <summary>
/// GetOverrideFileIO (http://rdf.bg/gkdoc/CS64/GetOverrideFileIO.html)
///
/// This function get the current overrides for type of file saved / exported independent of the extension given.
/// By default the extension of the file name will define the type saved / exported:
/// .rdf => generated RDF serialized content
/// .ttl => generated TTL serialized content
/// .bin => generated BIN/X serialized content
///
/// Available formats
/// RDF
/// TTL
/// BIN/L - readible but large BIN format
/// BIN/S - Optimized Binary, only running within given revision
/// BIN/X - Optimized Binary, running in all revisions supporting BIN/X
///
/// Force file type (overrides extension), works only on save (open selects correct type automatically)
/// bit0 bit1 bit2
/// 0 0 0 [default] unset forced file type
/// 0 0 1 RESERVED
/// 0 1 0 TTL
/// 0 1 1 RDF
/// 1 0 0 BIN/X
/// 1 0 1 BIN/S
/// 1 1 0 RESERVED
/// 1 1 1 BIN/L
///
/// Force exporting as Base64
/// bit4
/// 0 do not use Base64
/// 1 use Base64 (only works for BIN/S and BIN/X), on other formats no effect
/// </summary>
[DllImport(enginedll, EntryPoint = "GetOverrideFileIO")]
public static extern Int64 GetOverrideFileIO(Int64 model, Int64 mask);
/// <summary>
/// CopyInstanceTree (http://rdf.bg/gkdoc/CS64/CopyInstanceTree.html)
///
/// This function copies the instance tree towards a new model.
/// In case model is empty a new model will be created (the handle to this new model can be retrieved through
/// the call GetModel() based on the return value of this call).
/// The model can be amy opem model, it can be zero (a new model will be created on-the-fly) and it can be
/// the same model as the model owlInstance is defined within, in this case just a perfect copy of the
/// original instance tree.
///
/// The return value is the handle to the copied owlInstance in the model of choice.
/// </summary>
[DllImport(enginedll, EntryPoint = "CopyInstanceTree")]
public static extern Int64 CopyInstanceTree(Int64 owlInstance, Int64 targetModel);
/// <summary>
/// CopyInstanceNetwork (http://rdf.bg/gkdoc/CS64/CopyInstanceNetwork.html)
///
/// This function copies the instance network towards a new model.
/// An instance network is different from an instance tree in that it can contain 'loops', the performance
/// from this call will be slower in case the tree / network is sparse.
/// In case model is empty a new model will be created (the handle to this new model can be retrieved through
/// the call GetModel() based on the return value of this call).
/// The model can be amy opem model, it can be zero (a new model will be created on-the-fly) and it can be
/// the same model as the model owlInstance is defined within, in this case just a perfect copy of the
/// original instance tree.
///
/// In case it is known we are talking about a tree (i.e. no internal loops) and inverse relations can be ignored
/// the call CopyInstanceTree is a better choice concerning performance.
///
/// The return value is the handle to the copied owlInstance in the model of choice.
/// </summary>
[DllImport(enginedll, EntryPoint = "CopyInstanceNetwork")]
public static extern Int64 CopyInstanceNetwork(Int64 owlInstance, byte includeInverseRelations, Int64 targetModel);
/// <summary>
/// CopyModel (http://rdf.bg/gkdoc/CS64/CopyModel.html)
///
/// This function copies the complete structure of a model towards another or new model.
/// In case the targetModel is empty a new model will be created.
/// The owlInstance array (values) and it's cardinality (card) can be empty, in case they are
/// non-empty the values are expected to contain owlInstance handles referencing in the source model
/// after a successful copy the values will be adjusted into values referencing the copied owl instances
/// in the new model. the list of values does not have to be complete or even unique and can even be empty.
///
/// sourceModel is not allowed to be empty, targetModel however can be empty or even equal to the source model.
///
/// The return value is the targetModel or in case this value was empty the newly created model.
/// </summary>
[DllImport(enginedll, EntryPoint = "CopyModel")]
public static extern Int64 CopyModel(Int64 sourceModel, Int64 targetModel, out Int64 values, Int64 card);
/// <summary>
/// CloseModel (http://rdf.bg/gkdoc/CS64/CloseModel.html)
///
/// This function closes the model. After this call none of the instances and classes within the model
/// can be used anymore, also garbage collection is not allowed anymore, in default compilation the
/// model itself will be known in the kernel, however known to be disabled. Calls containing the model
/// reference will be protected from crashing when called.
/// </summary>
[DllImport(enginedll, EntryPoint = "CloseModel")]
public static extern Int64 CloseModel(Int64 model);
//
// Design Tree Classes API Calls
//
/// <summary>
/// CreateClass (http://rdf.bg/gkdoc/CS64/CreateClass.html)
///
/// Returns a handle to an on the fly created class.
/// If the model input is zero or not a model handle 0 will be returned,
/// </summary>
[DllImport(enginedll, EntryPoint = "CreateClass")]
public static extern Int64 CreateClass(Int64 model, string name);
[DllImport(enginedll, EntryPoint = "CreateClass")]
public static extern Int64 CreateClass(Int64 model, byte[] name);
/// <summary>
/// CreateClassW (http://rdf.bg/gkdoc/CS64/CreateClassW.html)
///
/// Returns a handle to an on the fly created class.
/// If the model input is zero or not a model handle 0 will be returned,
/// </summary>
[DllImport(enginedll, EntryPoint = "CreateClassW")]
public static extern Int64 CreateClassW(Int64 model, string name);
[DllImport(enginedll, EntryPoint = "CreateClassW")]
public static extern Int64 CreateClassW(Int64 model, byte[] name);
/// <summary>
/// GetClassByName (http://rdf.bg/gkdoc/CS64/GetClassByName.html)
///
/// Returns a handle to the class as stored inside.
/// When the class does not exist yet and the name is unique
/// the class will be created on the fly and the handle will be returned.
/// When the name is not unique and given to an instance, objectTypeProperty
/// or dataTypeProperty 0 will be returned.
/// </summary>
[DllImport(enginedll, EntryPoint = "GetClassByName")]
public static extern Int64 GetClassByName(Int64 model, string name);