]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/EventsProvider.ts
Fix CI
[ldk-java] / ts / structs / EventsProvider.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class EventsProvider extends CommonBase {
9
10                 bindings_instance?: bindings.LDKEventsProvider;
11
12                 constructor(ptr?: number, arg?: bindings.LDKEventsProvider) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKEventsProvider_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.EventsProvider_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: EventsProviderInterface): EventsProvider {
32                     const impl_holder: LDKEventsProviderHolder = new LDKEventsProviderHolder();
33                     let structImplementation = <bindings.LDKEventsProvider>{
34                         // todo: in-line interface filling
35                         get_and_clear_pending_events (): number[] {
36                                                         Event[] ret = arg.get_and_clear_pending_events();
37                                 result: number[] = Arrays.stream(ret).map(ret_conv_7 -> ret_conv_7.ptr).toArray(number[]::new);
38                                 /* TODO 2 Event  */;
39                                 return result;
40                                                 },
41
42                                                 
43                     };
44                     impl_holder.held = new EventsProvider (null, structImplementation);
45                 }
46             }
47
48             export interface EventsProviderInterface {
49                 get_and_clear_pending_events(): Event[];
50                                 
51             }
52
53             class LDKEventsProviderHolder {
54                 held: EventsProvider;
55             }
56         public Event[] get_and_clear_pending_events() {
57                 number[] ret = bindings.EventsProvider_get_and_clear_pending_events(this.ptr);
58                 Event[] ret_conv_7_arr = new Event[ret.length];
59                 for (int h = 0; h < ret.length; h++) {
60                         number ret_conv_7 = ret[h];
61                         Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7);
62                         ret_conv_7_hu_conv.ptrs_to.add(this);
63                         ret_conv_7_arr[h] = ret_conv_7_hu_conv;
64                 }
65                 return ret_conv_7_arr;
66         }
67
68 }