]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/CustomMessageReader.ts
Update auto-updated Java files
[ldk-java] / ts / structs / CustomMessageReader.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class CustomMessageReader extends CommonBase {
9
10                 bindings_instance?: bindings.LDKCustomMessageReader;
11
12                 constructor(ptr?: number, arg?: bindings.LDKCustomMessageReader) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKCustomMessageReader_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.CustomMessageReader_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: CustomMessageReaderInterface): CustomMessageReader {
32                     const impl_holder: LDKCustomMessageReaderHolder = new LDKCustomMessageReaderHolder();
33                     let structImplementation = <bindings.LDKCustomMessageReader>{
34                         // todo: in-line interface filling
35                         read (message_type: number, buffer: Uint8Array): number {
36                                                         Result_COption_TypeZDecodeErrorZ ret = arg.read(message_type, buffer);
37                                 result: number = ret == null ? 0 : ret.clone_ptr();
38                                 return result;
39                                                 },
40
41                                                 
42                     };
43                     impl_holder.held = new CustomMessageReader (null, structImplementation);
44                 }
45             }
46
47             export interface CustomMessageReaderInterface {
48                 read(message_type: number, buffer: Uint8Array): Result_COption_TypeZDecodeErrorZ;
49                                 
50             }
51
52             class LDKCustomMessageReaderHolder {
53                 held: CustomMessageReader;
54             }
55         public Result_COption_TypeZDecodeErrorZ read(number message_type, Uint8Array buffer) {
56                 number ret = bindings.CustomMessageReader_read(this.ptr, message_type, buffer);
57                 Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
58                 return ret_hu_conv;
59         }
60
61 }