[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Option_CVec_ThirtyTwoBytesZZ.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  * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
10  */
11 public class Option_CVec_ThirtyTwoBytesZZ : CommonBase {
12         protected Option_CVec_ThirtyTwoBytesZZ(object _dummy, long ptr) : base(ptr) { }
13         ~Option_CVec_ThirtyTwoBytesZZ() {
14                 if (ptr != 0) { bindings.COption_CVec_ThirtyTwoBytesZZ_free(ptr); }
15         }
16
17         internal static Option_CVec_ThirtyTwoBytesZZ constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Option_CVec_ThirtyTwoBytesZZ_Some(ptr);
21                         case 1: return new Option_CVec_ThirtyTwoBytesZZ_None(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A Option_CVec_ThirtyTwoBytesZZ of type Some */
28         public class Option_CVec_ThirtyTwoBytesZZ_Some : Option_CVec_ThirtyTwoBytesZZ {
29                 public byte[][] some;
30                 internal Option_CVec_ThirtyTwoBytesZZ_Some(long ptr) : base(null, ptr) {
31                         long some = bindings.LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(ptr);
32                         int some_conv_8_len = InternalUtils.getArrayLength(some);
33                         byte[][] some_conv_8_arr = new byte[some_conv_8_len][];
34                         for (int i = 0; i < some_conv_8_len; i++) {
35                                 long some_conv_8 = InternalUtils.getU64ArrayElem(some, i);
36                                 byte[] some_conv_8_conv = InternalUtils.decodeUint8Array(some_conv_8);
37                                 some_conv_8_arr[i] = some_conv_8_conv;
38                         }
39                         bindings.free_buffer(some);
40                         this.some = some_conv_8_arr;
41                 }
42         }
43         /** A Option_CVec_ThirtyTwoBytesZZ of type None */
44         public class Option_CVec_ThirtyTwoBytesZZ_None : Option_CVec_ThirtyTwoBytesZZ {
45                 internal Option_CVec_ThirtyTwoBytesZZ_None(long ptr) : base(null, ptr) {
46                 }
47         }
48         /**
49          * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
50          */
51         public static Option_CVec_ThirtyTwoBytesZZ some(byte[][] o) {
52                 long ret = bindings.COption_CVec_ThirtyTwoBytesZZ_some(InternalUtils.encodeUint64Array(InternalUtils.mapArray(o, o_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(o_conv_8, 32)))));
53                 GC.KeepAlive(o);
54                 if (ret >= 0 && ret <= 4096) { return null; }
55                 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
56                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
62          */
63         public static Option_CVec_ThirtyTwoBytesZZ none() {
64                 long ret = bindings.COption_CVec_ThirtyTwoBytesZZ_none();
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
67                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
68                 return ret_hu_conv;
69         }
70
71         internal long clone_ptr() {
72                 long ret = bindings.COption_CVec_ThirtyTwoBytesZZ_clone_ptr(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
79          * but with all dynamically-allocated buffers duplicated in new buffers.
80          */
81         public Option_CVec_ThirtyTwoBytesZZ clone() {
82                 long ret = bindings.COption_CVec_ThirtyTwoBytesZZ_clone(this.ptr);
83                 GC.KeepAlive(this);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
87                 return ret_hu_conv;
88         }
89
90 }
91 } } }