[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / WriteableScore.cs
index bd6d974dc475e1d56bbb5f423f7ad0c5d0eee2ec..634aa9690f75e5df23bec755eb99c4763f0dcddf 100644 (file)
@@ -1,3 +1,4 @@
+
 using org.ldk.impl;
 using org.ldk.enums;
 using org.ldk.util;
@@ -5,6 +6,15 @@ using System;
 
 namespace org { namespace ldk { namespace structs {
 
+
+
+/** An implementation of WriteableScore */
+public interface WriteableScoreInterface {
+       /**Serialize the object into a byte array
+        */
+       byte[] write();
+}
+
 /**
  * Refers to a scorer that is accessible under lock and also writeable to disk
  * 
@@ -12,56 +22,50 @@ namespace org { namespace ldk { namespace structs {
  * use the Persister to persist it.
  */
 public class WriteableScore : CommonBase {
-       internal readonly bindings.LDKWriteableScore bindings_instance;
+       internal bindings.LDKWriteableScore bindings_instance;
+       internal long instance_idx;
+
        internal WriteableScore(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
-       private WriteableScore(bindings.LDKWriteableScore arg, bindings.LDKLockableScore LockableScore) : base(bindings.LDKWriteableScore_new(arg, LockableScore)) {
-               this.ptrs_to.AddLast(arg);
-               this.ptrs_to.AddLast(LockableScore);
-               this.bindings_instance = arg;
-       }
        ~WriteableScore() {
                if (ptr != 0) { bindings.WriteableScore_free(ptr); }
        }
 
-       public interface WriteableScoreInterface {
-               /**
-                * Serialize the object into a byte array
-                */
-               byte[] write();
-       }
        private class LDKWriteableScoreHolder { internal WriteableScore held; }
        private class LDKWriteableScoreImpl : bindings.LDKWriteableScore {
                internal LDKWriteableScoreImpl(WriteableScoreInterface arg, LDKWriteableScoreHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
                private WriteableScoreInterface arg;
                private LDKWriteableScoreHolder impl_holder;
-               public byte[] write() {
+               public long write() {
                        byte[] ret = arg.write();
                                GC.KeepAlive(arg);
-                       return ret;
+                       long result = InternalUtils.encodeUint8Array(ret);
+                       return result;
                }
        }
-       public static WriteableScore new_impl(WriteableScoreInterface arg, LockableScore.LockableScoreInterface LockableScore_impl) {
+
+       /** Creates a new instance of WriteableScore from a given implementation */
+       public static WriteableScore new_impl(WriteableScoreInterface arg, LockableScoreInterface lockableScore_impl) {
                LDKWriteableScoreHolder impl_holder = new LDKWriteableScoreHolder();
-               impl_holder.held = new WriteableScore(new LDKWriteableScoreImpl(arg, impl_holder), LockableScore.new_impl(LockableScore_impl).bindings_instance);
-               return impl_holder.held;
-       }
+               LDKWriteableScoreImpl impl = new LDKWriteableScoreImpl(arg, impl_holder);
+               LockableScore lockableScore = LockableScore.new_impl(lockableScore_impl);
+               long[] ptr_idx = bindings.LDKWriteableScore_new(impl, lockableScore.instance_idx);
 
-       /**
-        * Gets the underlying LockableScore.
-        */
-       public LockableScore get_lockable_score() {
-               LockableScore res = new LockableScore(null, bindings.LDKWriteableScore_get_LockableScore(this.ptr));
-               this.ptrs_to.AddLast(res);
-               return res;
+               impl_holder.held = new WriteableScore(null, ptr_idx[0]);
+               impl_holder.held.instance_idx = ptr_idx[1];
+               impl_holder.held.bindings_instance = impl;
+               impl_holder.held.ptrs_to.AddLast(lockableScore);
+               return impl_holder.held;
        }
 
        /**
         * Serialize the object into a byte array
         */
        public byte[] write() {
-               byte[] ret = bindings.WriteableScore_write(this.ptr);
+               long ret = bindings.WriteableScore_write(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
 }