6daf0ab887f92f871e88d7f6316ca13987d9d6df
[ldk-java] / c_sharp / src / org / ldk / structs / Result_CVec_CVec_u8ZZNoneZ.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 public class Result_CVec_CVec_u8ZZNoneZ : CommonBase {
9         Result_CVec_CVec_u8ZZNoneZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_CVec_CVec_u8ZZNoneZ() {
11                 if (ptr != 0) { bindings.CResult_CVec_CVec_u8ZZNoneZ_free(ptr); }
12         }
13
14         internal static Result_CVec_CVec_u8ZZNoneZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_CVec_CVec_u8ZZNoneZ_is_ok(ptr)) {
16                         return new Result_CVec_CVec_u8ZZNoneZ_OK(null, ptr);
17                 } else {
18                         return new Result_CVec_CVec_u8ZZNoneZ_Err(null, ptr);
19                 }
20         }
21         public class Result_CVec_CVec_u8ZZNoneZ_OK : Result_CVec_CVec_u8ZZNoneZ {
22                 public readonly byte[][] res;
23                 internal Result_CVec_CVec_u8ZZNoneZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_CVec_CVec_u8ZZNoneZ_get_ok(ptr);
25                         int res_conv_8_len = InternalUtils.getArrayLength(res);
26                         byte[][] res_conv_8_arr = new byte[res_conv_8_len][];
27                         for (int i = 0; i < res_conv_8_len; i++) {
28                                 long res_conv_8 = InternalUtils.getU64ArrayElem(res, i);
29                                 byte[] res_conv_8_conv = InternalUtils.decodeUint8Array(res_conv_8);
30                                 res_conv_8_arr[i] = res_conv_8_conv;
31                         }
32                         bindings.free_buffer(res);
33                         this.res = res_conv_8_arr;
34                 }
35         }
36
37         public class Result_CVec_CVec_u8ZZNoneZ_Err : Result_CVec_CVec_u8ZZNoneZ {
38                 internal Result_CVec_CVec_u8ZZNoneZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
39                 }
40         }
41
42         /**
43          * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
44          */
45         public static Result_CVec_CVec_u8ZZNoneZ ok(byte[][] o) {
46                 long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_ok(InternalUtils.encodeUint64Array(InternalUtils.mapArray(o, o_conv_8 => InternalUtils.encodeUint8Array(o_conv_8))));
47                 GC.KeepAlive(o);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
55          */
56         public static Result_CVec_CVec_u8ZZNoneZ err() {
57                 long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_err();
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
60                 return ret_hu_conv;
61         }
62
63         /**
64          * Checks if the given object is currently in the success state
65          */
66         public bool is_ok() {
67                 bool ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_is_ok(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         internal long clone_ptr() {
73                 long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(this.ptr);
74                 GC.KeepAlive(this);
75                 return ret;
76         }
77
78         /**
79          * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
80          * but with all dynamically-allocated buffers duplicated in new buffers.
81          */
82         public Result_CVec_CVec_u8ZZNoneZ clone() {
83                 long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_clone(this.ptr);
84                 GC.KeepAlive(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
87                 return ret_hu_conv;
88         }
89
90 }
91 } } }