b99fd456af0890c858f1bafd247cd8a476d95d17
[ldk-java] / ts / structs / ChannelInfo.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export default class ChannelInfo extends CommonBase {
9                 constructor(_dummy: object, ptr: number) {
10                     super(ptr);
11                 }
12
13                 
14                 protected finalize() {
15                     super.finalize();
16
17                     if (this.ptr != 0) {
18                         bindings.ChannelInfo_free(this.ptr);
19                     }
20                 }
21         public ChannelFeatures get_features() {
22                 number ret = bindings.ChannelInfo_get_features(this.ptr);
23                 const ret_hu_conv: ChannelFeatures = new ChannelFeatures(null, ret);
24                 ret_hu_conv.ptrs_to.add(this);
25                 return ret_hu_conv;
26         }
27
28         public void set_features(ChannelFeatures val) {
29                 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
30                 this.ptrs_to.add(val);
31                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
32                 // an object to pass exclusive ownership to the function being called.
33                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
34                 // at the FFI layer, creating a new object which Rust can claim ownership of
35                 // However, in some cases (eg here), there is no way to clone an object, and thus
36                 // we actually have to pass full ownership to Rust.
37                 // Thus, after this call, val is reset to null and is now a dummy object.
38                 val.ptr = 0;
39         }
40
41         public Uint8Array get_node_one() {
42                 Uint8Array ret = bindings.ChannelInfo_get_node_one(this.ptr);
43                 return ret;
44         }
45
46         public void set_node_one(Uint8Array val) {
47                 bindings.ChannelInfo_set_node_one(this.ptr, val);
48         }
49
50         public DirectionalChannelInfo get_one_to_two() {
51                 number ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
52                 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
53                 ret_hu_conv.ptrs_to.add(this);
54                 return ret_hu_conv;
55         }
56
57         public void set_one_to_two(DirectionalChannelInfo val) {
58                 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
59                 this.ptrs_to.add(val);
60         }
61
62         public Uint8Array get_node_two() {
63                 Uint8Array ret = bindings.ChannelInfo_get_node_two(this.ptr);
64                 return ret;
65         }
66
67         public void set_node_two(Uint8Array val) {
68                 bindings.ChannelInfo_set_node_two(this.ptr, val);
69         }
70
71         public DirectionalChannelInfo get_two_to_one() {
72                 number ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
73                 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
74                 ret_hu_conv.ptrs_to.add(this);
75                 return ret_hu_conv;
76         }
77
78         public void set_two_to_one(DirectionalChannelInfo val) {
79                 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
80                 this.ptrs_to.add(val);
81         }
82
83         public ChannelAnnouncement get_announcement_message() {
84                 number ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
85                 const ret_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, ret);
86                 ret_hu_conv.ptrs_to.add(this);
87                 return ret_hu_conv;
88         }
89
90         public void set_announcement_message(ChannelAnnouncement val) {
91                 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
92                 this.ptrs_to.add(val);
93         }
94
95         public Uint8Array write() {
96                 Uint8Array ret = bindings.ChannelInfo_write(this.ptr);
97                 return ret;
98         }
99
100         public static ChannelInfo constructor_read(Uint8Array ser) {
101                 number ret = bindings.ChannelInfo_read(ser);
102                 const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret);
103                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
104                 return ret_hu_conv;
105         }
106
107 }