[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / BigSize.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  * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
11  * variable-length integers except that it is serialized in big-endian instead of little-endian.
12  * 
13  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
14  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
15  * you're looking for an example of a variable-length integer to use for your own project, move
16  * along, this is a rather poor design.
17  */
18 public class BigSize : CommonBase {
19         internal BigSize(object _dummy, long ptr) : base(ptr) { }
20         ~BigSize() {
21                 if (ptr != 0) { bindings.BigSize_free(ptr); }
22         }
23
24         public long get_a() {
25                 long ret = bindings.BigSize_get_a(this.ptr);
26                 GC.KeepAlive(this);
27                 return ret;
28         }
29
30         public void set_a(long val) {
31                 bindings.BigSize_set_a(this.ptr, val);
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * Constructs a new BigSize given each field
38          */
39         public static BigSize of(long a_arg) {
40                 long ret = bindings.BigSize_new(a_arg);
41                 GC.KeepAlive(a_arg);
42                 if (ret >= 0 && ret <= 4096) { return null; }
43                 org.ldk.structs.BigSize ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BigSize(null, ret); }
44                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
45                 return ret_hu_conv;
46         }
47
48         internal long clone_ptr() {
49                 long ret = bindings.BigSize_clone_ptr(this.ptr);
50                 GC.KeepAlive(this);
51                 return ret;
52         }
53
54         /**
55          * Creates a copy of the BigSize
56          */
57         public BigSize clone() {
58                 long ret = bindings.BigSize_clone(this.ptr);
59                 GC.KeepAlive(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 org.ldk.structs.BigSize ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BigSize(null, ret); }
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Generates a non-cryptographic 64-bit hash of the BigSize.
68          */
69         public long hash() {
70                 long ret = bindings.BigSize_hash(this.ptr);
71                 GC.KeepAlive(this);
72                 return ret;
73         }
74
75         public override int GetHashCode() {
76                 return (int)this.hash();
77         }
78         /**
79          * Checks if two BigSizes contain equal inner contents.
80          * This ignores pointers and is_owned flags and looks at the values in fields.
81          * Two objects with NULL inner values will be considered "equal" here.
82          */
83         public bool eq(org.ldk.structs.BigSize b) {
84                 bool ret = bindings.BigSize_eq(this.ptr, b == null ? 0 : b.ptr);
85                 GC.KeepAlive(this);
86                 GC.KeepAlive(b);
87                 if (this != null) { this.ptrs_to.AddLast(b); };
88                 return ret;
89         }
90
91         public override bool Equals(object o) {
92                 if (!(o is BigSize)) return false;
93                 return this.eq((BigSize)o);
94         }
95         /**
96          * Serialize the BigSize object into a byte array which can be read by BigSize_read
97          */
98         public byte[] write() {
99                 long ret = bindings.BigSize_write(this.ptr);
100                 GC.KeepAlive(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
103                 return ret_conv;
104         }
105
106         /**
107          * Read a BigSize from a byte array, created by BigSize_write
108          */
109         public static Result_BigSizeDecodeErrorZ read(byte[] ser) {
110                 long ret = bindings.BigSize_read(InternalUtils.encodeUint8Array(ser));
111                 GC.KeepAlive(ser);
112                 if (ret >= 0 && ret <= 4096) { return null; }
113                 Result_BigSizeDecodeErrorZ ret_hu_conv = Result_BigSizeDecodeErrorZ.constr_from_ptr(ret);
114                 return ret_hu_conv;
115         }
116
117 }
118 } } }