ce0130b94fdba89f5ea5b2ed863959581bd2e13a
[ldk-java] / c_sharp / src / org / ldk / structs / RawDataPart.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  * Data of the `RawInvoice` that is encoded in the data part
11  */
12 public class RawDataPart : CommonBase {
13         internal RawDataPart(object _dummy, long ptr) : base(ptr) { }
14         ~RawDataPart() {
15                 if (ptr != 0) { bindings.RawDataPart_free(ptr); }
16         }
17
18         /**
19          * generation time of the invoice
20          */
21         public PositiveTimestamp get_timestamp() {
22                 long ret = bindings.RawDataPart_get_timestamp(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 org.ldk.structs.PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PositiveTimestamp(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * generation time of the invoice
32          */
33         public void set_timestamp(org.ldk.structs.PositiveTimestamp val) {
34                 bindings.RawDataPart_set_timestamp(this.ptr, val == null ? 0 : val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * Checks if two RawDataParts contain equal inner contents.
42          * This ignores pointers and is_owned flags and looks at the values in fields.
43          * Two objects with NULL inner values will be considered "equal" here.
44          */
45         public bool eq(org.ldk.structs.RawDataPart b) {
46                 bool ret = bindings.RawDataPart_eq(this.ptr, b == null ? 0 : b.ptr);
47                 GC.KeepAlive(this);
48                 GC.KeepAlive(b);
49                 if (this != null) { this.ptrs_to.AddLast(b); };
50                 return ret;
51         }
52
53         public override bool Equals(object o) {
54                 if (!(o is RawDataPart)) return false;
55                 return this.eq((RawDataPart)o);
56         }
57         internal long clone_ptr() {
58                 long ret = bindings.RawDataPart_clone_ptr(this.ptr);
59                 GC.KeepAlive(this);
60                 return ret;
61         }
62
63         /**
64          * Creates a copy of the RawDataPart
65          */
66         public RawDataPart clone() {
67                 long ret = bindings.RawDataPart_clone(this.ptr);
68                 GC.KeepAlive(this);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawDataPart(null, ret); }
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
72                 return ret_hu_conv;
73         }
74
75         /**
76          * Checks if two RawDataParts contain equal inner contents.
77          */
78         public long hash() {
79                 long ret = bindings.RawDataPart_hash(this.ptr);
80                 GC.KeepAlive(this);
81                 return ret;
82         }
83
84         public override int GetHashCode() {
85                 return (int)this.hash();
86         }
87 }
88 } } }