-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DXFeedTimeSeriesSubscription: WIP
- Loading branch information
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// | ||
// Copyright (C) 2024 Devexperts LLC. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. | ||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
|
||
import Foundation | ||
|
||
public class DXFeedTimeSeriesSubscription: DXFeedSubcription { | ||
private var fromTime = Long.max | ||
|
||
|
||
internal init(native: NativeTimeSeriesSubscription?, events: [EventCode]) throws { | ||
try super.init(native: native?.subscription, events: events) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
DXFeedFramework/Native/Subscription/NativeTimeSeriesSubscription.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// | ||
// Copyright (C) 2024 Devexperts LLC. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. | ||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
/// Native wrapper over the Java com.dxfeed.api.DXFeedTimeSeriesSubscription class. | ||
/// The location of the imported functions is in the header files "dxfg_subscription.h". | ||
class NativeTimeSeriesSubscription { | ||
var native: UnsafeMutablePointer<dxfg_time_series_subscription_t>? | ||
|
||
deinit { | ||
if let native = native { | ||
let thread = currentThread() | ||
_ = try? ErrorCheck.nativeCall(thread, | ||
dxfg_JavaObjectHandler_release(thread, | ||
&(native.pointee.sub.handler))) | ||
} | ||
} | ||
|
||
init(native: UnsafeMutablePointer<dxfg_time_series_subscription_t>?) { | ||
self.native = native | ||
var subscription = self.native?.pointee.sub | ||
} | ||
|
||
lazy var subscription: NativeSubscription? = { | ||
if var subscr = native?.pointee.sub { | ||
return NativeSubscription(subscription: &subscr) | ||
} else { | ||
return nil | ||
} | ||
}() | ||
|
||
} |