-
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
IsolatedDXPublisher
- Loading branch information
Showing
8 changed files
with
162 additions
and
32 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
48 changes: 48 additions & 0 deletions
48
include/dxfeed_graal_cpp_api/isolated/api/IsolatedDXPublisher.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,48 @@ | ||
// Copyright (c) 2024 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include "../../internal/Conf.hpp" | ||
|
||
DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251) | ||
|
||
#include "../../api/DXPublisher.hpp" | ||
|
||
DXFCPP_BEGIN_NAMESPACE | ||
|
||
struct DXPublisherObservableSubscription; | ||
|
||
namespace isolated::api::IsolatedDXPublisher { | ||
|
||
/** | ||
* Calls the Graal SDK function `dxfg_DXPublisher_publishEvents` in isolation. | ||
* | ||
* @param publisher The publisher's handle. | ||
* @param events Events to be published. | ||
* @throws std::invalid_argument if publisher handle is invalid or events' pointer is nullptr. | ||
* @throws JavaException if something happened with the dxFeed API backend. | ||
* @throws GraalException if something happened with the GraalVM. | ||
*/ | ||
void /* int32_t */ publishEvents(/* dxfg_publisher_t * */ const JavaObjectHandle<dxfcpp::DXPublisher> &publisher, | ||
/* dxfg_event_type_list * */ void *events); | ||
|
||
/** | ||
* Calls the Graal SDK function `dxfg_DXPublisher_getSubscription` in isolation. | ||
* | ||
* @param publisher The publisher's handle. | ||
* @param eventType The event type. | ||
* @throws std::invalid_argument if publisher handle is invalid. | ||
* @throws JavaException if something happened with the dxFeed API backend. | ||
* @throws GraalException if something happened with the GraalVM. | ||
* @return The underlying observable subscription's handle. | ||
*/ | ||
JavaObjectHandle<DXPublisherObservableSubscription> /* dxfg_observable_subscription_t * */ | ||
getSubscription(/* dxfg_publisher_t * */ const JavaObjectHandle<dxfcpp::DXPublisher> &publisher, | ||
/* dxfg_event_clazz_t */ const EventTypeEnum &eventType); | ||
|
||
} // namespace isolated::api::IsolatedDXPublisher | ||
|
||
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
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,46 @@ | ||
// Copyright (c) 2024 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfg_api.h> | ||
|
||
#include <dxfeed_graal_cpp_api/api/DXPublisherObservableSubscription.hpp> | ||
#include <dxfeed_graal_cpp_api/isolated/IsolatedCommon.hpp> | ||
#include <dxfeed_graal_cpp_api/isolated/api/IsolatedDXPublisher.hpp> | ||
|
||
DXFCPP_BEGIN_NAMESPACE | ||
|
||
namespace isolated::api::IsolatedDXPublisher { | ||
|
||
void /* int32_t */ publishEvents(/* dxfg_publisher_t * */ const JavaObjectHandle<dxfcpp::DXPublisher> &publisher, | ||
/* dxfg_event_type_list * */ void *events) { | ||
if (!publisher) { | ||
throw std::invalid_argument( | ||
"Unable to execute function `dxfg_DXPublisher_publishEvents`. The `publisher` handle is invalid"); | ||
} | ||
|
||
if (!events) { | ||
throw std::invalid_argument( | ||
"Unable to execute function `dxfg_DXPublisher_publishEvents`. The `events` is nullptr"); | ||
} | ||
|
||
runGraalFunctionAndThrowIfLessThanZero(dxfg_DXPublisher_publishEvents, | ||
static_cast<dxfg_publisher_t *>(publisher.get()), | ||
static_cast<dxfg_event_type_list *>(events)); | ||
} | ||
|
||
JavaObjectHandle<DXPublisherObservableSubscription> /* dxfg_observable_subscription_t * */ | ||
getSubscription(/* dxfg_publisher_t * */ const JavaObjectHandle<dxfcpp::DXPublisher> &publisher, | ||
/* dxfg_event_clazz_t */ const EventTypeEnum &eventType) { | ||
if (!publisher) { | ||
throw std::invalid_argument( | ||
"Unable to execute function `dxfg_DXPublisher_getSubscription`. The `publisher` handle is invalid"); | ||
} | ||
|
||
return JavaObjectHandle<DXPublisherObservableSubscription>(runGraalFunctionAndThrowIfNullptr( | ||
dxfg_DXPublisher_getSubscription, static_cast<dxfg_publisher_t *>(publisher.get()), | ||
static_cast<dxfg_event_clazz_t>(eventType.getId()))); | ||
} | ||
|
||
} // namespace isolated::api::IsolatedDXPublisher | ||
|
||
DXFCPP_END_NAMESPACE |