[C#] Drop reference to `assert` which makes building on Win hard
[ldk-java] / c_sharp / src / org / ldk / structs / Option_CVec_NetAddressZZ.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_NetAddressZ or not
10  */
11 public class Option_CVec_NetAddressZZ : CommonBase {
12         protected Option_CVec_NetAddressZZ(object _dummy, long ptr) : base(ptr) { }
13         ~Option_CVec_NetAddressZZ() {
14                 if (ptr != 0) { bindings.COption_CVec_NetAddressZZ_free(ptr); }
15         }
16
17         internal static Option_CVec_NetAddressZZ constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKCOption_CVec_NetAddressZZ_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Option_CVec_NetAddressZZ_Some(ptr);
21                         case 1: return new Option_CVec_NetAddressZZ_None(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A Option_CVec_NetAddressZZ of type Some */
28         public class Option_CVec_NetAddressZZ_Some : Option_CVec_NetAddressZZ {
29                 public NetAddress[] some;
30                 internal Option_CVec_NetAddressZZ_Some(long ptr) : base(null, ptr) {
31                         long[] some = bindings.LDKCOption_CVec_NetAddressZZ_Some_get_some(ptr);
32                         int some_conv_12_len = some.Length;
33                         NetAddress[] some_conv_12_arr = new NetAddress[some_conv_12_len];
34                         for (int m = 0; m < some_conv_12_len; m++) {
35                                 long some_conv_12 = some[m];
36                                 org.ldk.structs.NetAddress some_conv_12_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(some_conv_12);
37                                 if (some_conv_12_hu_conv != null) { some_conv_12_hu_conv.ptrs_to.AddLast(this); };
38                                 some_conv_12_arr[m] = some_conv_12_hu_conv;
39                         }
40                         this.some = some_conv_12_arr;
41                 }
42         }
43         /** A Option_CVec_NetAddressZZ of type None */
44         public class Option_CVec_NetAddressZZ_None : Option_CVec_NetAddressZZ {
45                 internal Option_CVec_NetAddressZZ_None(long ptr) : base(null, ptr) {
46                 }
47         }
48         /**
49          * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
50          */
51         public static Option_CVec_NetAddressZZ some(NetAddress[] o) {
52                 long ret = bindings.COption_CVec_NetAddressZZ_some(o != null ? InternalUtils.mapArray(o, o_conv_12 => o_conv_12.ptr) : null);
53                 GC.KeepAlive(o);
54                 if (ret >= 0 && ret <= 4096) { return null; }
55                 org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret);
56                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
57                 foreach (NetAddress o_conv_12 in o) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_conv_12); }; };
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Constructs a new COption_CVec_NetAddressZZ containing nothing
63          */
64         public static Option_CVec_NetAddressZZ none() {
65                 long ret = bindings.COption_CVec_NetAddressZZ_none();
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret);
68                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
69                 return ret_hu_conv;
70         }
71
72         internal long clone_ptr() {
73                 long ret = bindings.COption_CVec_NetAddressZZ_clone_ptr(this.ptr);
74                 GC.KeepAlive(this);
75                 return ret;
76         }
77
78         /**
79          * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
80          * but with all dynamically-allocated buffers duplicated in new buffers.
81          */
82         public Option_CVec_NetAddressZZ clone() {
83                 long ret = bindings.COption_CVec_NetAddressZZ_clone(this.ptr);
84                 GC.KeepAlive(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret);
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88                 return ret_hu_conv;
89         }
90
91 }
92 } } }