Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / NodeInfo.swift
1 import LDKCHeaders
2
3 public class NodeInfo {
4
5     public internal(set) var cOpaqueStruct: LDKNodeInfo?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(channels_arg: [UInt64], lowest_inbound_channel_fees_arg: RoutingFees, announcement_info_arg: NodeAnnouncementInfo) {
9         
10         self.cOpaqueStruct = NodeInfo_new(Bindings.new_LDKCVec_u64Z(array: channels_arg), lowest_inbound_channel_fees_arg.cOpaqueStruct!, announcement_info_arg.cOpaqueStruct!)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKNodeInfo){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func set_channels(val: [UInt64]) -> Void {
21         
22                                                         let this_ptrPointer = UnsafeMutablePointer<LDKNodeInfo>.allocate(capacity: 1)
23                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
24                                                 
25         return NodeInfo_set_channels(this_ptrPointer, Bindings.new_LDKCVec_u64Z(array: val));
26     }
27
28     public func get_lowest_inbound_channel_fees() -> RoutingFees {
29         
30         return RoutingFees(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKNodeInfo>) in
31 NodeInfo_get_lowest_inbound_channel_fees(this_ptrPointer)
32 });
33     }
34
35     public func set_lowest_inbound_channel_fees(val: RoutingFees) -> Void {
36         
37                                                         let this_ptrPointer = UnsafeMutablePointer<LDKNodeInfo>.allocate(capacity: 1)
38                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
39                                                 
40         return NodeInfo_set_lowest_inbound_channel_fees(this_ptrPointer, val.cOpaqueStruct!);
41     }
42
43     public func get_announcement_info() -> NodeAnnouncementInfo {
44         
45         return NodeAnnouncementInfo(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKNodeInfo>) in
46 NodeInfo_get_announcement_info(this_ptrPointer)
47 });
48     }
49
50     public func set_announcement_info(val: NodeAnnouncementInfo) -> Void {
51         
52                                                         let this_ptrPointer = UnsafeMutablePointer<LDKNodeInfo>.allocate(capacity: 1)
53                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
54                                                 
55         return NodeInfo_set_announcement_info(this_ptrPointer, val.cOpaqueStruct!);
56     }
57
58     public func clone(orig: NodeInfo) -> NodeInfo {
59         
60         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKNodeInfo>) in
61 NodeInfo(pointer: NodeInfo_clone(origPointer))
62 };
63     }
64
65     public func write(obj: NodeInfo) -> [UInt8] {
66         
67         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKNodeInfo>) in
68 NodeInfo_write(objPointer)
69 });
70     }
71
72     public func read(ser: [UInt8]) -> Result_NodeInfoDecodeErrorZ {
73         
74         return Result_NodeInfoDecodeErrorZ(pointer: NodeInfo_read(Bindings.new_LDKu8slice(array: ser)));
75     }
76
77                                 
78         deinit {
79                                         if self.cOpaqueStruct?.is_owned == false {
80
81                                         
82                                         
83                 NodeInfo_free(self.cOpaqueStruct!)
84                                         
85 }
86                                 
87         }
88                         
89     /* STRUCT_METHODS_END */
90
91 }