Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / traits / Access.swift
1 import LDKCHeaders
2 import LDKCHeaders
3 open class Access {
4
5     public var cOpaqueStruct: LDKAccess?;
6
7     public init() {
8
9         /* NATIVE_CALLBACKS_START */
10
11                 func get_utxoCallback(pointer: UnsafeRawPointer?, genesis_hashPointer: 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)>?, short_channel_id: UInt64) -> LDKCResult_TxOutAccessErrorZ {
12                         let instance: Access = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Access.swift::get_utxo")
13                         
14                                                                 var genesis_hash: [UInt8]? = nil
15                                                                 if let genesis_hashUnwrapped = genesis_hashPointer {
16                                                                         genesis_hash = Bindings.tuple32_to_array(nativeType: genesis_hashUnwrapped.pointee)
17                                                                 }
18                                                         
19                         return instance.get_utxo(genesis_hash: genesis_hash, short_channel_id: short_channel_id).cOpaqueStruct!;
20                 }
21
22                 func freeCallback(pointer: UnsafeMutableRawPointer?) -> Void {
23                         let instance: Access = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Access.swift::free")
24                         
25                         return instance.free();
26                 }
27
28                 /* NATIVE_CALLBACKS_END */
29
30         self.cOpaqueStruct = LDKAccess(this_arg: Bindings.instanceToPointer(instance: self), 
31                         get_utxo: get_utxoCallback,
32                         free: freeCallback)
33     }
34
35     public init(pointer: LDKAccess){
36                 self.cOpaqueStruct = pointer
37         }
38
39     /* SWIFT_CALLBACKS_START */
40
41     open func get_utxo(genesis_hash: [UInt8]?, short_channel_id: UInt64) -> Result_TxOutAccessErrorZ {
42         /* EDIT ME */
43                 return Result_TxOutAccessErrorZ(pointer: LDKCResult_TxOutAccessErrorZ())
44     }
45
46     open func free() -> Void {
47         /* EDIT ME */
48                 
49     }
50
51     /* SWIFT_CALLBACKS_END */
52
53 }
54
55
56 public class NativelyImplementedAccess: Access {
57         /* SWIFT_DEFAULT_CALLBACKS_START */
58
59         public override func get_utxo(genesis_hash: [UInt8]?, short_channel_id: UInt64) -> Result_TxOutAccessErrorZ {
60                 
61                                 return withUnsafePointer(to: Bindings.array_to_tuple32(array: genesis_hash!)) { (genesis_hashPointer: 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)>) in
62
63                                 Result_TxOutAccessErrorZ(pointer: self.cOpaqueStruct!.get_utxo(self.cOpaqueStruct!.this_arg, genesis_hashPointer, short_channel_id))
64                                 
65 }
66                         
67         }
68
69         public override func free() -> Void {
70                 
71                                 
72                                 self.cOpaqueStruct!.free(self.cOpaqueStruct!.this_arg)
73                                 
74                         
75         }
76
77         /* SWIFT_DEFAULT_CALLBACKS_END */
78 }