6 namespace org { namespace ldk { namespace structs {
10 * [`ScoreLookUp`] implementation that uses a fixed penalty.
12 public class FixedPenaltyScorer : CommonBase {
13 internal FixedPenaltyScorer(object _dummy, long ptr) : base(ptr) { }
14 ~FixedPenaltyScorer() {
15 if (ptr != 0) { bindings.FixedPenaltyScorer_free(ptr); }
18 internal long clone_ptr() {
19 long ret = bindings.FixedPenaltyScorer_clone_ptr(this.ptr);
25 * Creates a copy of the FixedPenaltyScorer
27 public FixedPenaltyScorer clone() {
28 long ret = bindings.FixedPenaltyScorer_clone(this.ptr);
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); };
37 * Creates a new scorer using `penalty_msat`.
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); };
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
52 public ScoreLookUp as_ScoreLookUp() {
53 long ret = bindings.FixedPenaltyScorer_as_ScoreLookUp(this.ptr);
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); };
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
65 public ScoreUpdate as_ScoreUpdate() {
66 long ret = bindings.FixedPenaltyScorer_as_ScoreUpdate(this.ptr);
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); };
75 * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
77 public byte[] write() {
78 long ret = bindings.FixedPenaltyScorer_write(this.ptr);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
86 * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
88 public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
89 long ret = bindings.FixedPenaltyScorer_read(InternalUtils.encodeUint8Array(ser), arg);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);