[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / FixedPenaltyScorer.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  * [`ScoreLookUp`] implementation that uses a fixed penalty.
11  */
12 public class FixedPenaltyScorer : CommonBase {
13         internal FixedPenaltyScorer(object _dummy, long ptr) : base(ptr) { }
14         ~FixedPenaltyScorer() {
15                 if (ptr != 0) { bindings.FixedPenaltyScorer_free(ptr); }
16         }
17
18         internal long clone_ptr() {
19                 long ret = bindings.FixedPenaltyScorer_clone_ptr(this.ptr);
20                 GC.KeepAlive(this);
21                 return ret;
22         }
23
24         /**
25          * Creates a copy of the FixedPenaltyScorer
26          */
27         public FixedPenaltyScorer clone() {
28                 long ret = bindings.FixedPenaltyScorer_clone(this.ptr);
29                 GC.KeepAlive(this);
30                 if (ret >= 0 && ret <= 4096) { return null; }
31                 org.ldk.structs.FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FixedPenaltyScorer(null, ret); }
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33                 return ret_hu_conv;
34         }
35
36         /**
37          * Creates a new scorer using `penalty_msat`.
38          */
39         public static FixedPenaltyScorer with_penalty(long penalty_msat) {
40                 long ret = bindings.FixedPenaltyScorer_with_penalty(penalty_msat);
41                 GC.KeepAlive(penalty_msat);
42                 if (ret >= 0 && ret <= 4096) { return null; }
43                 org.ldk.structs.FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FixedPenaltyScorer(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         /**
49          * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
50          * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
51          */
52         public ScoreLookUp as_ScoreLookUp() {
53                 long ret = bindings.FixedPenaltyScorer_as_ScoreLookUp(this.ptr);
54                 GC.KeepAlive(this);
55                 if (ret >= 0 && ret <= 4096) { return null; }
56                 ScoreLookUp ret_hu_conv = new ScoreLookUp(null, ret);
57                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Constructs a new ScoreUpdate which calls the relevant methods on this_arg.
63          * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is
64          */
65         public ScoreUpdate as_ScoreUpdate() {
66                 long ret = bindings.FixedPenaltyScorer_as_ScoreUpdate(this.ptr);
67                 GC.KeepAlive(this);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 ScoreUpdate ret_hu_conv = new ScoreUpdate(null, ret);
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
71                 return ret_hu_conv;
72         }
73
74         /**
75          * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
76          */
77         public byte[] write() {
78                 long ret = bindings.FixedPenaltyScorer_write(this.ptr);
79                 GC.KeepAlive(this);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
82                 return ret_conv;
83         }
84
85         /**
86          * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
87          */
88         public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
89                 long ret = bindings.FixedPenaltyScorer_read(InternalUtils.encodeUint8Array(ser), arg);
90                 GC.KeepAlive(ser);
91                 GC.KeepAlive(arg);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);
94                 return ret_hu_conv;
95         }
96
97 }
98 } } }