1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class MessageSendEventsProvider extends CommonBase {
10 final bindings.LDKMessageSendEventsProvider bindings_instance;
11 MessageSendEventsProvider(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
12 private MessageSendEventsProvider(bindings.LDKMessageSendEventsProvider arg) {
13 super(bindings.LDKMessageSendEventsProvider_new(arg));
14 this.ptrs_to.add(arg);
15 this.bindings_instance = arg;
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.MessageSendEventsProvider_free(ptr); } super.finalize();
22 public static interface MessageSendEventsProviderInterface {
23 MessageSendEvent[] get_and_clear_pending_msg_events();
25 private static class LDKMessageSendEventsProviderHolder { MessageSendEventsProvider held; }
26 public static MessageSendEventsProvider new_impl(MessageSendEventsProviderInterface arg) {
27 final LDKMessageSendEventsProviderHolder impl_holder = new LDKMessageSendEventsProviderHolder();
28 impl_holder.held = new MessageSendEventsProvider(new bindings.LDKMessageSendEventsProvider() {
29 @Override public long[] get_and_clear_pending_msg_events() {
30 MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events();
31 long[] result = Arrays.stream(ret).mapToLong(arr_conv_18 -> arr_conv_18.ptr).toArray();
32 /* TODO 2 MessageSendEvent */;
36 return impl_holder.held;
38 public MessageSendEvent[] get_and_clear_pending_msg_events() {
39 long[] ret = bindings.MessageSendEventsProvider_get_and_clear_pending_msg_events(this.ptr);
40 MessageSendEvent[] arr_conv_18_arr = new MessageSendEvent[ret.length];
41 for (int s = 0; s < ret.length; s++) {
42 long arr_conv_18 = ret[s];
43 MessageSendEvent arr_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(arr_conv_18);
44 arr_conv_18_hu_conv.ptrs_to.add(this);
45 arr_conv_18_arr[s] = arr_conv_18_hu_conv;
47 return arr_conv_18_arr;