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