-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EN-7588] Implement PublishProfiles sample
ObservableSubscriptionChangeListener IsolatedObservableSubscriptionChangeListener
- Loading branch information
1 parent
75007a1
commit 5503703
Showing
6 changed files
with
193 additions
and
6 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
40 changes: 40 additions & 0 deletions
40
...e/dxfeed_graal_cpp_api/isolated/api/osub/IsolatedObservableSubscriptionChangeListener.hpp
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,40 @@ | ||
// Copyright (c) 2024 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include "../../../internal/Conf.hpp" | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251) | ||
|
||
#include "../../../api/osub/ObservableSubscriptionChangeListener.hpp" | ||
|
||
DXFCPP_BEGIN_NAMESPACE | ||
|
||
namespace isolated::api::IsolatedObservableSubscriptionChangeListener { | ||
/** | ||
* Calls the Graal SDK function `dxfg_ObservableSubscriptionChangeListener_new` in isolation. | ||
* @param functionSymbolsAdded A user function that is used as a `symbolsAdded` callback for the listener. | ||
* @param functionSymbolsRemoved A user function that is used as a `symbolsRemoved` callback for the listener. | ||
* @param functionSubscriptionClosed A user function that is used as a `subscriptionClosed` callback for the listener. | ||
* @param userData User data, which is placed each time as a callback parameter when called from listener. | ||
* @return The ObservableSubscriptionChangeListener's handle. | ||
* | ||
* @throws std::invalid_argument if functionSymbolsAdded or functionSymbolsRemoved or functionSubscriptionClosed is | ||
* nullptr. | ||
* @throws JavaException if something happened with the dxFeed API backend. | ||
* @throws GraalException if something happened with the GraalVM. | ||
*/ | ||
/* dxfg_observable_subscription_change_listener_t* */ JavaObjectHandle<dxfcpp::ObservableSubscriptionChangeListener> | ||
create(/* dxfg_ObservableSubscriptionChangeListener_function_symbolsAdded */ void *functionSymbolsAdded, | ||
/* dxfg_ObservableSubscriptionChangeListener_function_symbolsRemoved */ void *functionSymbolsRemoved, | ||
/* dxfg_ObservableSubscriptionChangeListener_function_subscriptionClosed */ void *functionSubscriptionClosed, | ||
void *userData); | ||
} // namespace isolated::api::IsolatedObservableSubscriptionChangeListener | ||
|
||
DXFCPP_END_NAMESPACE | ||
|
||
DXFCXX_DISABLE_MSC_WARNINGS_POP() |
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
44 changes: 44 additions & 0 deletions
44
src/isolated/api/osub/IsolatedObservableSubscriptionChangeListener.cpp
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,44 @@ | ||
// Copyright (c) 2024 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfg_api.h> | ||
|
||
#include <dxfeed_graal_cpp_api/isolated/IsolatedCommon.hpp> | ||
#include <dxfeed_graal_cpp_api/isolated/api/osub/IsolatedObservableSubscriptionChangeListener.hpp> | ||
|
||
DXFCPP_BEGIN_NAMESPACE | ||
|
||
namespace isolated::api::IsolatedObservableSubscriptionChangeListener { | ||
|
||
JavaObjectHandle<dxfcpp::ObservableSubscriptionChangeListener> | ||
create(/* dxfg_ObservableSubscriptionChangeListener_function_symbolsAdded */ void *functionSymbolsAdded, | ||
/* dxfg_ObservableSubscriptionChangeListener_function_symbolsRemoved */ void *functionSymbolsRemoved, | ||
/* dxfg_ObservableSubscriptionChangeListener_function_subscriptionClosed */ void *functionSubscriptionClosed, | ||
void *userData) { | ||
if (!functionSymbolsAdded) { | ||
throw std::invalid_argument( | ||
"Unable to create ObservableSubscriptionChangeListener. The `functionSymbolsAdded` parameter is nullptr"); | ||
} | ||
|
||
if (!functionSymbolsRemoved) { | ||
throw std::invalid_argument( | ||
"Unable to create ObservableSubscriptionChangeListener. The `functionSymbolsRemoved` parameter is nullptr"); | ||
} | ||
|
||
if (!functionSubscriptionClosed) { | ||
throw std::invalid_argument("Unable to create ObservableSubscriptionChangeListener. The " | ||
"`functionSubscriptionClosed` parameter is nullptr"); | ||
} | ||
|
||
return JavaObjectHandle<dxfcpp::ObservableSubscriptionChangeListener>(runGraalFunctionAndThrowIfNullptr( | ||
dxfg_ObservableSubscriptionChangeListener_new, | ||
dxfcpp::bit_cast<dxfg_ObservableSubscriptionChangeListener_function_symbolsAdded>(functionSymbolsAdded), | ||
dxfcpp::bit_cast<dxfg_ObservableSubscriptionChangeListener_function_symbolsRemoved>(functionSymbolsRemoved), | ||
dxfcpp::bit_cast<dxfg_ObservableSubscriptionChangeListener_function_subscriptionClosed>( | ||
functionSubscriptionClosed), | ||
userData)); | ||
} | ||
|
||
} // namespace isolated::api::IsolatedObservableSubscriptionChangeListener | ||
|
||
DXFCPP_END_NAMESPACE |