[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / NodeAlias.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 user-defined name for a node, which may be used when displaying the node in a graph.
11  * 
12  * Since node aliases are provided by third parties, they are a potential avenue for injection
13  * attacks. Care must be taken when processing.
14  */
15 public class NodeAlias : CommonBase {
16         internal NodeAlias(object _dummy, long ptr) : base(ptr) { }
17         ~NodeAlias() {
18                 if (ptr != 0) { bindings.NodeAlias_free(ptr); }
19         }
20
21         public byte[] get_a() {
22                 long ret = bindings.NodeAlias_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         public void set_a(byte[] val) {
30                 bindings.NodeAlias_set_a(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
31                 GC.KeepAlive(this);
32                 GC.KeepAlive(val);
33         }
34
35         /**
36          * Constructs a new NodeAlias given each field
37          */
38         public static NodeAlias of(byte[] a_arg) {
39                 long ret = bindings.NodeAlias_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a_arg, 32)));
40                 GC.KeepAlive(a_arg);
41                 if (ret >= 0 && ret <= 4096) { return null; }
42                 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
43                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
44                 return ret_hu_conv;
45         }
46
47         internal long clone_ptr() {
48                 long ret = bindings.NodeAlias_clone_ptr(this.ptr);
49                 GC.KeepAlive(this);
50                 return ret;
51         }
52
53         /**
54          * Creates a copy of the NodeAlias
55          */
56         public NodeAlias clone() {
57                 long ret = bindings.NodeAlias_clone(this.ptr);
58                 GC.KeepAlive(this);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
61                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Generates a non-cryptographic 64-bit hash of the NodeAlias.
67          */
68         public long hash() {
69                 long ret = bindings.NodeAlias_hash(this.ptr);
70                 GC.KeepAlive(this);
71                 return ret;
72         }
73
74         public override int GetHashCode() {
75                 return (int)this.hash();
76         }
77         /**
78          * Checks if two NodeAliass contain equal inner contents.
79          * This ignores pointers and is_owned flags and looks at the values in fields.
80          * Two objects with NULL inner values will be considered "equal" here.
81          */
82         public bool eq(org.ldk.structs.NodeAlias b) {
83                 bool ret = bindings.NodeAlias_eq(this.ptr, b == null ? 0 : b.ptr);
84                 GC.KeepAlive(this);
85                 GC.KeepAlive(b);
86                 if (this != null) { this.ptrs_to.AddLast(b); };
87                 return ret;
88         }
89
90         public override bool Equals(object o) {
91                 if (!(o is NodeAlias)) return false;
92                 return this.eq((NodeAlias)o);
93         }
94         /**
95          * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
96          */
97         public byte[] write() {
98                 long ret = bindings.NodeAlias_write(this.ptr);
99                 GC.KeepAlive(this);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
102                 return ret_conv;
103         }
104
105         /**
106          * Read a NodeAlias from a byte array, created by NodeAlias_write
107          */
108         public static Result_NodeAliasDecodeErrorZ read(byte[] ser) {
109                 long ret = bindings.NodeAlias_read(InternalUtils.encodeUint8Array(ser));
110                 GC.KeepAlive(ser);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 Result_NodeAliasDecodeErrorZ ret_hu_conv = Result_NodeAliasDecodeErrorZ.constr_from_ptr(ret);
113                 return ret_hu_conv;
114         }
115
116 }
117 } } }