6 namespace org { namespace ldk { namespace structs {
9 * All-encompassing standard error type that processing can return
11 public class GraphSyncError : CommonBase {
12 protected GraphSyncError(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.GraphSyncError_free(ptr); }
17 internal static GraphSyncError constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKGraphSyncError_ty_from_ptr(ptr);
20 case 0: return new GraphSyncError_DecodeError(ptr);
21 case 1: return new GraphSyncError_LightningError(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A GraphSyncError of type DecodeError */
28 public class GraphSyncError_DecodeError : GraphSyncError {
29 public DecodeError decode_error;
30 internal GraphSyncError_DecodeError(long ptr) : base(null, ptr) {
31 long decode_error = bindings.LDKGraphSyncError_DecodeError_get_decode_error(ptr);
32 org.ldk.structs.DecodeError decode_error_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(decode_error);
33 if (decode_error_hu_conv != null) { decode_error_hu_conv.ptrs_to.AddLast(this); };
34 this.decode_error = decode_error_hu_conv;
37 /** A GraphSyncError of type LightningError */
38 public class GraphSyncError_LightningError : GraphSyncError {
39 public LightningError lightning_error;
40 internal GraphSyncError_LightningError(long ptr) : base(null, ptr) {
41 long lightning_error = bindings.LDKGraphSyncError_LightningError_get_lightning_error(ptr);
42 org.ldk.structs.LightningError lightning_error_hu_conv = null; if (lightning_error < 0 || lightning_error > 4096) { lightning_error_hu_conv = new org.ldk.structs.LightningError(null, lightning_error); }
43 if (lightning_error_hu_conv != null) { lightning_error_hu_conv.ptrs_to.AddLast(this); };
44 this.lightning_error = lightning_error_hu_conv;
47 internal long clone_ptr() {
48 long ret = bindings.GraphSyncError_clone_ptr(this.ptr);
54 * Creates a copy of the GraphSyncError
56 public GraphSyncError clone() {
57 long ret = bindings.GraphSyncError_clone(this.ptr);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
61 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
66 * Utility method to constructs a new DecodeError-variant GraphSyncError
68 public static GraphSyncError decode_error(org.ldk.structs.DecodeError a) {
69 long ret = bindings.GraphSyncError_decode_error(a.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
78 * Utility method to constructs a new LightningError-variant GraphSyncError
80 public static GraphSyncError lightning_error(org.ldk.structs.LightningError a) {
81 long ret = bindings.GraphSyncError_lightning_error(a == null ? 0 : a.ptr);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };