[C#] Drop reference to `assert` which makes building on Win hard
[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  * [`Score`] 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 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
51          */
52         public Score as_Score() {
53                 long ret = bindings.FixedPenaltyScorer_as_Score(this.ptr);
54                 GC.KeepAlive(this);
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); };
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
63          */
64         public byte[] write() {
65                 byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr);
66                 GC.KeepAlive(this);
67                 return ret;
68         }
69
70         /**
71          * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
72          */
73         public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
74                 long ret = bindings.FixedPenaltyScorer_read(ser, arg);
75                 GC.KeepAlive(ser);
76                 GC.KeepAlive(arg);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);
79                 return ret_hu_conv;
80         }
81
82 }
83 } } }