Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / RoutingFees.swift
1 import LDKCHeaders
2
3 public class RoutingFees {
4
5     public internal(set) var cOpaqueStruct: LDKRoutingFees?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(base_msat_arg: UInt32, proportional_millionths_arg: UInt32) {
9         
10         self.cOpaqueStruct = RoutingFees_new(base_msat_arg, proportional_millionths_arg)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKRoutingFees){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_base_msat() -> UInt32 {
21         
22         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRoutingFees>) in
23 RoutingFees_get_base_msat(this_ptrPointer)
24 };
25     }
26
27     public func set_base_msat(val: UInt32) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRoutingFees>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return RoutingFees_set_base_msat(this_ptrPointer, val);
33     }
34
35     public func get_proportional_millionths() -> UInt32 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRoutingFees>) in
38 RoutingFees_get_proportional_millionths(this_ptrPointer)
39 };
40     }
41
42     public func set_proportional_millionths(val: UInt32) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRoutingFees>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return RoutingFees_set_proportional_millionths(this_ptrPointer, val);
48     }
49
50     public func eq(a: RoutingFees, b: RoutingFees) -> Bool {
51         
52         return withUnsafePointer(to: a.cOpaqueStruct!) { (aPointer: UnsafePointer<LDKRoutingFees>) in
53 withUnsafePointer(to: b.cOpaqueStruct!) { (bPointer: UnsafePointer<LDKRoutingFees>) in
54 RoutingFees_eq(aPointer, bPointer)
55 }
56 };
57     }
58
59     public func clone(orig: RoutingFees) -> RoutingFees {
60         
61         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKRoutingFees>) in
62 RoutingFees(pointer: RoutingFees_clone(origPointer))
63 };
64     }
65
66     public func write(obj: RoutingFees) -> [UInt8] {
67         
68         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKRoutingFees>) in
69 RoutingFees_write(objPointer)
70 });
71     }
72
73     public func read(ser: [UInt8]) -> Result_RoutingFeesDecodeErrorZ {
74         
75         return Result_RoutingFeesDecodeErrorZ(pointer: RoutingFees_read(Bindings.new_LDKu8slice(array: ser)));
76     }
77
78                                 
79         deinit {
80                                         if self.cOpaqueStruct?.is_owned == false {
81
82                                         
83                                         
84                 RoutingFees_free(self.cOpaqueStruct!)
85                                         
86 }
87                                 
88         }
89                         
90     /* STRUCT_METHODS_END */
91
92 }