Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / Ping.swift
1 import LDKCHeaders
2
3 public class Ping {
4
5     public internal(set) var cOpaqueStruct: LDKPing?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(ponglen_arg: UInt16, byteslen_arg: UInt16) {
9         
10         self.cOpaqueStruct = Ping_new(ponglen_arg, byteslen_arg)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKPing){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_ponglen() -> UInt16 {
21         
22         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPing>) in
23 Ping_get_ponglen(this_ptrPointer)
24 };
25     }
26
27     public func set_ponglen(val: UInt16) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKPing>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return Ping_set_ponglen(this_ptrPointer, val);
33     }
34
35     public func get_byteslen() -> UInt16 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPing>) in
38 Ping_get_byteslen(this_ptrPointer)
39 };
40     }
41
42     public func set_byteslen(val: UInt16) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKPing>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return Ping_set_byteslen(this_ptrPointer, val);
48     }
49
50     public func clone(orig: Ping) -> Ping {
51         
52         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKPing>) in
53 Ping(pointer: Ping_clone(origPointer))
54 };
55     }
56
57     public func write(obj: Ping) -> [UInt8] {
58         
59         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKPing>) in
60 Ping_write(objPointer)
61 });
62     }
63
64     public func read(ser: [UInt8]) -> Result_PingDecodeErrorZ {
65         
66         return Result_PingDecodeErrorZ(pointer: Ping_read(Bindings.new_LDKu8slice(array: ser)));
67     }
68
69                                 
70         deinit {
71                                         if self.cOpaqueStruct?.is_owned == false {
72
73                                         
74                                         
75                 Ping_free(self.cOpaqueStruct!)
76                                         
77 }
78                                 
79         }
80                         
81     /* STRUCT_METHODS_END */
82
83 }