6 namespace org { namespace ldk { namespace structs {
9 * An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
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); }
17 internal static Option_CVec_SocketAddressZZ constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(ptr);
20 case 0: return new Option_CVec_SocketAddressZZ_Some(ptr);
21 case 1: return new Option_CVec_SocketAddressZZ_None(ptr);
23 throw new ArgumentException("Impossible enum variant");
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;
40 bindings.free_buffer(some);
41 this.some = some_conv_15_arr;
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) {
50 * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
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)));
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); }; };
63 * Constructs a new COption_CVec_SocketAddressZZ containing nothing
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); };
73 internal long clone_ptr() {
74 long ret = bindings.COption_CVec_SocketAddressZZ_clone_ptr(this.ptr);
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.
83 public Option_CVec_SocketAddressZZ clone() {
84 long ret = bindings.COption_CVec_SocketAddressZZ_clone(this.ptr);
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); };