6 namespace org { namespace ldk { namespace structs {
10 * [`Score`] 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 Score which calls the relevant methods on this_arg.
50 * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
52 public Score as_Score() {
53 long ret = bindings.FixedPenaltyScorer_as_Score(this.ptr);
55 if (ret >= 0 && ret <= 4096) { return null; }
56 Score ret_hu_conv = new Score(null, ret);
57 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
62 * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
64 public byte[] write() {
65 byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr);
71 * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
73 public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
74 long ret = bindings.FixedPenaltyScorer_read(ser, arg);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);