Ejemplo n.º 1
0
 public static extern int kowhai_get_int8(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, out byte result);
Ejemplo n.º 2
0
 public static Tree CreateFromNativeTree(kowhai_tree_t nativeTree)
 {
     Tree tree = new Tree();
     int count;
     if (kowhai_get_node_count(nativeTree.desc, out count) == STATUS_OK)
     {
         // copy descriptor
         tree.Descriptor = new kowhai_node_t[count];
         byte[] temp = new byte[count * Marshal.SizeOf(typeof(kowhai_node_t))];
         Marshal.Copy(nativeTree.desc, temp, 0, temp.Length);
         GCHandle p = GCHandle.Alloc(tree.Descriptor, GCHandleType.Pinned);
         Marshal.Copy(temp, 0, p.AddrOfPinnedObject(), temp.Length);
         p.Free();
         // copy data
         if (kowhai_get_node_size(nativeTree.desc, out count) == STATUS_OK)
         {
             tree.Data = new byte[count];
             Marshal.Copy(nativeTree.data, tree.Data, 0, tree.Data.Length);
         }
     }
     return tree;
 }
Ejemplo n.º 3
0
 public static extern int kowhai_get_float(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, out float result);
Ejemplo n.º 4
0
 public static int Write(Tree tree, kowhai_symbol_t[] symbolPath, int offset, byte[] data)
 {
     GCHandle hDesc = GCHandle.Alloc(tree.Descriptor, GCHandleType.Pinned);
     GCHandle hTreeData = GCHandle.Alloc(tree.Data, GCHandleType.Pinned);
     kowhai_tree_t nativeTree = new kowhai_tree_t();
     nativeTree.desc = hDesc.AddrOfPinnedObject();
     nativeTree.data = hTreeData.AddrOfPinnedObject();
     GCHandle hSyms = GCHandle.Alloc(symbolPath, GCHandleType.Pinned);
     GCHandle hWriteData = GCHandle.Alloc(data, GCHandleType.Pinned);
     int result = kowhai_write(ref nativeTree, symbolPath.Length, hSyms.AddrOfPinnedObject(), offset, hWriteData.AddrOfPinnedObject(), data.Length);
     hWriteData.Free();
     hSyms.Free();
     hTreeData.Free();
     hDesc.Free();
     return result;
 }
Ejemplo n.º 5
0
 public static extern int kowhai_write(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, int write_offset, IntPtr value, int write_size);
Ejemplo n.º 6
0
 public static extern int kowhai_set_int8(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, byte value);
Ejemplo n.º 7
0
 public static extern int kowhai_set_float(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, float value);
Ejemplo n.º 8
0
 public static extern int kowhai_read(ref kowhai_tree_t tree, int num_symbols, IntPtr symbols, int read_offset, IntPtr result, int read_size);