Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / RouteHop.swift
1 import LDKCHeaders
2
3 public class RouteHop {
4
5     public internal(set) var cOpaqueStruct: LDKRouteHop?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(pubkey_arg: [UInt8], node_features_arg: NodeFeatures, short_channel_id_arg: UInt64, channel_features_arg: ChannelFeatures, fee_msat_arg: UInt64, cltv_expiry_delta_arg: UInt32) {
9         
10         self.cOpaqueStruct = RouteHop_new(Bindings.new_LDKPublicKey(array: pubkey_arg), node_features_arg.cOpaqueStruct!, short_channel_id_arg, channel_features_arg.cOpaqueStruct!, fee_msat_arg, cltv_expiry_delta_arg)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKRouteHop){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_pubkey() -> [UInt8] {
21         
22         return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
23 RouteHop_get_pubkey(this_ptrPointer)
24 });
25     }
26
27     public func set_pubkey(val: [UInt8]) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return RouteHop_set_pubkey(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
33     }
34
35     public func get_node_features() -> NodeFeatures {
36         
37         return NodeFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
38 RouteHop_get_node_features(this_ptrPointer)
39 });
40     }
41
42     public func set_node_features(val: NodeFeatures) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return RouteHop_set_node_features(this_ptrPointer, val.cOpaqueStruct!);
48     }
49
50     public func get_short_channel_id() -> UInt64 {
51         
52         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
53 RouteHop_get_short_channel_id(this_ptrPointer)
54 };
55     }
56
57     public func set_short_channel_id(val: UInt64) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return RouteHop_set_short_channel_id(this_ptrPointer, val);
63     }
64
65     public func get_channel_features() -> ChannelFeatures {
66         
67         return ChannelFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
68 RouteHop_get_channel_features(this_ptrPointer)
69 });
70     }
71
72     public func set_channel_features(val: ChannelFeatures) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return RouteHop_set_channel_features(this_ptrPointer, val.cOpaqueStruct!);
78     }
79
80     public func get_fee_msat() -> UInt64 {
81         
82         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
83 RouteHop_get_fee_msat(this_ptrPointer)
84 };
85     }
86
87     public func set_fee_msat(val: UInt64) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return RouteHop_set_fee_msat(this_ptrPointer, val);
93     }
94
95     public func get_cltv_expiry_delta() -> UInt32 {
96         
97         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRouteHop>) in
98 RouteHop_get_cltv_expiry_delta(this_ptrPointer)
99 };
100     }
101
102     public func set_cltv_expiry_delta(val: UInt32) -> Void {
103         
104                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRouteHop>.allocate(capacity: 1)
105                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
106                                                 
107         return RouteHop_set_cltv_expiry_delta(this_ptrPointer, val);
108     }
109
110     public func clone(orig: RouteHop) -> RouteHop {
111         
112         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKRouteHop>) in
113 RouteHop(pointer: RouteHop_clone(origPointer))
114 };
115     }
116
117     public func write(obj: RouteHop) -> [UInt8] {
118         
119         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKRouteHop>) in
120 RouteHop_write(objPointer)
121 });
122     }
123
124     public func read(ser: [UInt8]) -> Result_RouteHopDecodeErrorZ {
125         
126         return Result_RouteHopDecodeErrorZ(pointer: RouteHop_read(Bindings.new_LDKu8slice(array: ser)));
127     }
128
129                                 
130         deinit {
131                                         if self.cOpaqueStruct?.is_owned == false {
132
133                                         
134                                         
135                 RouteHop_free(self.cOpaqueStruct!)
136                                         
137 }
138                                 
139         }
140                         
141     /* STRUCT_METHODS_END */
142
143 }