X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FResult_ChannelPublicKeysDecodeErrorZ.java;h=cad6c6d1131e29b2852b9daa848a56e26a8afe92;hb=ffdd56c967087cba7548599934585b8a9a3102e2;hp=b23524e887d219cb0ef9631dae351b0a01605a19;hpb=32692e00046b7ec16b6a2e20bd54800b2b48d4c0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java index b23524e8..cad6c6d1 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { @@ -12,8 +13,12 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { if (ptr != 0) { bindings.CResult_ChannelPublicKeysDecodeErrorZ_free(ptr); } super.finalize(); } + protected void force_free() { + if (ptr != 0) { bindings.CResult_ChannelPublicKeysDecodeErrorZ_free(ptr); ptr = 0; } + } + static Result_ChannelPublicKeysDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(ptr)) { + if (bindings.CResult_ChannelPublicKeysDecodeErrorZ_is_ok(ptr)) { return new Result_ChannelPublicKeysDecodeErrorZ_OK(null, ptr); } else { return new Result_ChannelPublicKeysDecodeErrorZ_Err(null, ptr); @@ -23,9 +28,9 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { public final ChannelPublicKeys res; private Result_ChannelPublicKeysDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); - long res = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(ptr); - ChannelPublicKeys res_hu_conv = new ChannelPublicKeys(null, res); - res_hu_conv.ptrs_to.add(this); + long res = bindings.CResult_ChannelPublicKeysDecodeErrorZ_get_ok(ptr); + org.ldk.structs.ChannelPublicKeys res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, res); } + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; this.res = res_hu_conv; } } @@ -34,9 +39,9 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { public final DecodeError err; private Result_ChannelPublicKeysDecodeErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); - long err = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(ptr); - DecodeError err_hu_conv = new DecodeError(null, err); - err_hu_conv.ptrs_to.add(this); + long err = bindings.CResult_ChannelPublicKeysDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; this.err = err_hu_conv; } } @@ -44,30 +49,50 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { /** * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. */ - public static Result_ChannelPublicKeysDecodeErrorZ ok(ChannelPublicKeys o) { - long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); - if (ret >= 0 && ret < 1024) { return null; } + public static Result_ChannelPublicKeysDecodeErrorZ ok(org.ldk.structs.ChannelPublicKeys o) { + long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } /** * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. */ - public static Result_ChannelPublicKeysDecodeErrorZ err(DecodeError e) { - long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); - if (ret >= 0 && ret < 1024) { return null; } + public static Result_ChannelPublicKeysDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ public Result_ChannelPublicKeysDecodeErrorZ clone() { long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }