[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Logger.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 Logger */
12 public interface LoggerInterface {
13         /**Logs the `Record`
14          */
15         void log(Record record);
16 }
17
18 /**
19  * A trait encapsulating the operations required of a logger
20  */
21 public class Logger : CommonBase {
22         internal bindings.LDKLogger bindings_instance;
23         internal long instance_idx;
24
25         internal Logger(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
26         ~Logger() {
27                 if (ptr != 0) { bindings.Logger_free(ptr); }
28         }
29
30         private class LDKLoggerHolder { internal Logger held; }
31         private class LDKLoggerImpl : bindings.LDKLogger {
32                 internal LDKLoggerImpl(LoggerInterface arg, LDKLoggerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
33                 private LoggerInterface arg;
34                 private LDKLoggerHolder impl_holder;
35                 public void log(long _record) {
36                         org.ldk.structs.Record _record_hu_conv = null; if (_record < 0 || _record > 4096) { _record_hu_conv = new org.ldk.structs.Record(null, _record); }
37                         arg.log(_record_hu_conv);
38                                 GC.KeepAlive(arg);
39                 }
40         }
41
42         /** Creates a new instance of Logger from a given implementation */
43         public static Logger new_impl(LoggerInterface arg) {
44                 LDKLoggerHolder impl_holder = new LDKLoggerHolder();
45                 LDKLoggerImpl impl = new LDKLoggerImpl(arg, impl_holder);
46                 long[] ptr_idx = bindings.LDKLogger_new(impl);
47
48                 impl_holder.held = new Logger(null, ptr_idx[0]);
49                 impl_holder.held.instance_idx = ptr_idx[1];
50                 impl_holder.held.bindings_instance = impl;
51                 return impl_holder.held;
52         }
53
54 }
55 } } }