[C#] Drop reference to `assert` which makes building on Win hard
[ldk-java] / c_sharp / src / org / ldk / structs / CustomOnionMessageContents.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * The contents of a custom onion message.
10  */
11 public class CustomOnionMessageContents : CommonBase {
12         internal readonly bindings.LDKCustomOnionMessageContents bindings_instance;
13         internal CustomOnionMessageContents(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
14         private CustomOnionMessageContents(bindings.LDKCustomOnionMessageContents arg) : base(bindings.LDKCustomOnionMessageContents_new(arg)) {
15                 this.ptrs_to.AddLast(arg);
16                 this.bindings_instance = arg;
17         }
18         ~CustomOnionMessageContents() {
19                 if (ptr != 0) { bindings.CustomOnionMessageContents_free(ptr); }
20         }
21
22         public interface CustomOnionMessageContentsInterface {
23                 /**
24                  * Returns the TLV type identifying the message contents. MUST be >= 64.
25                  */
26                 long tlv_type();
27                 /**
28                  * Serialize the object into a byte array
29                  */
30                 byte[] write();
31         }
32         private class LDKCustomOnionMessageContentsHolder { internal CustomOnionMessageContents held; }
33         private class LDKCustomOnionMessageContentsImpl : bindings.LDKCustomOnionMessageContents {
34                 internal LDKCustomOnionMessageContentsImpl(CustomOnionMessageContentsInterface arg, LDKCustomOnionMessageContentsHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
35                 private CustomOnionMessageContentsInterface arg;
36                 private LDKCustomOnionMessageContentsHolder impl_holder;
37                 public long tlv_type() {
38                         long ret = arg.tlv_type();
39                                 GC.KeepAlive(arg);
40                         return ret;
41                 }
42                 public byte[] write() {
43                         byte[] ret = arg.write();
44                                 GC.KeepAlive(arg);
45                         return ret;
46                 }
47         }
48         public static CustomOnionMessageContents new_impl(CustomOnionMessageContentsInterface arg) {
49                 LDKCustomOnionMessageContentsHolder impl_holder = new LDKCustomOnionMessageContentsHolder();
50                 impl_holder.held = new CustomOnionMessageContents(new LDKCustomOnionMessageContentsImpl(arg, impl_holder));
51                 return impl_holder.held;
52         }
53         /**
54          * Returns the TLV type identifying the message contents. MUST be >= 64.
55          */
56         public long tlv_type() {
57                 long ret = bindings.CustomOnionMessageContents_tlv_type(this.ptr);
58                 GC.KeepAlive(this);
59                 return ret;
60         }
61
62         /**
63          * Serialize the object into a byte array
64          */
65         public byte[] write() {
66                 byte[] ret = bindings.CustomOnionMessageContents_write(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         internal long clone_ptr() {
72                 long ret = bindings.CustomOnionMessageContents_clone_ptr(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * Creates a copy of a CustomOnionMessageContents
79          */
80         public CustomOnionMessageContents clone() {
81                 long ret = bindings.CustomOnionMessageContents_clone(this.ptr);
82                 GC.KeepAlive(this);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, ret);
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
86                 return ret_hu_conv;
87         }
88
89 }
90 } } }