Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / GossipTimestampFilter.swift
1 import LDKCHeaders
2
3 public class GossipTimestampFilter {
4
5     public internal(set) var cOpaqueStruct: LDKGossipTimestampFilter?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(chain_hash_arg: [UInt8], first_timestamp_arg: UInt32, timestamp_range_arg: UInt32) {
9         
10         self.cOpaqueStruct = GossipTimestampFilter_new(Bindings.new_LDKThirtyTwoBytes(array: chain_hash_arg), first_timestamp_arg, timestamp_range_arg)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKGossipTimestampFilter){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_chain_hash() -> [UInt8] {
21         
22         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKGossipTimestampFilter>) in
23 GossipTimestampFilter_get_chain_hash(this_ptrPointer)
24 }.pointee);
25     }
26
27     public func set_chain_hash(val: [UInt8]) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKGossipTimestampFilter>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return GossipTimestampFilter_set_chain_hash(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
33     }
34
35     public func get_first_timestamp() -> UInt32 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKGossipTimestampFilter>) in
38 GossipTimestampFilter_get_first_timestamp(this_ptrPointer)
39 };
40     }
41
42     public func set_first_timestamp(val: UInt32) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKGossipTimestampFilter>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return GossipTimestampFilter_set_first_timestamp(this_ptrPointer, val);
48     }
49
50     public func get_timestamp_range() -> UInt32 {
51         
52         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKGossipTimestampFilter>) in
53 GossipTimestampFilter_get_timestamp_range(this_ptrPointer)
54 };
55     }
56
57     public func set_timestamp_range(val: UInt32) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKGossipTimestampFilter>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return GossipTimestampFilter_set_timestamp_range(this_ptrPointer, val);
63     }
64
65     public func clone(orig: GossipTimestampFilter) -> GossipTimestampFilter {
66         
67         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKGossipTimestampFilter>) in
68 GossipTimestampFilter(pointer: GossipTimestampFilter_clone(origPointer))
69 };
70     }
71
72     public func read(ser: [UInt8]) -> Result_GossipTimestampFilterDecodeErrorZ {
73         
74         return Result_GossipTimestampFilterDecodeErrorZ(pointer: GossipTimestampFilter_read(Bindings.new_LDKu8slice(array: ser)));
75     }
76
77     public func write(obj: GossipTimestampFilter) -> [UInt8] {
78         
79         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKGossipTimestampFilter>) in
80 GossipTimestampFilter_write(objPointer)
81 });
82     }
83
84                                 
85         deinit {
86                                         if self.cOpaqueStruct?.is_owned == false {
87
88                                         
89                                         
90                 GossipTimestampFilter_free(self.cOpaqueStruct!)
91                                         
92 }
93                                 
94         }
95                         
96     /* STRUCT_METHODS_END */
97
98 }