Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / traits / Listen.swift
1 import LDKCHeaders
2 import LDKCHeaders
3 open class Listen {
4
5     public var cOpaqueStruct: LDKListen?;
6
7     public init() {
8
9         /* NATIVE_CALLBACKS_START */
10
11                 func block_connectedCallback(pointer: UnsafeRawPointer?, block: LDKu8slice, height: UInt32) -> Void {
12                         let instance: Listen = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Listen.swift::block_connected")
13                         
14                         return instance.block_connected(block: Bindings.LDKu8slice_to_array(nativeType: block), height: height);
15                 }
16
17                 func block_disconnectedCallback(pointer: UnsafeRawPointer?, headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>?, height: UInt32) -> Void {
18                         let instance: Listen = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Listen.swift::block_disconnected")
19                         
20                                                                 var header: [UInt8]? = nil
21                                                                 if let headerUnwrapped = headerPointer {
22                                                                         header = Bindings.tuple80_to_array(nativeType: headerUnwrapped.pointee)
23                                                                 }
24                                                         
25                         return instance.block_disconnected(header: header, height: height);
26                 }
27
28                 func freeCallback(pointer: UnsafeMutableRawPointer?) -> Void {
29                         let instance: Listen = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Listen.swift::free")
30                         
31                         return instance.free();
32                 }
33
34                 /* NATIVE_CALLBACKS_END */
35
36         self.cOpaqueStruct = LDKListen(this_arg: Bindings.instanceToPointer(instance: self), 
37                         block_connected: block_connectedCallback,
38                         block_disconnected: block_disconnectedCallback,
39                         free: freeCallback)
40     }
41
42     public init(pointer: LDKListen){
43                 self.cOpaqueStruct = pointer
44         }
45
46     /* SWIFT_CALLBACKS_START */
47
48     open func block_connected(block: [UInt8], height: UInt32) -> Void {
49         /* EDIT ME */
50                 
51     }
52
53     open func block_disconnected(header: [UInt8]?, height: UInt32) -> Void {
54         /* EDIT ME */
55                 
56     }
57
58     open func free() -> Void {
59         /* EDIT ME */
60                 
61     }
62
63     /* SWIFT_CALLBACKS_END */
64
65 }
66
67
68 public class NativelyImplementedListen: Listen {
69         /* SWIFT_DEFAULT_CALLBACKS_START */
70
71         public override func block_connected(block: [UInt8], height: UInt32) -> Void {
72                 
73                                 
74                                 self.cOpaqueStruct!.block_connected(self.cOpaqueStruct!.this_arg, Bindings.new_LDKu8slice(array: block), height)
75                                 
76                         
77         }
78
79         public override func block_disconnected(header: [UInt8]?, height: UInt32) -> Void {
80                 
81                                 withUnsafePointer(to: Bindings.array_to_tuple80(array: header!)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
82
83                                 self.cOpaqueStruct!.block_disconnected(self.cOpaqueStruct!.this_arg, headerPointer, height)
84                                 
85 }
86                         
87         }
88
89         public override func free() -> Void {
90                 
91                                 
92                                 self.cOpaqueStruct!.free(self.cOpaqueStruct!.this_arg)
93                                 
94                         
95         }
96
97         /* SWIFT_DEFAULT_CALLBACKS_END */
98 }