dxFeed Graal CXX API v8.1.0
Loading...
Searching...
No Matches
SymbolWrapper.hpp
1// Copyright (c) 2025 Devexperts LLC.
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include "../internal/Conf.hpp"
7
9
10#include "../api/osub/IndexedEventSubscriptionSymbol.hpp"
11#include "../api/osub/TimeSeriesSubscriptionSymbol.hpp"
12#include "../api/osub/WildcardSymbol.hpp"
13#include "../event/candle/CandleSymbol.hpp"
14#include "../internal/Common.hpp"
15#include "./StringSymbol.hpp"
16
17#include <cstdint>
18#include <memory>
19#include <optional>
20#include <ostream>
21#include <utility>
22#include <variant>
23
24/**
25 * \addtogroup dxfcpp_symbols
26 * @{
27 */
28
30
31/**
32 * A concept describing a symbol that can be wrapped.
33 *
34 * @tparam T Probable symbol type
35 */
36template <typename T>
37concept ConvertibleToSymbolWrapper =
38 ConvertibleToStringSymbol<std::decay_t<T>> || std::is_same_v<std::decay_t<T>, WildcardSymbol> ||
39 std::is_same_v<std::decay_t<T>, IndexedEventSubscriptionSymbol> ||
40 std::is_same_v<std::decay_t<T>, TimeSeriesSubscriptionSymbol> || std::is_same_v<std::decay_t<T>, CandleSymbol>;
41
42/**
43 * A concept that defines a collection of wrapped or wrapping symbols.
44 *
45 * @tparam Collection The collection type
46 */
47template <typename Collection>
48concept ConvertibleToSymbolWrapperCollection =
49 requires(Collection c) {
50 std::begin(c);
51 std::end(c);
52 } &&
53 (
54 requires(Collection c) {
55 { *std::begin(c) } -> ConvertibleTo<SymbolWrapper>;
56 } ||
57 requires(Collection c) {
58 { *std::begin(c) } -> ConvertibleToSymbolWrapper;
59 });
60
61/**
62 * A helper wrapper class needed to pass heterogeneous symbols using a container and convert them to internal Graal
63 * representation.
64 */
65struct DXFCPP_EXPORT SymbolWrapper final {
66 using DataType = typename std::variant<WildcardSymbol, StringSymbol, IndexedEventSubscriptionSymbol,
67 TimeSeriesSubscriptionSymbol, CandleSymbol>;
68
69 class DXFCPP_EXPORT SymbolListUtils final {
70 static std::ptrdiff_t calculateGraalListSize(std::ptrdiff_t initSize) noexcept;
71 static void *newGraalList(std::ptrdiff_t size);
72 static bool setGraalListElement(void *graalList, std::ptrdiff_t elementIdx, void *element) noexcept;
73 static bool freeGraalListElements(void *graalList, std::ptrdiff_t count);
74
75 public:
76 template <typename SymbolIt> static void *toGraalList(SymbolIt begin, SymbolIt end) {
77 if constexpr (Debugger::isDebug) {
78 Debugger::debug("SymbolWrapper::toGraalList(symbols = " + elementsToString(begin, end) + ")");
79 }
80
81 auto size = calculateGraalListSize(std::distance(begin, end));
82
83 // Zero size is needed, for example, to clear the list of symbols.
84 auto *list = newGraalList(size);
85
86 if (!list || size == 0) {
87 return list;
88 }
89
90 std::ptrdiff_t elementIdx = 0;
91 bool needToFree = false;
92
93 for (auto it = begin; it != end && elementIdx < size; it++, elementIdx++) {
94 if constexpr (requires { it->toGraal(); }) {
95 needToFree = setGraalListElement(list, elementIdx, it->toGraal()) == false;
96 } else if constexpr (std::is_convertible_v<decltype(*it), SymbolWrapper> ||
97 dxfcpp::ConvertibleToSymbolWrapper<decltype(*it)>) {
98 needToFree = setGraalListElement(list, elementIdx, SymbolWrapper(*it).toGraal()) == false;
99 }
100
101 if (needToFree) {
102 break;
103 }
104 }
105
106 if (needToFree) {
107 freeGraalListElements(list, elementIdx);
108
109 return nullptr;
110 }
111
112 return list;
113 }
114
115 template <ConvertibleToSymbolWrapperCollection SymbolsCollection>
116 static void *toGraalList(const SymbolsCollection &collection) {
117 return SymbolListUtils::toGraalList(std::begin(collection), std::end(collection));
118 }
119
120 static void *toGraalList(std::initializer_list<SymbolWrapper> collection) {
121 return SymbolListUtils::toGraalList(collection.begin(), collection.end());
122 }
123
124 static void freeGraalList(void *graalList);
125
126 template <typename SymbolIt>
127 static std::unique_ptr<void, decltype(&freeGraalList)> toGraalListUnique(SymbolIt begin, SymbolIt end) {
128 return {toGraalList(begin, end), freeGraalList};
129 }
130
131 template <ConvertibleToSymbolWrapperCollection SymbolsCollection>
132 static std::unique_ptr<void, decltype(&freeGraalList)> toGraalListUnique(const SymbolsCollection &collection) {
133 return {toGraalList(collection), freeGraalList};
134 }
135
136 static std::unique_ptr<void, decltype(&freeGraalList)>
137 toGraalListUnique(std::initializer_list<SymbolWrapper> collection);
138
139 static std::vector<SymbolWrapper> fromGraalList(void *graalList);
140 };
141
142 private:
143 DataType data_;
144
145 public:
146 SymbolWrapper(const SymbolWrapper &) noexcept;
147 SymbolWrapper(SymbolWrapper &&) noexcept;
148 SymbolWrapper &operator=(const SymbolWrapper &) noexcept;
149 SymbolWrapper &operator=(SymbolWrapper &&) noexcept;
150 SymbolWrapper() noexcept;
151 ~SymbolWrapper() noexcept;
152
153 /**
154 * Constructor for any wrapped symbol.
155 * Must be implicit to wrap symbols passed to collection or container
156 *
157 * @tparam Symbol The symbol type
158 * @param symbol The symbol
159 */
160 template <ConvertibleToStringSymbol Symbol>
162 if constexpr (Debugger::isDebug) {
163 // Could be "perfectly" moved, so it won't show up in the logs
164 Debugger::debug("SymbolWrapper(symbol = " + toStringAny(symbol) + ")");
165 }
166 }
167
168 /**
169 * Constructor for any wrapped string symbol.
170 * Must be implicit to wrap symbols passed to collection or container
171 *
172 * @param stringSymbol The wrapped string (std::string, std::string_view, const char*) symbol
173 */
174 SymbolWrapper(const StringSymbol &stringSymbol) noexcept;
175
176 /**
177 * Constructor for any wrapped wildcard (*) symbol.
178 *
179 * @param wildcardSymbol The wrapped wildcard symbol
180 */
181 SymbolWrapper(const WildcardSymbol &wildcardSymbol) noexcept;
182
183 /**
184 * Constructor for IndexedEventSubscriptionSymbol.
185 *
186 * @param indexedEventSubscriptionSymbol The IndexedEventSubscriptionSymbol
187 */
188 SymbolWrapper(const IndexedEventSubscriptionSymbol &indexedEventSubscriptionSymbol) noexcept;
189
190 /**
191 * Constructor for TimeSeriesSubscriptionSymbol.
192 *
193 * @param timeSeriesSubscriptionSymbol The TimeSeriesSubscriptionSymbol
194 */
195 SymbolWrapper(const TimeSeriesSubscriptionSymbol &timeSeriesSubscriptionSymbol) noexcept;
196
197 /**
198 * Constructor for CandleSymbol.
199 *
200 * @param candleSymbol The CandleSymbol
201 */
202 SymbolWrapper(const CandleSymbol &candleSymbol) noexcept;
203
204 /**
205 * Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
206 *
207 * @param graalNative The pointer to the dxFeed Graal SDK structure.
208 * @throws InvalidArgumentException
209 */
210 static void freeGraal(void *graalNative);
211
212 /**
213 * Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
214 *
215 * @param graalNative The pointer to the dxFeed Graal SDK structure.
216 * @return The object of the current type.
217 * @throws InvalidArgumentException
218 * @throws RuntimeException if symbol type is unknown
219 */
220 static SymbolWrapper fromGraal(void *graalNative);
221
222 /**
223 * Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
224 * Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary).
225 * Returns the pointer to the filled structure.
226 *
227 * @return The pointer to the filled dxFeed Graal SDK structure
228 */
229 void *toGraal() const noexcept;
230
231 /**
232 * Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
233 * Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary).
234 * Returns the pointer to the filled structure.
235 *
236 * @return The smart unique pointer to the filled dxFeed Graal SDK structure
237 */
238 std::unique_ptr<void, decltype(&SymbolWrapper::freeGraal)> toGraalUnique() const noexcept;
239
240 /**
241 * Returns a string representation of the current object.
242 *
243 * @return a string representation
244 */
245 std::string toString() const;
246
247 /**
248 * Returns a string representation of the underlying object.
249 *
250 * @return a string representation of the underlying object.
251 */
253
254 /**
255 * @return `true` if current SymbolWrapper holds a StringSymbol.
256 */
257 bool isStringSymbol() const noexcept;
258
259 /**
260 * @return String representation of StringSymbol or an empty string.
261 */
262 std::string asStringSymbol() const noexcept;
263
264 /**
265 * @return `true` if current SymbolWrapper holds a WildcardSymbol.
266 */
267 bool isWildcardSymbol() const noexcept;
268
269 /**
270 * @return WildcardSymbol (optional) or std::nullopt if current SymbolWrapper doesn't hold WildcardSymbol.
271 */
272 std::optional<WildcardSymbol> asWildcardSymbol() const noexcept;
273
274 /**
275 * @return `true` if current SymbolWrapper holds a IndexedEventSubscriptionSymbol.
276 */
277 bool isIndexedEventSubscriptionSymbol() const noexcept;
278
279 /**
280 * @return IndexedEventSubscriptionSymbol (optional) or std::nullopt if current SymbolWrapper doesn't hold
281 * IndexedEventSubscriptionSymbol.
282 */
284
285 /**
286 * @return `true` if current SymbolWrapper holds a TimeSeriesSubscriptionSymbol.
287 */
288 bool isTimeSeriesSubscriptionSymbol() const noexcept;
289
290 /**
291 * @return TimeSeriesSubscriptionSymbol (optional) or std::nullopt if current SymbolWrapper doesn't hold
292 * TimeSeriesSubscriptionSymbol.
293 */
295
296 /**
297 * @return `true` if current SymbolWrapper holds a CandleSymbol.
298 */
299 bool isCandleSymbol() const noexcept;
300
301 /**
302 * @return CandleSymbol (optional) or std::nullopt if the current SymbolWrapper doesn't hold
303 * CandleSymbol.
304 */
305 std::optional<CandleSymbol> asCandleSymbol() const noexcept;
306
307 /**
308 * @return The internal data.
309 */
310 const DataType &getData() const noexcept;
311
312 bool operator==(const SymbolWrapper &symbolWrapper) const;
313
314 bool operator<(const SymbolWrapper &symbolWrapper) const;
315
316 using GraalPtr = std::unique_ptr<void, decltype(&SymbolWrapper::freeGraal)>;
317
318 friend std::ostream &operator<<(std::ostream &os, const SymbolWrapper &symbolWrapper) {
319 return os << symbolWrapper.toStringUnderlying();
320 }
321};
322
323inline namespace literals {
324
325/**
326 * String literal that helps to construct SymbolWrapper from a char array.
327 *
328 * @param string The char array
329 * @param length Tha char array's length
330 * @return Wrapped string view built on char array
331 */
332inline SymbolWrapper operator""_sw(const char *string, size_t length) noexcept {
333 return {std::string_view{string, length}};
334}
335
336} // namespace literals
337
339
340/// @}
341
342template <> struct std::hash<dxfcpp::SymbolWrapper> {
343 std::size_t operator()(const dxfcpp::SymbolWrapper &symbolWrapper) const noexcept {
344 return std::hash<dxfcpp::SymbolWrapper::DataType>{}(symbolWrapper.getData());
345 }
346};
347
#define DXFCPP_MACRO_CONCAT_INNER(a, b)
Definition Common.hpp:135
#define DXFCPP_MACRO_CONCAT(a, b)
Definition Common.hpp:134
#define DXFCPP_MACRO_UNIQUE_NAME(base)
Definition Common.hpp:136
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:31
#define DXFCXX_DISABLE_CLANG_WARNINGS_PUSH(warnings)
Definition Conf.hpp:65
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:97
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:94
#define DXFCXX_DISABLE_GCC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:47
#define DXFCXX_DISABLE_CLANG_WARNINGS_POP()
Definition Conf.hpp:67
#define DXFCXX_DISABLE_GCC_WARNINGS_POP()
Definition Conf.hpp:49
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:30
#define DXFCPP_TRACE_ISOLATES
Definition Debug.hpp:19
#define DXFCPP_DEBUG
Definition Debug.hpp:15
#define DXFCPP_TRACE_LISTS
Definition Debug.hpp:22
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builderHandle, const char *name)
Changes the name used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs...
Definition DXEndpoint.cpp:721
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_properties(dxfc_dxendpoint_builder_t builder, const dxfc_dxendpoint_property_t **properties, size_t size)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.cpp:754
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:1002
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1192
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_supports_property(dxfc_dxendpoint_builder_t builder, const char *key, DXFC_OUT int *supports)
Checks if a property is supported.
Definition DXEndpoint.cpp:781
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Adds a listener notified about changes in state property.
Definition DXEndpoint.cpp:1138
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:1053
#define DXFCPP_EXPORT
Definition api.h:35
void * dxfc_dxendpoint_builder_t
The dxFeed endpoint's builder handle.
Definition api.h:207
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close_and_await_termination(dxfc_dxendpoint_t endpoint)
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:951
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_await_not_connected(dxfc_dxendpoint_t endpoint)
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:1104
dxfc_dxendpoint_state_t
Represents the current state of endpoint.
Definition api.h:149
@ DXFC_DXENDPOINT_STATE_CLOSED
Endpoint was closed.
Definition api.h:169
@ DXFC_DXENDPOINT_STATE_NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition api.h:153
@ DXFC_DXENDPOINT_STATE_CONNECTING
The connect function was called to establish connection to remove endpoint, but the connection is not...
Definition api.h:159
@ DXFC_DXENDPOINT_STATE_CONNECTED
The connection to the remote endpoint is established.
Definition api.h:164
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of dxFeed endpoint with a FEED role.
Definition DXEndpoint.cpp:840
#define DXFC_OUT
Definition api.h:17
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_state(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_state_t *state)
Returns the state of this endpoint.
Definition DXEndpoint.cpp:1121
void * dxfc_dxendpoint_t
The dxFeed endpoint handle.
Definition api.h:198
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_property(dxfc_dxendpoint_builder_t builder, const char *key, const char *value)
Sets the specified property.
Definition DXEndpoint.cpp:737
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:828
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_connect(dxfc_dxendpoint_t endpoint, const char *address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:1019
dxfc_error_code_t
List of error codes.
Definition api.h:49
@ DXFC_EC_ERROR
The error returned if the current operation cannot be completed.
Definition api.h:60
@ DXFC_EC_SUCCESS
OK.
Definition api.h:53
@ DXFC_EC_G_ERR
dxFeed Graal Native API error.
Definition api.h:57
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_remove_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Removes a listener notified about changes in state property.
Definition DXEndpoint.cpp:1164
DXFCPP_EXPORT dxfc_error_code_t dxfc_system_set_property(const char *key, const char *value)
Sets the system property indicated by the specified key.
Definition System.cpp:74
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Builds the new dxFeed endpoint instance.
Definition DXEndpoint.cpp:798
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1187
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_await_processed(dxfc_dxendpoint_t endpoint)
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:1087
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:934
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates a new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:688
void(* dxfc_dxendpoint_state_change_listener)(dxfc_dxendpoint_state_t old_state, dxfc_dxendpoint_state_t new_state, void *user_data)
The endpoint current state change listener.
Definition api.h:178
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_reconnect(dxfc_dxendpoint_t endpoint)
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:1036
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_role(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_role_t *role)
Returns the role of this endpoint.
Definition DXEndpoint.cpp:968
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:985
DXFCPP_EXPORT dxfc_error_code_t dxfc_system_get_property(const char *key, DXFC_OUT char *buffer, size_t buffer_size)
Gets the system property indicated by the specified key.
dxfc_dxendpoint_role_t
Represents the role of an endpoint that was specified during its creation.
Definition api.h:89
@ DXFC_DXENDPOINT_ROLE_PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition api.h:127
@ DXFC_DXENDPOINT_ROLE_STREAM_FEED
STREAM_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data fee...
Definition api.h:116
@ DXFC_DXENDPOINT_ROLE_FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition api.h:99
@ DXFC_DXENDPOINT_ROLE_STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remot...
Definition api.h:136
@ DXFC_DXENDPOINT_ROLE_LOCAL_HUB
LOCAL_HUB endpoint is a local hub without the ability to establish network connections.
Definition api.h:143
@ DXFC_DXENDPOINT_ROLE_ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with d...
Definition api.h:107
void * dxfc_dxpublisher_t
The dxFeed publisher handle.
Definition api.h:217
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:887
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:863
void * dxfc_dxfeed_t
The dxFeed handle.
Definition api.h:212
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_role(dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role)
Sets role for the created dxFeed endpoint.
Definition DXEndpoint.cpp:704
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:910
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1197
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect_and_clear(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:1070
Builder class for DXEndpoint that supports additional configuration properties.
Definition DXEndpoint.hpp:866
std::shared_ptr< DXEndpoint > build()
Builds DXEndpoint instance.
Definition DXEndpoint.cpp:348
std::shared_ptr< Builder > withName(const StringLike &name)
Changes the name used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs...
Definition DXEndpoint.cpp:391
std::shared_ptr< Builder > withExecutor(const std::shared_ptr< Executor > &executor)
Sets the executor that is used for notifications (events, state changes, etc.) of the endpoint to bui...
Definition DXEndpoint.hpp:995
bool supportsProperty(const StringLike &key) const
Checks if a property is supported.
Definition DXEndpoint.cpp:338
std::shared_ptr< Builder > withProperties(Properties &&properties)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.hpp:957
~Builder() noexcept override
Releases the GraalVM handle.
Definition DXEndpoint.cpp:380
std::shared_ptr< Builder > withRole(Role role)
Sets role for the created DXEndpoint.
Definition DXEndpoint.cpp:300
std::shared_ptr< Builder > withProperty(const StringLike &key, const StringLike &value)
Sets the specified property.
Definition DXEndpoint.cpp:313
Subscription for a set of symbols and event types.
Definition DXFeedSubscription.hpp:45
bool containsEventType(const EventTypeEnum &eventType) override
Returns true if this subscription contains the corresponding event type.
Definition DXFeedSubscription.cpp:229
std::size_t addChangeListener(std::shared_ptr< ObservableSubscriptionChangeListener > listener) override
Adds subscription change listener.
Definition DXFeedSubscription.cpp:320
bool isClosed() override
Returns true if this subscription is closed.
Definition DXFeedSubscription.cpp:205
void addSymbols(SymbolIt begin, SymbolIt end) const
Adds the specified collection (using iterators) of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:434
void close() const
Closes this subscription and makes it permanently detached.
Definition DXFeedSubscription.cpp:214
void setEventsBatchLimit(std::int32_t eventsBatchLimit) const
Sets maximum number of events in the single notification of OnEventHandler.
Definition DXFeedSubscription.cpp:366
std::unordered_set< EventTypeEnum > getEventTypes() override
Returns a set of subscribed event types.
Definition DXFeedSubscription.cpp:225
void setSymbols(std::initializer_list< SymbolWrapper > collection) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.cpp:260
void removeSymbols(SymbolIt begin, SymbolIt end) const
Removes the specified collection (using iterators) of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:506
void removeSymbols(SymbolsCollection &&collection) const
Removes the specified collection of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:532
static const std::int32_t MAX_BATCH_LIMIT
The maximum events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:61
void removeSymbols(const SymbolWrapper &symbolWrapper) const
Removes the specified symbol from the set of subscribed symbols.
Definition DXFeedSubscription.cpp:279
void attach(std::shared_ptr< DXFeed > feed)
Attaches subscription to the specified feed.
Definition DXFeedSubscription.cpp:187
TimePeriod getAggregationPeriod() const
Returns the aggregation period for data for this subscription instance.
Definition DXFeedSubscription.cpp:294
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeedSubscription.cpp:145
static const std::int32_t OPTIMAL_BATCH_LIMIT
The optimal events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:56
std::size_t addEventListener(std::function< void(const std::vector< std::shared_ptr< EventT > > &)> &&listener)
Adds typed listener for events.
Definition DXFeedSubscription.hpp:675
void addSymbols(std::initializer_list< SymbolWrapper > collection) const
Adds the specified collection (initializer list) of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.cpp:275
void setSymbols(SymbolsCollection &&collection) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.hpp:385
void setAggregationPeriod(const TimePeriod &aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:298
static std::shared_ptr< DXFeedSubscription > create(const EventTypeEnum &eventType)
Creates a detached subscription for a single event type.
Definition DXFeedSubscription.cpp:164
std::int32_t getEventsBatchLimit() const
Definition DXFeedSubscription.cpp:362
std::size_t addEventListener(EventListener &&listener)
Adds listener for events.
Definition DXFeedSubscription.hpp:620
static std::shared_ptr< DXFeedSubscription > create(EventTypesCollection &&eventTypes)
Creates a detached subscription for the given collection of event types.
Definition DXFeedSubscription.hpp:261
OnEventHandler & onEvent()
Returns a reference to an incoming events' handler (delegate), to which listeners can be added and re...
Definition DXFeedSubscription.cpp:314
void addSymbols(const SymbolsCollection &collection) const
Adds the specified collection of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:460
void setSymbols(SymbolIt begin, SymbolIt end) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.hpp:359
void setAggregationPeriod(std::int64_t aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:306
void removeChangeListener(std::size_t changeListenerId) override
Removes subscription change listener by id.
Definition DXFeedSubscription.cpp:345
std::vector< SymbolWrapper > getDecoratedSymbols() const
Returns a set of decorated symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:251
void clear() const
Clears the set of subscribed symbols.
Definition DXFeedSubscription.cpp:233
void detach(std::shared_ptr< DXFeed > feed)
Detaches subscription from the specified feed.
Definition DXFeedSubscription.cpp:196
void addSymbols(const SymbolWrapper &symbolWrapper) const
Adds the specified symbol to the set of subscribed symbols.
Definition DXFeedSubscription.cpp:264
void setAggregationPeriod(std::chrono::milliseconds aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:302
void removeSymbols(std::initializer_list< SymbolWrapper > collection) const
Removes the specified collection (initializer list) of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.cpp:290
std::vector< SymbolWrapper > getSymbols() const
Returns a set of subscribed symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:242
Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols an...
Definition DXFeedSubscription.hpp:787
std::int64_t getFromTime()
Returns the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:394
void setFromTime(std::chrono::milliseconds fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:405
void setFromTime(std::int64_t fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:398
The enumeration type that provides additional information about the dxFeed Graal C++-API event type.
Definition EventTypeEnum.hpp:29
bool isTimeSeries() const noexcept
Definition EventTypeEnum.cpp:148
const std::string & getClassName() const &noexcept
Definition EventTypeEnum.cpp:120
bool isLasting() const noexcept
Definition EventTypeEnum.cpp:140
bool isOnlyIndexed() const noexcept
Definition EventTypeEnum.cpp:152
bool isIndexed() const noexcept
Definition EventTypeEnum.cpp:144
std::uint32_t getId() const noexcept
Definition EventTypeEnum.cpp:112
bool isMarket() const noexcept
Definition EventTypeEnum.cpp:156
const std::string & getName() const &noexcept
Definition EventTypeEnum.cpp:116
Source identifier for IndexedEvent.
Definition IndexedEventSource.hpp:29
Represents a subscription to a specific source of indexed events.
Definition IndexedEventSubscriptionSymbol.hpp:42
static JavaObjectHandleRegistry & getInstance() noexcept
Returns the process-wide handle registry.
Definition JavaObjectHandle.cpp:68
void releaseAll() noexcept
Releases all currently registered handles while the Graal isolate is still available.
Definition JavaObjectHandle.cpp:125
void reset(void *handle=nullptr) noexcept
Replaces the owned handle, releasing the previous one.
Definition JavaObjectHandle.cpp:163
JavaObjectHandleState(void *handle, Deleter deleter) noexcept
Creates an ownership state for a native handle.
Definition JavaObjectHandle.cpp:150
void * get() const noexcept
Returns the currently owned native handle.
Definition JavaObjectHandle.hpp:115
void moveFrom(JavaObjectHandleState &other) noexcept
Transfers ownership from another state and releases the handle previously owned by this state.
Definition JavaObjectHandle.cpp:159
~JavaObjectHandleState() noexcept
Releases the owned handle, if any, and unregisters the state.
Definition JavaObjectHandle.cpp:155
Thread-safe registry that associates callback identifiers with entities without owning them.
Definition EntityManager.hpp:180
bool unregisterEntity(const H *handle)
Unregisters an entity using a constant opaque callback handle.
Definition EntityManager.hpp:303
std::optional< Id< EntityIdType > > getId(const std::shared_ptr< EntityType > &entity)
Definition EntityManager.hpp:360
bool unregisterEntity(H *handle)
Unregisters an entity using an opaque callback handle.
Definition EntityManager.hpp:292
bool unregisterEntity(const std::shared_ptr< EntityType > &entity)
Unregisters an entity.
Definition EntityManager.hpp:254
bool unregisterEntity(Id< EntityIdType > id)
Unregisters an entity by identifier.
Definition EntityManager.hpp:273
std::shared_ptr< EntityType > getEntity(H *handle)
Locks and returns the entity identified by an opaque callback handle.
Definition EntityManager.hpp:339
Id< EntityIdType > registerEntity(const std::shared_ptr< EntityType > &entity)
Registers an entity and returns its callback identifier.
Definition EntityManager.hpp:221
bool contains(const std::shared_ptr< EntityType > &entity)
Definition EntityManager.hpp:384
WeakEntityManager()=default
Constructs an empty weak entity registry.
std::shared_ptr< EntityType > getEntity(const H *handle)
Locks and returns the entity identified by a constant opaque callback handle.
Definition EntityManager.hpp:350
std::size_t getLastId()
Definition EntityManager.hpp:243
bool contains(Id< EntityIdType > id)
Definition EntityManager.hpp:355
std::shared_ptr< EntityType > getEntity(Id< EntityIdType > id)
Locks and returns the entity registered for an identifier.
Definition EntityManager.hpp:315
Symbol that should be used with DXFeedSubscription class to subscribe for Candle events.
Definition CandleSymbol.hpp:87
Mixin for wrapping calls to common promise methods.
Definition Promise.hpp:80
JavaException getException() const
Returns exceptional outcome of computation.
Definition Promise.hpp:128
void cancel() const
This method cancels computation.
Definition Promise.hpp:175
bool hasResult() const
Returns true when computation has completed normally.
Definition Promise.hpp:96
bool isCancelled() const
Returns true when computation was cancelled.
Definition Promise.hpp:115
bool hasException() const
Returns true when a computation has completed exceptionally or was canceled.
Definition Promise.hpp:105
bool awaitWithoutException(const std::chrono::milliseconds &timeoutInMilliseconds) const
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
Definition Promise.hpp:162
bool isDone() const
Returns true when a computation has completed normally, or exceptionally, or was canceled.
Definition Promise.hpp:86
bool awaitWithoutException(std::int32_t timeoutInMilliseconds) const
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
Definition Promise.hpp:145
Manages network connections to feed or publisher.
Definition DXEndpoint.hpp:179
bool isClosed() const
Definition DXEndpoint.cpp:540
SimpleHandler< void(DXEndpoint::State, DXEndpoint::State)> & onStateChange() noexcept
Returns the onStateChange handler that can be used to add or remove listeners.
Definition DXEndpoint.cpp:552
static const std::string DXFEED_PASSWORD_PROPERTY
"dxfeed.password"
Definition DXEndpoint.hpp:246
static std::shared_ptr< DXEndpoint > create(Role role)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:527
std::shared_ptr< DXFeed > getFeed() const
Definition DXEndpoint.cpp:227
std::shared_ptr< DXEndpoint > password(const StringLike &password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:154
State
Represents the current state of endpoint.
Definition DXEndpoint.hpp:444
@ CLOSED
Endpoint was closed.
Definition DXEndpoint.hpp:464
@ CONNECTING
The connect method was called to establish connection to remove endpoint, but the connection is not e...
Definition DXEndpoint.hpp:454
@ CONNECTED
The connection to the remote endpoint is established.
Definition DXEndpoint.hpp:459
@ NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition DXEndpoint.hpp:448
std::shared_ptr< DXEndpoint > user(const StringLike &user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:147
void reconnect() const
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:173
static std::shared_ptr< DXEndpoint > create()
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:518
void removeStateChangeListener(std::size_t listenerId) noexcept
Removes a listener notified about changes in state property.
Definition DXEndpoint.cpp:548
const std::string & getName() const &noexcept
Definition DXEndpoint.cpp:544
Role
Represents the role of an endpoint that was specified during its creation.
Definition DXEndpoint.hpp:373
@ PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition DXEndpoint.hpp:418
@ STREAM_FEED
STREAM_FEED endpoint is similar to DXEndpoint::FEED and also connects to the remote data feed provide...
Definition DXEndpoint.hpp:406
@ LOCAL_HUB
LOCAL_HUB endpoint is a local hub without the ability to establish network connections.
Definition DXEndpoint.hpp:434
@ ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXEndpoint::FEED, but it is designed to be used with OnDemandSe...
Definition DXEndpoint.hpp:397
@ STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXEndpoint::PUBLISHER and also connects to the remote publish...
Definition DXEndpoint.hpp:427
@ FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition DXEndpoint.hpp:384
std::string toString() const override
Returns a string representation of the current object.
Definition DXEndpoint.cpp:401
void awaitProcessed() const
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:209
std::shared_ptr< DXPublisher > getPublisher() const
Definition DXEndpoint.cpp:236
static const std::string DXFEED_WILDCARD_ENABLE_PROPERTY
"dxfeed.wildcard.enable"
Definition DXEndpoint.hpp:274
std::size_t addStateChangeListener(std::function< void(State, State)> listener) noexcept
Adds a listener notified about changes in state property.
Definition DXEndpoint.hpp:619
static const std::string DXENDPOINT_EVENT_TIME_PROPERTY
"dxendpoint.eventTime"
Definition DXEndpoint.hpp:319
static const std::string DXPUBLISHER_THREAD_POOL_SIZE_PROPERTY
"dxpublisher.threadPoolSize"
Definition DXEndpoint.hpp:302
State getState() const
Returns the state of this endpoint.
Definition DXEndpoint.cpp:143
static const std::string DXENDPOINT_STORE_EVERYTHING_PROPERTY
"dxendpoint.storeEverything"
Definition DXEndpoint.hpp:332
void awaitNotConnected() const
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:200
static std::shared_ptr< DXEndpoint > getInstance(Role role)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:500
static const std::string DXFEED_AGGREGATION_PERIOD_PROPERTY
"dxfeed.aggregationPeriod"
Definition DXEndpoint.hpp:265
void close() const
Closes this endpoint.
Definition DXEndpoint.cpp:556
static const std::string DXFEED_THREAD_POOL_SIZE_PROPERTY
"dxfeed.threadPoolSize"
Definition DXEndpoint.hpp:255
void disconnect() const
Terminates all remote network connections.
Definition DXEndpoint.cpp:182
void closeAndAwaitTermination() const
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:218
static std::shared_ptr< DXEndpoint > getInstance()
Returns a default application-wide singleton instance of DXEndpoint with a FEED role.
Definition DXEndpoint.cpp:491
static const std::string DXPUBLISHER_ADDRESS_PROPERTY
"dxpublisher.address"
Definition DXEndpoint.hpp:293
static const std::string DXFEED_USER_PROPERTY
"dxfeed.user"
Definition DXEndpoint.hpp:236
static const std::string NAME_PROPERTY
"name"
Definition DXEndpoint.hpp:196
static const std::string DXSCHEME_ENABLED_PROPERTY_PREFIX
"dxscheme.enabled."
Definition DXEndpoint.hpp:366
static const std::string DXPUBLISHER_PROPERTIES_PROPERTY
"dxpublisher.properties"
Definition DXEndpoint.hpp:283
static const std::string DXSCHEME_NANO_TIME_PROPERTY
"dxscheme.nanoTime"
Definition DXEndpoint.hpp:352
static const std::string DXFEED_ADDRESS_PROPERTY
"dxfeed.address"
Definition DXEndpoint.hpp:226
std::shared_ptr< DXEndpoint > executor(const std::shared_ptr< Executor > &executor)
Changes the executor that is used for notifications (events, state changes, etc.) of this endpoint.
Definition DXEndpoint.hpp:655
void disconnectAndClear() const
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:191
Role getRole() const noexcept
Returns the role of this endpoint.
Definition DXEndpoint.cpp:536
static const std::string DXFEED_PROPERTIES_PROPERTY
"dxfeed.properties"
Definition DXEndpoint.hpp:207
static std::shared_ptr< Builder > newBuilder()
Creates a new Builder instance.
Definition DXEndpoint.cpp:509
std::shared_ptr< DXEndpoint > connect(const StringLike &address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:161
Main entry class for dxFeed API (read it first).
Definition DXFeed.hpp:141
void detachSubscriptionAndClear(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed and clears data delivered to this subscription by publ...
Definition DXFeed.cpp:68
Collection getLastEvents(Collection &&events)
Returns the last events for the specified list of event instances.
Definition DXFeed.hpp:294
std::shared_ptr< PromiseList< E > > getLastEventsPromises(std::initializer_list< SymbolWrapper > collection) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:749
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::chrono::milliseconds fromTime, std::chrono::milliseconds toTime) const
Returns time series of events for the specified event type, symbol and a range of time if there is a ...
Definition DXFeed.hpp:1017
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:88
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(std::initializer_list< EventTypeEnum > eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:137
std::shared_ptr< DXFeedSubscription > createSubscription(EventTypeIt begin, EventTypeIt end) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:388
std::shared_ptr< PromiseList< E > > getLastEventsPromises(const SymbolsCollection &collection) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:703
std::shared_ptr< E > getLastEventIfSubscribed(const SymbolWrapper &symbol)
Returns the last event for the specified event type and symbol if there is a subscription for it.
Definition DXFeed.hpp:328
std::shared_ptr< DXFeedSubscription > createSubscription(std::initializer_list< EventTypeEnum > eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:101
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::chrono::milliseconds fromTime) const
Returns time series of events for the specified event type, symbol and a range of time (without an up...
Definition DXFeed.hpp:1048
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(EventTypeIt begin, EventTypeIt end) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:500
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:19
std::shared_ptr< E > getLastEvent(std::shared_ptr< E > event)
Returns the last event for the specified event instance.
Definition DXFeed.hpp:270
std::shared_ptr< PromiseList< E > > getLastEventsPromises(SymbolIt begin, SymbolIt end) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:656
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypesCollection &eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:438
std::shared_ptr< Promise< std::shared_ptr< E > > > getLastEventPromise(const SymbolWrapper &symbol) const
Requests the last event for the specified event type and symbol.
Definition DXFeed.hpp:608
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypesCollection &eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:567
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeed.cpp:226
std::shared_ptr< Promise< std::vector< std::shared_ptr< E > > > > getIndexedEventsPromise(const SymbolWrapper &symbol, const IndexedEventSource &source) const
Requests a container of indexed events for the specified event type, symbol and source.
Definition DXFeed.hpp:802
void detachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed.
Definition DXFeed.cpp:48
std::vector< std::shared_ptr< E > > getIndexedEventsIfSubscribed(const SymbolWrapper &symbol, const IndexedEventSource &source) const
Returns a vector of indexed events for the specified event type, symbol and source if there is a subs...
Definition DXFeed.hpp:858
void attachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Attaches the given subscription to this feed.
Definition DXFeed.cpp:28
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:116
Provides API for publishing of events to local or remote DXFeed.
Definition DXPublisher.hpp:60
Mixin for wrapping Promise method calls for a single event.
Definition Promise.hpp:244
std::shared_ptr< E > getResult() const
Returns result of computation.
Definition Promise.hpp:252
std::shared_ptr< E > await() const
Wait for the computation to complete and return its result or throw an exception in case of exception...
Definition Promise.hpp:262
std::shared_ptr< E > await(const std::chrono::milliseconds &timeoutInMilliseconds) const &
Wait for computation to complete or timeout and return its result or throw an exception in case of ex...
Definition Promise.hpp:292
std::shared_ptr< E > await(std::int32_t timeoutInMilliseconds) const &
Wait for computation to complete or timeout and return its result or throw an exception in case of ex...
Definition Promise.hpp:277
Event type parametrized by a symbol.
Definition EventType.hpp:114
virtual const std::optional< Symbol > & getEventSymbolOpt() const &noexcept=0
Returns the event symbol that identifies this event type in subscription.
virtual void setEventSymbol(const Symbol &eventSymbol) noexcept=0
Changes the event symbol that identifies this event type in subscription.
virtual const Symbol & getEventSymbol() const &noexcept=0
Returns the event symbol that identifies this event type in subscription.
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:37
std::string toString() const override
Returns a string representation of the current object.
Definition api.cpp:67
virtual void * toGraal() const =0
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
virtual std::int64_t getEventTime() const noexcept
Returns time when an event was created or zero when time is not available.
Definition api.cpp:54
virtual void assign(std::shared_ptr< EventType > event)
Replaces the contents of the event.
Definition api.cpp:63
virtual void setEventTime(std::int64_t eventTime) noexcept
Changes event creation time.
Definition api.cpp:58
The wrapper over CEntryPointErrorsEnum, the error code returned by GraalVM.
Definition GraalException.hpp:26
GraalException(CEntryPointErrorsEnum entryPointErrorsEnum)
Constructs an exception.
Definition GraalException.cpp:8
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:122
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:156
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:208
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:197
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:146
Handler(std::size_t mainFuturesSize=MAIN_FUTURES_DEFAULT_SIZE) noexcept
Creates the new handler by specified size of circular buffer of futures.
Definition Handler.hpp:84
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:236
std::size_t addLowPriority(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group) It will be called after the "main" liste...
Definition Handler.hpp:177
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:217
Represents an indexed collection of up-to-date information about some condition or state of an extern...
Definition IndexedEvent.hpp:46
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition InvalidArgumentException.hpp:23
A wrapper over the interceptable Java exceptions thrown by the dxFeed Native Graal SDK.
Definition JavaException.hpp:26
static void throwIfJavaThreadExceptionExists()
Throws a JavaException if it exists (i.e. intercepted by Graal SDK)
Definition JavaException.cpp:78
JavaException(const StringLike &message, const StringLike &className, const StringLike &stackTrace)
Creates an exception using Java message, className and stack trace.
Definition JavaException.cpp:52
static JavaException createAndRelease(void *exceptionHandle)
Creates an exception from a native Java exception handle and releases the native representation.
Definition JavaException.cpp:70
static JavaException create(void *exceptionHandle)
Creates an exception using native (GraalVM) Java exception handle.
Definition JavaException.cpp:60
Represents up-to-date information about some condition or state of an external entity that updates in...
Definition LastingEvent.hpp:33
Base class for all market events.
Definition MarketEvent.hpp:29
The listener interface for receiving notifications on the changes of observed subscription.
Definition ObservableSubscriptionChangeListener.hpp:32
Observable set of subscription symbols.
Definition ObservableSubscription.hpp:26
Provides on-demand historical tick data replay controls.
Definition OnDemandService.hpp:77
A list of event receiving results that will be completed normally or exceptionally in the future.
Definition Promise.hpp:442
Result of a computation that will be completed normally or exceptionally in the future.
Definition Promise.hpp:358
A class that represents a promise-based implementation often used for handling asynchronous operation...
Definition Promises.hpp:46
A helper class needed to construct smart pointers to objects and does not allow explicit construction...
Definition SharedEntity.hpp:89
static auto createShared(Args &&...args)
Creates a smart pointer to an object.
Definition SharedEntity.hpp:104
A runtime axception with stacktrace.
Definition RuntimeException.hpp:26
const std::string & getStackTrace() const &
Definition RuntimeException.cpp:83
RuntimeException(const StringLike &message, const StringLike &additionalStackTrace="")
Constructs a runtime exception.
Definition RuntimeException.cpp:67
A base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:25
virtual std::string toString() const
Returns a string representation of the current object.
Definition SharedEntity.hpp:78
std::shared_ptr< T > sharedAs() const noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nu...
Definition SharedEntity.hpp:69
std::shared_ptr< T > sharedAs() noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nu...
Definition SharedEntity.hpp:58
bool is() const noexcept
Checks that the pointer to the current type could be converted to type T* In other words: whether typ...
Definition SharedEntity.hpp:39
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:379
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:399
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:317
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:328
std::size_t addLowPriority(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group) It will be called after the "main" liste...
Definition Handler.hpp:359
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:418
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:390
SimpleHandler() noexcept
Creates the new handler.
Definition Handler.hpp:289
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:338
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition StringUtils.hpp:120
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:728
A lightweight wrapper around strings or string-like inputs.
Definition StringUtils.hpp:28
Common string constants used across the library.
Definition StringUtils.hpp:137
static const std::string NUL
Textual representation of a null / missing string: "<null>".
Definition StringUtils.hpp:142
static const std::string EMPTY
Empty string constant: "".
Definition StringUtils.hpp:139
std::optional< CandleSymbol > asCandleSymbol() const noexcept
Definition SymbolWrapper.cpp:239
SymbolWrapper(Symbol &&symbol) noexcept
Constructor for any wrapped symbol.
Definition SymbolWrapper.hpp:161
bool isIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:215
std::string toString() const
Returns a string representation of the current object.
Definition SymbolWrapper.cpp:181
static SymbolWrapper fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
Definition SymbolWrapper.cpp:133
std::string toStringUnderlying() const
Returns a string representation of the underlying object.
Definition SymbolWrapper.cpp:191
std::unique_ptr< void, decltype(&SymbolWrapper::freeGraal)> toGraalUnique() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:177
bool isStringSymbol() const noexcept
Definition SymbolWrapper.cpp:199
std::optional< IndexedEventSubscriptionSymbol > asIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:219
bool isWildcardSymbol() const noexcept
Definition SymbolWrapper.cpp:207
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:165
SymbolWrapper(const IndexedEventSubscriptionSymbol &indexedEventSubscriptionSymbol) noexcept
Constructor for IndexedEventSubscriptionSymbol.
Definition SymbolWrapper.cpp:66
std::string asStringSymbol() const noexcept
Definition SymbolWrapper.cpp:203
SymbolWrapper(const StringSymbol &stringSymbol) noexcept
Constructor for any wrapped string symbol.
Definition SymbolWrapper.cpp:50
std::optional< WildcardSymbol > asWildcardSymbol() const noexcept
Definition SymbolWrapper.cpp:211
SymbolWrapper(const CandleSymbol &candleSymbol) noexcept
Constructor for CandleSymbol.
Definition SymbolWrapper.cpp:84
SymbolWrapper(const WildcardSymbol &wildcardSymbol) noexcept
Constructor for any wrapped wildcard (*) symbol.
Definition SymbolWrapper.cpp:58
bool isTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:225
SymbolWrapper(const TimeSeriesSubscriptionSymbol &timeSeriesSubscriptionSymbol) noexcept
Constructor for TimeSeriesSubscriptionSymbol.
Definition SymbolWrapper.cpp:75
bool isCandleSymbol() const noexcept
Definition SymbolWrapper.cpp:235
std::optional< TimeSeriesSubscriptionSymbol > asTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:229
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:95
const DataType & getData() const noexcept
Definition SymbolWrapper.cpp:243
Value class for a period of time with support for ISO8601 duration format.
Definition TimePeriod.hpp:29
Represents time-series snapshots of some process that is evolving in time or actual events in some ex...
Definition TimeSeriesEvent.hpp:84
Mixin for wrapping Promise method calls for a void.
Definition Promise.hpp:185
void await(std::int32_t timeoutInMilliseconds) const &
Wait for the computation to complete or timeout and return its result or throw an exception in case o...
Definition Promise.hpp:217
void await(const std::chrono::milliseconds &timeoutInMilliseconds) const &
Wait for the computation to complete or timeout and return its result or throw an exception in case o...
Definition Promise.hpp:232
void await() const
Wait for the computation to complete and return its result or throw an exception in case of exception...
Definition Promise.hpp:202
void getResult() const
Returns result of computation.
Definition Promise.hpp:192
Whether T is std::shared_ptr<E>, where E is a descendant of LastingEvent (the elements of DXFeed::get...
Definition DXFeed.hpp:40
The simple key-value structure that represents an endpoint's property.
Definition api.h:184
const char * key
The property's key.
Definition api.h:186
const char * value
The property's value.
Definition api.h:188