Bindings updates
[ldk-java] / ts / structs / Logger.ts
index 5c34318c2147fb2285de5a1513f46168e33e6baf..e70ca9bceea59028f901ceb9bc53139dd6690cb7 100644 (file)
@@ -1 +1,53 @@
+
+            
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+            export class Logger extends CommonBase {
+
+                bindings_instance?: bindings.LDKLogger;
+
+                constructor(ptr?: number, arg?: bindings.LDKLogger) {
+                    if (Number.isFinite(ptr)) {
+                                       super(ptr);
+                                       this.bindings_instance = null;
+                                   } else {
+                                       // TODO: private constructor instantiation
+                                       super(bindings.LDKLogger_new(arg));
+                                       this.ptrs_to.push(arg);
+                                       
+                                   }
+                }
+
+                protected finalize() {
+                    if (this.ptr != 0) {
+                        bindings.Logger_free(this.ptr);
+                    }
+                    super.finalize();
+                }
+
+                static new_impl(arg: LoggerInterface): Logger {
+                    const impl_holder: LDKLoggerHolder = new LDKLoggerHolder();
+                    let structImplementation = <bindings.LDKLogger>{
+                        // todo: in-line interface filling
+                        log (record: String): void {
+                                                       arg.log(record);
+                                               },
+
+                                               
+                    };
+                    impl_holder.held = new Logger (null, structImplementation);
+                }
+            }
+
+            export interface LoggerInterface {
+                log(record: String): void;
+                               
+            }
+
+            class LDKLoggerHolder {
+                held: Logger;
+            }
 }