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