1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A concrete implementation of [`LockableScore`] which supports multi-threading.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class MultiThreadedLockableScore extends CommonBase {
16 MultiThreadedLockableScore(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.MultiThreadedLockableScore_free(ptr); }
24 * Constructs a new LockableScore which calls the relevant methods on this_arg.
25 * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
27 public LockableScore as_LockableScore() {
28 long ret = bindings.MultiThreadedLockableScore_as_LockableScore(this.ptr);
29 Reference.reachabilityFence(this);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 LockableScore ret_hu_conv = new LockableScore(null, ret);
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
37 * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
39 public byte[] write() {
40 byte[] ret = bindings.MultiThreadedLockableScore_write(this.ptr);
41 Reference.reachabilityFence(this);
46 * Constructs a new WriteableScore which calls the relevant methods on this_arg.
47 * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
49 public WriteableScore as_WriteableScore() {
50 long ret = bindings.MultiThreadedLockableScore_as_WriteableScore(this.ptr);
51 Reference.reachabilityFence(this);
52 if (ret >= 0 && ret <= 4096) { return null; }
53 WriteableScore ret_hu_conv = new WriteableScore(null, ret);
54 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
59 * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
61 public static MultiThreadedLockableScore of(Score score) {
62 long ret = bindings.MultiThreadedLockableScore_new(score == null ? 0 : score.ptr);
63 Reference.reachabilityFence(score);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 org.ldk.structs.MultiThreadedLockableScore ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MultiThreadedLockableScore(null, ret); }
66 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(score); };