[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ScoreUpdate.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of ScoreUpdate */
12 public interface ScoreUpdateInterface {
13         /**Handles updating channel penalties after failing to route through a channel.
14          */
15         void payment_path_failed(Path path, long short_channel_id);
16         /**Handles updating channel penalties after successfully routing along a path.
17          */
18         void payment_path_successful(Path path);
19         /**Handles updating channel penalties after a probe over the given path failed.
20          */
21         void probe_failed(Path path, long short_channel_id);
22         /**Handles updating channel penalties after a probe over the given path succeeded.
23          */
24         void probe_successful(Path path);
25 }
26
27 /**
28  * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt.
29  */
30 public class ScoreUpdate : CommonBase {
31         internal bindings.LDKScoreUpdate bindings_instance;
32         internal long instance_idx;
33
34         internal ScoreUpdate(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
35         ~ScoreUpdate() {
36                 if (ptr != 0) { bindings.ScoreUpdate_free(ptr); }
37         }
38
39         private class LDKScoreUpdateHolder { internal ScoreUpdate held; }
40         private class LDKScoreUpdateImpl : bindings.LDKScoreUpdate {
41                 internal LDKScoreUpdateImpl(ScoreUpdateInterface arg, LDKScoreUpdateHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
42                 private ScoreUpdateInterface arg;
43                 private LDKScoreUpdateHolder impl_holder;
44                 public void payment_path_failed(long _path, long _short_channel_id) {
45                         org.ldk.structs.Path _path_hu_conv = null; if (_path < 0 || _path > 4096) { _path_hu_conv = new org.ldk.structs.Path(null, _path); }
46                         arg.payment_path_failed(_path_hu_conv, _short_channel_id);
47                                 GC.KeepAlive(arg);
48                 }
49                 public void payment_path_successful(long _path) {
50                         org.ldk.structs.Path _path_hu_conv = null; if (_path < 0 || _path > 4096) { _path_hu_conv = new org.ldk.structs.Path(null, _path); }
51                         arg.payment_path_successful(_path_hu_conv);
52                                 GC.KeepAlive(arg);
53                 }
54                 public void probe_failed(long _path, long _short_channel_id) {
55                         org.ldk.structs.Path _path_hu_conv = null; if (_path < 0 || _path > 4096) { _path_hu_conv = new org.ldk.structs.Path(null, _path); }
56                         arg.probe_failed(_path_hu_conv, _short_channel_id);
57                                 GC.KeepAlive(arg);
58                 }
59                 public void probe_successful(long _path) {
60                         org.ldk.structs.Path _path_hu_conv = null; if (_path < 0 || _path > 4096) { _path_hu_conv = new org.ldk.structs.Path(null, _path); }
61                         arg.probe_successful(_path_hu_conv);
62                                 GC.KeepAlive(arg);
63                 }
64         }
65
66         /** Creates a new instance of ScoreUpdate from a given implementation */
67         public static ScoreUpdate new_impl(ScoreUpdateInterface arg) {
68                 LDKScoreUpdateHolder impl_holder = new LDKScoreUpdateHolder();
69                 LDKScoreUpdateImpl impl = new LDKScoreUpdateImpl(arg, impl_holder);
70                 long[] ptr_idx = bindings.LDKScoreUpdate_new(impl);
71
72                 impl_holder.held = new ScoreUpdate(null, ptr_idx[0]);
73                 impl_holder.held.instance_idx = ptr_idx[1];
74                 impl_holder.held.bindings_instance = impl;
75                 return impl_holder.held;
76         }
77
78         /**
79          * Handles updating channel penalties after failing to route through a channel.
80          */
81         public void payment_path_failed(org.ldk.structs.Path path, long short_channel_id) {
82                 bindings.ScoreUpdate_payment_path_failed(this.ptr, path == null ? 0 : path.ptr, short_channel_id);
83                 GC.KeepAlive(this);
84                 GC.KeepAlive(path);
85                 GC.KeepAlive(short_channel_id);
86                 if (this != null) { this.ptrs_to.AddLast(path); };
87         }
88
89         /**
90          * Handles updating channel penalties after successfully routing along a path.
91          */
92         public void payment_path_successful(org.ldk.structs.Path path) {
93                 bindings.ScoreUpdate_payment_path_successful(this.ptr, path == null ? 0 : path.ptr);
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(path);
96                 if (this != null) { this.ptrs_to.AddLast(path); };
97         }
98
99         /**
100          * Handles updating channel penalties after a probe over the given path failed.
101          */
102         public void probe_failed(org.ldk.structs.Path path, long short_channel_id) {
103                 bindings.ScoreUpdate_probe_failed(this.ptr, path == null ? 0 : path.ptr, short_channel_id);
104                 GC.KeepAlive(this);
105                 GC.KeepAlive(path);
106                 GC.KeepAlive(short_channel_id);
107                 if (this != null) { this.ptrs_to.AddLast(path); };
108         }
109
110         /**
111          * Handles updating channel penalties after a probe over the given path succeeded.
112          */
113         public void probe_successful(org.ldk.structs.Path path) {
114                 bindings.ScoreUpdate_probe_successful(this.ptr, path == null ? 0 : path.ptr);
115                 GC.KeepAlive(this);
116                 GC.KeepAlive(path);
117                 if (this != null) { this.ptrs_to.AddLast(path); };
118         }
119
120 }
121 } } }