[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / Future.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
9 /**
10  * A simple future which can complete once, and calls some callback(s) when it does so.
11  * 
12  * Clones can be made and all futures cloned from the same source will complete at the same time.
13  */
14 public class Future : CommonBase {
15         internal Future(object _dummy, long ptr) : base(ptr) { }
16         ~Future() {
17                 if (ptr != 0) { bindings.Future_free(ptr); }
18         }
19
20         internal long clone_ptr() {
21                 long ret = bindings.Future_clone_ptr(this.ptr);
22                 GC.KeepAlive(this);
23                 return ret;
24         }
25
26         /**
27          * Creates a copy of the Future
28          */
29         public Future clone() {
30                 long ret = bindings.Future_clone(this.ptr);
31                 GC.KeepAlive(this);
32                 if (ret >= 0 && ret <= 4096) { return null; }
33                 org.ldk.structs.Future ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Future(null, ret); }
34                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35                 return ret_hu_conv;
36         }
37
38         /**
39          * Registers a callback to be called upon completion of this future. If the future has already
40          * completed, the callback will be called immediately.
41          */
42         public void register_callback_fn(org.ldk.structs.FutureCallback callback) {
43                 bindings.Future_register_callback_fn(this.ptr, callback.ptr);
44                 GC.KeepAlive(this);
45                 GC.KeepAlive(callback);
46                 if (this != null) { this.ptrs_to.AddLast(callback); };
47         }
48
49         /**
50          * Waits until this [`Future`] completes.
51          */
52         public void wait() {
53                 bindings.Future_wait(this.ptr);
54                 GC.KeepAlive(this);
55                 if (this != null) { this.ptrs_to.AddLast(this); };
56         }
57
58         /**
59          * Waits until this [`Future`] completes or the given amount of time has elapsed.
60          * 
61          * Returns true if the [`Future`] completed, false if the time elapsed.
62          */
63         public bool wait_timeout(long max_wait) {
64                 bool ret = bindings.Future_wait_timeout(this.ptr, max_wait);
65                 GC.KeepAlive(this);
66                 GC.KeepAlive(max_wait);
67                 if (this != null) { this.ptrs_to.AddLast(this); };
68                 return ret;
69         }
70
71 }
72 } } }