0b47eda72b85102f156d6b6da7703c5e0e784045
[ldk-java] / c_sharp / src / org / ldk / structs / TwoTuple_PublicKeyOnionMessageZ.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 /**
10  * A Tuple
11  */
12 public class TwoTuple_PublicKeyOnionMessageZ : CommonBase {
13         internal TwoTuple_PublicKeyOnionMessageZ(object _dummy, long ptr) : base(ptr) { }
14         ~TwoTuple_PublicKeyOnionMessageZ() {
15                 if (ptr != 0) { bindings.C2Tuple_PublicKeyOnionMessageZ_free(ptr); }
16         }
17
18         /**
19          * 
20          */
21         public byte[] get_a() {
22                 long ret = bindings.C2Tuple_PublicKeyOnionMessageZ_get_a(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * 
31          */
32         public OnionMessage get_b() {
33                 long ret = bindings.C2Tuple_PublicKeyOnionMessageZ_get_b(this.ptr);
34                 GC.KeepAlive(this);
35                 if (ret >= 0 && ret <= 4096) { return null; }
36                 org.ldk.structs.OnionMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessage(null, ret); }
37                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
38                 return ret_hu_conv;
39         }
40
41         internal long clone_ptr() {
42                 long ret = bindings.C2Tuple_PublicKeyOnionMessageZ_clone_ptr(this.ptr);
43                 GC.KeepAlive(this);
44                 return ret;
45         }
46
47         /**
48          * Creates a new tuple which has the same data as `orig`
49          * but with all dynamically-allocated buffers duplicated in new buffers.
50          */
51         public TwoTuple_PublicKeyOnionMessageZ clone() {
52                 long ret = bindings.C2Tuple_PublicKeyOnionMessageZ_clone(this.ptr);
53                 GC.KeepAlive(this);
54                 if (ret >= 0 && ret <= 4096) { return null; }
55                 TwoTuple_PublicKeyOnionMessageZ ret_hu_conv = new TwoTuple_PublicKeyOnionMessageZ(null, ret);
56                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements.
62          */
63         public static TwoTuple_PublicKeyOnionMessageZ of(byte[] a, org.ldk.structs.OnionMessage b) {
64                 long ret = bindings.C2Tuple_PublicKeyOnionMessageZ_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)), b == null ? 0 : b.ptr);
65                 GC.KeepAlive(a);
66                 GC.KeepAlive(b);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 TwoTuple_PublicKeyOnionMessageZ ret_hu_conv = new TwoTuple_PublicKeyOnionMessageZ(null, ret);
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(b); };
71                 return ret_hu_conv;
72         }
73
74 }
75 } } }