3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class MessageSendEventsProvider extends CommonBase {
10 bindings_instance?: bindings.LDKMessageSendEventsProvider;
12 constructor(ptr?: number, arg?: bindings.LDKMessageSendEventsProvider) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKMessageSendEventsProvider_new(arg));
19 this.ptrs_to.push(arg);
24 protected finalize() {
26 bindings.MessageSendEventsProvider_free(this.ptr);
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;
43 impl_holder.held = new MessageSendEventsProvider (null, structImplementation);
47 export interface MessageSendEventsProviderInterface {
48 get_and_clear_pending_msg_events(): MessageSendEvent[];
52 class LDKMessageSendEventsProviderHolder {
53 held: MessageSendEventsProvider;
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;
64 return ret_conv_18_arr;