dxFeed Graal CXX API v5.0.0
Loading...
Searching...
No Matches
DXFeedSubscription.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 "../entity/EntityModule.hpp"
11#include "../event/EventType.hpp"
12#include "../event/EventTypeEnum.hpp"
13#include "../internal/Common.hpp"
14#include "../internal/EventClassList.hpp"
15#include "../internal/Handler.hpp"
16#include "../internal/JavaObjectHandle.hpp"
17#include "../internal/context/ApiContext.hpp"
18#include "../internal/managers/EntityManager.hpp"
19#include "../symbols/SymbolWrapper.hpp"
20#include "../util/TimePeriod.hpp"
21#include "./osub/ObservableSubscription.hpp"
22
23#include <concepts>
24#include <memory>
25#include <type_traits>
26#include <unordered_set>
27
29
30struct DXFeed;
31struct MarketEvent;
32struct IndexedEvent;
33struct TimeSeriesEvent;
34struct LastingEvent;
35
36/**
37 * Subscription for a set of symbols and event types.
38 */
40 public:
41 static constexpr std::size_t FAKE_CHANGE_LISTENER_ID{static_cast<std::size_t>(-1)};
42
43 ///
44 using OnEventHandler = SimpleHandler<void(const std::vector<std::shared_ptr<EventType>> &)>;
45
46 // These constants are linked with the same ones in RecordBuffer - POOLED_CAPACITY and UNLIMITED_CAPACITY.
47 /**
48 * The optimal events' batch limit for a single notification in OnEventHandler.
49 */
50 static const std::int32_t OPTIMAL_BATCH_LIMIT = 0;
51
52 /**
53 * The maximum events' batch limit for a single notification in OnEventHandler.
54 */
55 static const std::int32_t MAX_BATCH_LIMIT = std::numeric_limits<std::int32_t>::max();
56
57 protected:
58 friend struct DXFeed;
59
60 inline static std::atomic<std::size_t> lastChangeListenerId_{};
61
62 struct Impl;
63
64 std::unique_ptr<Impl> impl_;
65
66 std::unordered_set<EventTypeEnum> eventTypes_;
67 JavaObjectHandle<DXFeedSubscription> handle_;
68
69 std::mutex eventListenerMutex_{};
70 JavaObjectHandle<DXFeedEventListener> eventListenerHandle_;
71 OnEventHandler onEvent_{};
72 std::unordered_map<std::size_t, std::shared_ptr<ObservableSubscriptionChangeListener>> changeListeners_;
73 std::recursive_mutex changeListenersMutex_{};
74
75 static JavaObjectHandle<DXFeedSubscription>
76 createSubscriptionHandleFromEventClassList(const std::unique_ptr<EventClassList> &list);
77
78 void setEventListenerHandle(Id<DXFeedSubscription> id);
79
80 bool tryToSetEventListenerHandle();
81
82 void setSymbolsImpl(void *graalSymbolList) const;
83 void addSymbolsImpl(void *graalSymbolList) const;
84 void removeSymbolsImpl(void *graalSymbolList) const;
85
86 DXFeedSubscription();
87
88 DXFeedSubscription(const EventTypeEnum &eventType);
89
90 DXFeedSubscription(const EventTypeEnum &eventType, JavaObjectHandle<DXFeedSubscription> &&handle);
91
92 template <typename EventTypeIt>
93#if __cpp_concepts
94 requires requires(EventTypeIt iter) {
95 { *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
96 }
97#endif
98 DXFeedSubscription(EventTypeIt begin, EventTypeIt end) : DXFeedSubscription() {
99 if constexpr (Debugger::isDebug) {
100 // ReSharper disable once CppDFAUnreachableCode
101 Debugger::debug("DXFeedSubscription(eventTypes = " + namesToString(begin, end) + ")");
102 }
103
104 eventTypes_ = std::unordered_set<EventTypeEnum>{begin, end};
105
106 auto list = EventClassList::create(eventTypes_.begin(), eventTypes_.end());
107
108 handle_ = createSubscriptionHandleFromEventClassList(list);
109 }
110
111 template <typename EventTypeIt>
112#if __cpp_concepts
113 requires requires(EventTypeIt iter) {
114 { *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
115 }
116#endif
117 DXFeedSubscription(EventTypeIt begin, EventTypeIt end, JavaObjectHandle<DXFeedSubscription> &&handle)
119 if constexpr (Debugger::isDebug) {
120 // ReSharper disable once CppDFAUnreachableCode
121 Debugger::debug("DXFeedSubscription(eventTypes = " + namesToString(begin, end) + ")");
122 }
123
124 eventTypes_ = std::unordered_set<EventTypeEnum>{begin, end};
125 handle_ = std::move(handle);
126 }
127
128 public:
129 /// The alias to a type of shared pointer to the DXFeedSubscription object
130 using Ptr = std::shared_ptr<DXFeedSubscription>;
131
132 /// The alias to a type of unique pointer to the DXFeedSubscription object
134
135 DXFeedSubscription(LockExternalConstructionTag);
136
137 DXFeedSubscription(LockExternalConstructionTag, const EventTypeEnum &eventType);
138
139 template <typename EventTypeIt>
140#if __cpp_concepts
141 requires requires(EventTypeIt iter) {
142 { *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
143 }
144#endif
145 DXFeedSubscription(LockExternalConstructionTag, EventTypeIt begin, EventTypeIt end)
146 : DXFeedSubscription(begin, end) {
147 }
148
149 DXFeedSubscription(LockExternalConstructionTag tag, std::initializer_list<EventTypeEnum> eventTypes)
150 : DXFeedSubscription(tag, eventTypes.begin(), eventTypes.end()) {
151 }
152
153 template <typename EventTypesCollection>
154 explicit DXFeedSubscription(LockExternalConstructionTag tag, EventTypesCollection &&eventTypes)
155#if __cpp_concepts
156 requires requires {
157 {
158 DXFeedSubscription(tag, std::begin(std::forward<EventTypesCollection>(eventTypes)),
159 std::end(std::forward<EventTypesCollection>(eventTypes)))
160 };
161 }
162#endif
163 : DXFeedSubscription(tag, std::begin(std::forward<EventTypesCollection>(eventTypes)),
164 std::end(std::forward<EventTypesCollection>(eventTypes))) {
165 }
166
167 ///
168 std::string toString() const override;
169
170 ~DXFeedSubscription() override;
171
172 /**
173 * Creates a <i>detached</i> subscription for a single event type.
174 *
175 * Example:
176 * ```cpp
177 * auto sub = dxfcpp::DXFeedSubscription::create(dxfcpp::Quote::TYPE);
178 * ```
179 *
180 * @param eventType the event type.
181 */
182 static std::shared_ptr<DXFeedSubscription> create(const EventTypeEnum &eventType);
183
184 /**
185 * Creates a <i>detached</i> subscription for the given collection of event types.
186 *
187 * Example:
188 * ```cpp
189 * auto eventTypes = {dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE};
190 *
191 * auto sub = dxfcpp::DXFeedSubscription::create(eventTypes.begin(), eventTypes.end());
192 * ```
193 *
194 * ```cpp
195 * std::vector types{dxfcpp::Quote::TYPE, dxfcpp::Trade::TYPE, dxfcpp::Summary::TYPE};
196 *
197 * auto sub = dxfcpp::DXFeedSubscription::create(types.begin(), types.end());
198 * ```
199 *
200 * @tparam EventTypeIt The collection's iterator type
201 * @param begin The beginning of the event type collection.
202 * @param end The end of an event type collection.
203 * @return The new <i>detached</i> subscription for the given collection of event types.
204 */
205 template <typename EventTypeIt>
206#if __cpp_concepts
209 }
210#endif
211 static std::shared_ptr<DXFeedSubscription> create(EventTypeIt begin, EventTypeIt end) {
212 if constexpr (Debugger::isDebug) {
213 // ReSharper disable once CppDFAUnreachableCode
214 Debugger::debug("DXFeedSubscription::create(eventTypes = " + namesToString(begin, end) + ")");
215 }
216
217 auto sub = createShared(begin, end);
218 auto id = ApiContext::getInstance()->getManager<EntityManager<DXFeedSubscription>>()->registerEntity(sub);
219
220 dxfcpp::ignoreUnused(id);
221
222 return sub;
223 }
224
225 /**
226 * Creates a <i>detached</i> subscription for the given collection of event types.
227 *
228 * Example:
229 * ```cpp
230 * auto sub = dxfcpp::DXFeedSubscription::create({dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE});
231 * ```
232 *
233 * @param eventTypes The event type collection.
234 * @return The new <i>detached</i> subscription for the given collection of event types.
235 */
236 static std::shared_ptr<DXFeedSubscription> create(std::initializer_list<EventTypeEnum> eventTypes);
237
238 /**
239 * Creates a <i>detached</i> subscription for the given collection of event types.
240 *
241 * Example:
242 * ```cpp
243 * auto sub = dxfcpp::DXFeedSubscription::create(std::unordered_set{dxfcpp::Quote::TYPE,
244 * dxfcpp::TimeAndSale::TYPE});
245 * ```
246 *
247 * ```cpp
248 * std::vector types = {dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE};
249 * auto sub = dxfcpp::DXFeedSubscription::create(types);
250 * ```
251 *
252 * @tparam EventTypesCollection The type of the collection of event types
253 * @param eventTypes The event type collection.
254 * @return The new <i>detached</i> subscription for the given collection of event types.
255 */
256 template <typename EventTypesCollection>
257 static std::shared_ptr<DXFeedSubscription> create(EventTypesCollection &&eventTypes) {
258 auto sub = createShared(std::forward<EventTypesCollection>(eventTypes));
259 auto id = ApiContext::getInstance()->getManager<EntityManager<DXFeedSubscription>>()->registerEntity(sub);
260
261 dxfcpp::ignoreUnused(id);
262
263 return sub;
264 }
265
266 /**
267 * Attaches subscription to the specified feed.
268 *
269 * @param feed The feed to attach to.
270 */
271 void attach(std::shared_ptr<DXFeed> feed);
272
273 /**
274 * Detaches subscription from the specified feed.
275 *
276 * @param feed The feed to detach from.
277 */
278 void detach(std::shared_ptr<DXFeed> feed);
279
280 /**
281 * Returns `true` if this subscription is closed.
282 *
283 * @return `true` if this subscription is closed.
284 *
285 * @see DXFeedSubscription::close()
286 */
287 bool isClosed() override;
288
289 /**
290 * Closes this subscription and makes it <i>permanently detached</i>.
291 * This method notifies all installed instances of subscription change listeners by invoking `subscriptionClosed`
292 * while holding the lock for this subscription. This method clears lists of all installed
293 * event listeners and subscription change listeners and makes sure that no more listeners
294 * can be added.
295 */
296 void close() const;
297
298 /**
299 * Returns a set of subscribed event types.
300 *
301 * @return A set of subscribed event types.
302 */
304
305 /**
306 * Returns `true` if this subscription contains the corresponding event type.
307 *
308 * @param eventType The type of event that is checked.
309 * @return `true` if this subscription contains the corresponding event type.
310 *
311 * @see DXFeedSubscription::getEventTypes()
312 */
313 bool containsEventType(const EventTypeEnum &eventType) override;
314
315 /**
316 * Clears the set of subscribed symbols.
317 */
318 void clear() const;
319
320 /**
321 * Returns a set of subscribed symbols (depending on the actual implementation of the subscription).
322 *
323 * The resulting set is maybe either a snapshot of the set of the subscribed symbols at the time of invocation or a
324 * weakly consistent view of the set.
325 *
326 * @return A set of subscribed symbols.
327 */
329
330 /**
331 * Returns a set of decorated symbols (depending on the actual implementation of the subscription).
332 *
333 * The resulting set is maybe either a snapshot of the set of the subscribed symbols at the time of invocation or a
334 * weakly consistent view of the set.
335 *
336 * @return A set of decorated subscribed symbols.
337 */
339
340 /**
341 * Changes the set of subscribed symbols so that it contains just the symbols from the specified collection (using
342 * iterators).
343 *
344 * Example:
345 * ```cpp
346 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
347 *
348 * sub->setSymbols(v.begin(), v.end());
349 * ```
350 *
351 * @tparam SymbolIt The collection's iterator type
352 * @param begin The beginning of the symbol collection.
353 * @param end The end of the symbol collection.
354 */
355 template <typename SymbolIt> void setSymbols(SymbolIt begin, SymbolIt end) const {
356 if constexpr (Debugger::isDebug) {
357 // ReSharper disable once CppDFAUnreachableCode
358 Debugger::debug(toString() + "::setSymbols(symbols = " + elementsToString(begin, end) + ")");
359 }
360
361 auto list = SymbolWrapper::SymbolListUtils::toGraalListUnique(begin, end);
362
363 setSymbolsImpl(list.get());
364 }
365
366 /**
367 * Changes the set of subscribed symbols so that it contains just the symbols from the specified collection.
368 *
369 * Example:
370 * ```cpp
371 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
372 *
373 * sub->setSymbols(std::vector{"AAPL", "IBM"});
374 * sub->setSymbols(v);
375 * ```
376 *
377 * @tparam SymbolsCollection The symbol collection's type
378 * @param collection The symbol collection
379 */
380 template <ConvertibleToSymbolWrapperCollection SymbolsCollection>
381 void setSymbols(SymbolsCollection &&collection) const {
382 setSymbols(std::begin(collection), std::end(collection));
383 }
384
385 /**
386 * Changes the set of subscribed symbols so that it contains just the symbols from the specified collection
387 * (initializer list).
388 *
389 * Example:
390 * ```cpp
391 * sub->setSymbols({"AAPL", "IBM"sv, "TSLA"s, "GOOG"_s});
392 * ```
393 *
394 * @param collection The symbol collection
395 */
396 void setSymbols(std::initializer_list<SymbolWrapper> collection) const;
397
398 /**
399 * Adds the specified symbol to the set of subscribed symbols.
400 * This is a convenience method to subscribe to one symbol at a time that has a return fast-path for a case when
401 * the symbol is already in the set.
402 * When subscribing to multiple symbols at once, it is preferable to use @ref DXFeedSubscription::addSymbols(const
403 * SymbolsCollection &collection) "addSymbols(symbols)" method.
404 *
405 * Example:
406 * ```cpp
407 * sub->addSymbols("TSLA");
408 * sub->addSymbols("XBT/USD:GDAX"s);
409 * sub->addSymbols("BTC/EUR:CXBITF"sv);
410 * ```
411 *
412 * @param symbolWrapper The symbol.
413 */
414 void addSymbols(const SymbolWrapper &symbolWrapper) const;
415
416 /**
417 * Adds the specified collection (using iterators) of symbols to the set of subscribed symbols.
418 *
419 * Example:
420 * ```cpp
421 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
422 *
423 * sub->addSymbols(v.begin(), v.end());
424 * ```
425 *
426 * @tparam SymbolIt The collection's iterator type
427 * @param begin The beginning of the symbol collection.
428 * @param end The end of the symbol collection.
429 */
430 template <typename SymbolIt> void addSymbols(SymbolIt begin, SymbolIt end) const {
431 if constexpr (Debugger::isDebug) {
432 // ReSharper disable once CppDFAUnreachableCode
433 Debugger::debug(toString() + "::addSymbols(symbols = " + elementsToString(begin, end) + ")");
434 }
435
436 auto list = SymbolWrapper::SymbolListUtils::toGraalListUnique(begin, end);
437
438 addSymbolsImpl(list.get());
439 }
440
441 /**
442 * Adds the specified collection of symbols to the set of subscribed symbols.
443 *
444 * Example:
445 * ```cpp
446 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
447 *
448 * sub->addSymbols(std::vector{"AAPL", "IBM"});
449 * sub->addSymbols(v);
450 * ```
451 *
452 * @tparam SymbolsCollection The symbol collection's type
453 * @param collection The symbol collection
454 */
455 template <ConvertibleToSymbolWrapperCollection SymbolsCollection>
456 void addSymbols(const SymbolsCollection &collection) const {
457 addSymbols(std::begin(collection), std::end(collection));
458 }
459
460 /**
461 * Adds the specified collection (initializer list) of symbols to the set of subscribed symbols.
462 *
463 * Example:
464 * ```cpp
465 * sub->addSymbols({"AAPL", "IBM"sv, "TSLA"s, "GOOG"_s});
466 * ```
467 *
468 * @param collection The symbol collection
469 */
470 void addSymbols(std::initializer_list<SymbolWrapper> collection) const;
471
472 /**
473 * Removes the specified symbol from the set of subscribed symbols.
474 * To conveniently remove one or few symbols, you can use @ref DXFeedSubscription::removeSymbols(const
475 * SymbolsCollection &collection) "removeSymbols(symbols)" method.
476 *
477 * Example:
478 * ```cpp
479 * sub->removeSymbols("TSLA");
480 * sub->removeSymbols("XBT/USD:GDAX"s);
481 * sub->removeSymbols("BTC/EUR:CXBITF"sv);
482 * ```
483 *
484 * @param symbolWrapper The symbol.
485 */
486 void removeSymbols(const SymbolWrapper &symbolWrapper) const;
487
488 /**
489 * Removes the specified collection (using iterators) of symbols from the set of subscribed symbols.
490 *
491 * Example:
492 * ```cpp
493 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
494 *
495 * sub->removeSymbols(v.begin(), v.end());
496 * ```
497 *
498 * @tparam SymbolIt The collection's iterator type
499 * @param begin The beginning of the symbol collection.
500 * @param end The end of the symbol collection.
501 */
502 template <typename SymbolIt> void removeSymbols(SymbolIt begin, SymbolIt end) const {
503 if constexpr (Debugger::isDebug) {
504 // ReSharper disable once CppDFAUnreachableCode
505 Debugger::debug(toString() + "::removeSymbols(symbols = " + elementsToString(begin, end) + ")");
506 }
507
508 auto list = SymbolWrapper::SymbolListUtils::toGraalListUnique(begin, end);
509
510 removeSymbolsImpl(list.get());
511 }
512
513 /**
514 * Removes the specified collection of symbols from the set of subscribed symbols.
515 *
516 * Example:
517 * ```cpp
518 * auto v = std::vector<dxfcpp::SymbolWrapper>{"XBT/USD:GDAX"s, "BTC/EUR:CXBITF"sv, "TSLA", "GOOG"_s};
519 *
520 * sub->removeSymbols(std::vector{"AAPL", "IBM"});
521 * sub->removeSymbols(v);
522 * ```
523 *
524 * @tparam SymbolsCollection The symbol collection's type
525 * @param collection The symbol collection
526 */
527 template <ConvertibleToSymbolWrapperCollection SymbolsCollection>
528 void removeSymbols(SymbolsCollection &&collection) const {
529 removeSymbols(std::begin(collection), std::end(collection));
530 }
531
532 /**
533 * Removes the specified collection (initializer list) of symbols from the set of subscribed symbols.
534 *
535 * Example:
536 * ```cpp
537 * sub->removeSymbols({"AAPL", "IBM"sv, "TSLA"s, "GOOG"_s});
538 * ```
539 *
540 * @param collection The symbol collection
541 */
542 void removeSymbols(std::initializer_list<SymbolWrapper> collection) const;
543
544 /**
545 * Returns the aggregation period for data for this subscription instance.
546 *
547 * @return The aggregation period for data, represented as a TimePeriod object.
548 */
550
551 /**
552 * Sets the aggregation period for data.
553 * This method sets a new aggregation period for data, which will only take effect on the next iteration of
554 * data notification. For example, if the current aggregation period is 5 seconds and it is changed
555 * to 1 second, the next call to the next call to the retrieve method may take up to 5 seconds, after which
556 * the new aggregation period will take effect.
557 *
558 * @param aggregationPeriod the new aggregation period for data
559 */
560 void setAggregationPeriod(const TimePeriod &aggregationPeriod) const;
561
562 /**
563 * Sets the aggregation period for data.
564 * This method sets a new aggregation period for data, which will only take effect on the next iteration of
565 * data notification. For example, if the current aggregation period is 5 seconds and it is changed
566 * to 1 second, the next call to the next call to the retrieve method may take up to 5 seconds, after which
567 * the new aggregation period will take effect.
568 *
569 * @param aggregationPeriod the new aggregation period (in millis) for data
570 */
571 void setAggregationPeriod(std::chrono::milliseconds aggregationPeriod) const {
572 return setAggregationPeriod(TimePeriod::valueOf(aggregationPeriod));
573 }
574
575 /**
576 * Sets the aggregation period for data.
577 * This method sets a new aggregation period for data, which will only take effect on the next iteration of
578 * data notification. For example, if the current aggregation period is 5 seconds and it is changed
579 * to 1 second, the next call to the next call to the retrieve method may take up to 5 seconds, after which
580 * the new aggregation period will take effect.
581 *
582 * @param aggregationPeriod the new aggregation period (in millis) for data
583 */
584 void setAggregationPeriod(std::int64_t aggregationPeriod) const {
585 return setAggregationPeriod(TimePeriod::valueOf(aggregationPeriod));
586 }
587
588 /**
589 * Adds listener for events.
590 * Event lister can be added only when the subscription is not producing any events.
591 * The subscription must be either empty
592 * (its set of @ref DXFeedSubscription::getSymbols() "symbols" is empty or not @ref DXFeedSubscription::attach()
593 * "attached" to any feed (its set of change listeners is empty).
594 *
595 * This method does nothing if this subscription is closed.
596 *
597 * Example:
598 * ```cpp
599 * auto sub = endpoint->getFeed()->createSubscription({dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE});
600 *
601 * sub->addEventListener([](auto &&events) {
602 * for (const auto &e : events) {
603 * if (auto quote = e->template sharedAs<dxfcpp::Quote>(); quote) {
604 * std::cout << "Q : " + quote->toString() << std::endl;
605 * } else if (auto tns = e->template sharedAs<dxfcpp::TimeAndSale>(); tns) {
606 * std::cout << "TnS : " + tns->toString() << std::endl;
607 * }
608 * }
609 * });
610 *
611 * sub->addSymbols({"$TOP10L/Q", "$SP500#45", "$TICK", "SPX"});
612 * ```
613 *
614 * @tparam EventListener The listener type. Listener can be callable with signature: `void(const
615 * std::vector<std::shared_ptr<EventType>&)`
616 * @param listener The event listener
617 * @return The listener id
618 */
619 template <typename EventListener>
620 std::size_t addEventListener(EventListener &&listener)
621#if __cpp_concepts
623 { listener(std::vector<std::shared_ptr<EventType>>{}) } -> std::same_as<void>;
624 }
625#endif
626 {
627 if (!tryToSetEventListenerHandle()) {
628 return OnEventHandler::FAKE_ID;
629 }
630
631 return onEvent_ += listener;
632 }
633
634 /**
635 * Adds typed listener for events.
636 * Event lister can be added only when the subscription is not producing any events.
637 * The subscription must be either empty
638 * (its set of @ref DXFeedSubscription::getSymbols() "symbols" is empty or not @ref DXFeedSubscription::attach()
639 * "attached" to any feed (its set of change listeners is empty).
640 *
641 * This method does nothing if this subscription is closed.
642 *
643 * Example:
644 * ```cpp
645 * auto sub = endpoint->getFeed()->createSubscription({dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE});
646 *
647 * sub->addEventListener(std::function([](const std::vector<std::shared_ptr<dxfcpp::Quotes>> &quotes) -> void {
648 * for (const auto &q : quotes) {
649 * std::cout << "Q : " + q->toString() << std::endl;
650 * }
651 * }));
652 *
653 * sub->addEventListener<dxfcpp::TimeAndSale>([](const auto &timeAndSales) -> void {
654 * for (const auto &tns : timeAndSales) {
655 * std::cout << "TnS : " + tns->toString() << std::endl;
656 * }
657 * });
658 *
659 * sub->addEventListener<dxfcpp::MarketEvent>([](const auto &marketEvents) -> void {
660 * for (const auto &me : marketEvents) {
661 * std::cout << "Market Event's symbol: " + me->getEventSymbol() << std::endl;
662 * }
663 * });
664 *
665 * sub->addSymbols({"$TOP10L/Q", "AAPL", "$TICK", "SPX"});
666 * ```
667 *
668 * @tparam EventT The event type (EventType's child with field TYPE, convertible to EventTypeEnum or MarketEvent
669 * or LastingEvent or TimeSeriesEvent or IndexedEvent)
670 * @param listener The listener. Listener can be callable with signature: `void(const
671 * std::vector<std::shared_ptr<EventT>&)`
672 * @return The listener id
673 */
674 template <typename EventT>
675 std::size_t addEventListener(std::function<void(const std::vector<std::shared_ptr<EventT>> &)> &&listener)
676#if __cpp_concepts
678 (requires {
682#endif
683 {
684 if (!tryToSetEventListenerHandle()) {
685 return SimpleHandler<void(const std::vector<std::shared_ptr<EventType>> &)>::FAKE_ID;
686 }
687
688 return onEvent_ += [l = listener](auto &&events) {
689 std::vector<std::shared_ptr<EventT>> filteredEvents{};
690
691 filteredEvents.reserve(events.size());
692
693 for (const auto &e : events) {
694 if (auto expected = e->template sharedAs<EventT>(); expected) {
695 filteredEvents.emplace_back(expected);
696 }
697 }
698
699 l(filteredEvents);
700 };
701 }
702
703 /**
704 * Removes listener for events.
705 *
706 * Example:
707 * ```cpp
708 * auto id = sub->addEventListener([](auto){});
709 *
710 * sub->removeEventListener(id);
711 * ```
712 *
713 * @param listenerId The listener id
714 */
715 void removeEventListener(std::size_t listenerId);
716
717 /**
718 * Returns a reference to an incoming events' handler (delegate), to which listeners can be added and removed.
719 * Listener can be callable with signature: `void(const std::vector<std::shared_ptr<EventType>&)`
720 *
721 * Example:
722 * ```cpp
723 * auto sub = endpoint->getFeed()->createSubscription({dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE});
724 * auto id = sub->onEvent() += [](auto &&events) {
725 * for (const auto &e : events) {
726 * if (auto quote = e->template sharedAs<dxfcpp::Quote>(); quote) {
727 * std::cout << "Q : " + quote->toString() << std::endl;
728 * } else if (auto tns = e->template sharedAs<dxfcpp::TimeAndSale>(); tns) {
729 * std::cout << "TnS : " + tns->toString() << std::endl;
730 * }
731 * }
732 * };
733 *
734 * sub->addSymbols({"$TOP10L/Q", "$SP500#45", "$TICK", "SPX"});
735 * sub->onEvent() -= id;
736 * ```
737 *
738 * @return The incoming events' handler (delegate)
739 */
740 OnEventHandler &onEvent();
741
742 std::size_t addChangeListener(std::shared_ptr<ObservableSubscriptionChangeListener> listener) override;
743
744 void removeChangeListener(std::size_t changeListenerId) override;
745
746 /**
747 * @return maximum number of events in the single notification of OnEventHandler.
748 * Special cases are supported for constants ::OPTIMAL_BATCH_LIMIT and ::MAX_BATCH_LIMIT.
749 */
750 std::int32_t getEventsBatchLimit() const;
751
752 /**
753 * Sets maximum number of events in the single notification of OnEventHandler.
754 * Special cases are supported for constants ::OPTIMAL_BATCH_LIMIT and ::MAX_BATCH_LIMIT.
755 *
756 * @param eventsBatchLimit the notification events limit
757 * @throws JavaException if eventsBatchLimit < 0 (see ::OPTIMAL_BATCH_LIMIT or ::MAX_BATCH_LIMIT)
758 */
759 void setEventsBatchLimit(std::int32_t eventsBatchLimit) const;
760};
761
762/**
763 * Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols and event types.
764 * This class decorates symbols that are passed to `xxxSymbols` methods in DXFeedSubscription by wrapping them into
765 * TimeSeriesSubscriptionSymbol instances with the current value of
766 * @ref DXFeedTimeSeriesSubscription::getFromTime() "fromTime" property. While
767 * @ref DXFeedSubscription::getSymbols() "getSymbols" method returns original (undecorated) symbols, any installed
768 * ObservableSubscriptionChangeListener will see decorated ones.
769 *
770 * <p> Only events that implement the TimeSeriesEvent interface can be subscribed to with DXFeedTimeSeriesSubscription.
771 *
772 * <h3>From time</h3>
773 *
774 * The value of @ref DXFeedTimeSeriesSubscription::getFromTime() "fromTime" property defines the time-span of events
775 * that are subscribed to. Only events that satisfy `event.getEventTime() >= thisSubscription->getFromTime()` are
776 * looked for.
777 *
778 * <p> The value `fromTime` is initially set to `std::numeric_limits<std::int64_t>::max()` with a special meaning that
779 * no events will be received until `fromTime` is changed with
780 * @ref DXFeedTimeSeriesSubscription::setFromTime() "setFromTime" method.
781 *
782 * <h3>Threads and locks</h3>
783 *
784 * This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
785 */
787 std::atomic<std::int64_t> fromTime_{std::numeric_limits<std::int64_t>::max()};
788
789 static void registerEntity();
790
791 public:
792 DXFeedTimeSeriesSubscription(RequireMakeShared<DXFeedTimeSeriesSubscription>::LockExternalConstructionTag lockTag);
793
794 DXFeedTimeSeriesSubscription(RequireMakeShared<DXFeedTimeSeriesSubscription>::LockExternalConstructionTag lockTag,
795 const EventTypeEnum &eventType, JavaObjectHandle<DXFeedSubscription> &&handle);
796
797 ~DXFeedTimeSeriesSubscription() override;
798
799 template <typename EventTypeIt>
800#if __cpp_concepts
801 requires requires(EventTypeIt iter) {
802 { *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
803 }
804#endif
805 DXFeedTimeSeriesSubscription(RequireMakeShared<DXFeedTimeSeriesSubscription>::LockExternalConstructionTag,
806 EventTypeIt begin, EventTypeIt end, JavaObjectHandle<DXFeedSubscription> &&handle)
807 : DXFeedSubscription(begin, end, std::move(handle)) {
808 registerEntity();
809 }
810
811 DXFeedTimeSeriesSubscription(RequireMakeShared<DXFeedTimeSeriesSubscription>::LockExternalConstructionTag lockTag,
812 std::initializer_list<EventTypeEnum> eventTypes,
813 JavaObjectHandle<DXFeedSubscription> &&handle)
814 : DXFeedTimeSeriesSubscription(lockTag, eventTypes.begin(), eventTypes.end(), std::move(handle)) {
815 }
816
817 template <typename EventTypesCollection>
818 explicit DXFeedTimeSeriesSubscription(
819 RequireMakeShared<DXFeedTimeSeriesSubscription>::LockExternalConstructionTag tag,
820 EventTypesCollection &&eventTypes, JavaObjectHandle<DXFeedSubscription> &&handle)
821#if __cpp_concepts
822 requires requires {
823 {
824 DXFeedTimeSeriesSubscription(tag, std::begin(std::forward<EventTypesCollection>(eventTypes)),
825 std::end(std::forward<EventTypesCollection>(eventTypes)),
826 std::move(handle))
827 };
828 }
829#endif
830 : DXFeedTimeSeriesSubscription(tag, std::begin(std::forward<EventTypesCollection>(eventTypes)),
831 std::end(std::forward<EventTypesCollection>(eventTypes)), std::move(handle)) {
832 }
833
834 ///
835 std::string toString() const override;
836
837 /**
838 * Returns the earliest timestamp from which time-series of events shall be received.
839 * The timestamp is in milliseconds from midnight, January 1, 1970 UTC.
840 *
841 * @return the earliest timestamp from which time-series of events shall be received.
842 */
843 std::int64_t getFromTime();
844
845 /**
846 * Sets the earliest timestamp from which time-series of events shall be received.
847 * The timestamp is in milliseconds from midnight, January 1, 1970 UTC.
848 *
849 * @param fromTime the timestamp.
850 */
851 void setFromTime(std::int64_t fromTime);
852
853 /**
854 * Sets the earliest timestamp from which time-series of events shall be received.
855 * The timestamp is in milliseconds from midnight, January 1, 1970 UTC.
856 *
857 * @param fromTime the timestamp.
858 */
859 void setFromTime(std::chrono::milliseconds fromTime);
860};
861
863
#define DXFCPP_MACRO_CONCAT_INNER(a, b)
Definition Common.hpp:129
#define DXFCPP_MACRO_CONCAT(a, b)
Definition Common.hpp:128
#define DXFCPP_MACRO_UNIQUE_NAME(base)
Definition Common.hpp:130
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:31
#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_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:680
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:713
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:961
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1151
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:740
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:1097
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:1012
#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:910
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:1063
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:799
#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:1080
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:696
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:787
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:978
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:1123
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:73
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:757
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1146
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:1046
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:893
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:647
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:995
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:927
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:944
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:846
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:822
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:663
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:869
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1156
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:1029
Builder class for DXEndpoint that supports additional configuration properties.
Definition DXEndpoint.hpp:842
std::shared_ptr< DXEndpoint > build()
Builds DXEndpoint instance.
Definition DXEndpoint.cpp:323
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:366
bool supportsProperty(const StringLike &key) const
Checks if a property is supported.
Definition DXEndpoint.cpp:313
std::shared_ptr< Builder > withProperties(Properties &&properties)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.hpp:931
~Builder() noexcept override
Releases the GraalVM handle.
Definition DXEndpoint.cpp:355
std::shared_ptr< Builder > withRole(Role role)
Sets role for the created DXEndpoint.
Definition DXEndpoint.cpp:285
std::shared_ptr< Builder > withProperty(const StringLike &key, const StringLike &value)
Sets the specified property.
Definition DXEndpoint.cpp:298
Subscription for a set of symbols and event types.
Definition DXFeedSubscription.hpp:39
void removeEventListener(std::size_t listenerId)
Removes listener for events.
Definition DXFeedSubscription.cpp:255
bool containsEventType(const EventTypeEnum &eventType) override
Returns true if this subscription contains the corresponding event type.
Definition DXFeedSubscription.cpp:182
std::size_t addChangeListener(std::shared_ptr< ObservableSubscriptionChangeListener > listener) override
Adds subscription change listener.
Definition DXFeedSubscription.cpp:265
bool isClosed() override
Returns true if this subscription is closed.
Definition DXFeedSubscription.cpp:160
void addSymbols(SymbolIt begin, SymbolIt end) const
Adds the specified collection (using iterators) of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:430
static std::shared_ptr< DXFeedSubscription > create(std::initializer_list< EventTypeEnum > eventTypes)
Creates a detached subscription for the given collection of event types.
Definition DXFeedSubscription.cpp:133
void close() const
Closes this subscription and makes it permanently detached.
Definition DXFeedSubscription.cpp:169
void setEventsBatchLimit(std::int32_t eventsBatchLimit) const
Sets maximum number of events in the single notification of OnEventHandler.
Definition DXFeedSubscription.cpp:303
std::unordered_set< EventTypeEnum > getEventTypes() override
Returns a set of subscribed event types.
Definition DXFeedSubscription.cpp:178
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:213
void removeSymbols(SymbolIt begin, SymbolIt end) const
Removes the specified collection (using iterators) of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:502
void removeSymbols(SymbolsCollection &&collection) const
Removes the specified collection of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:528
static const std::int32_t MAX_BATCH_LIMIT
The maximum events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:55
void removeSymbols(const SymbolWrapper &symbolWrapper) const
Removes the specified symbol from the set of subscribed symbols.
Definition DXFeedSubscription.cpp:232
static std::shared_ptr< DXFeedSubscription > create(EventTypeIt begin, EventTypeIt end)
Creates a detached subscription for the given collection of event types.
Definition DXFeedSubscription.hpp:211
void attach(std::shared_ptr< DXFeed > feed)
Attaches subscription to the specified feed.
Definition DXFeedSubscription.cpp:142
TimePeriod getAggregationPeriod() const
Returns the aggregation period for data for this subscription instance.
Definition DXFeedSubscription.cpp:247
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeedSubscription.cpp:100
static const std::int32_t OPTIMAL_BATCH_LIMIT
The optimal events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:50
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:228
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:381
void setAggregationPeriod(const TimePeriod &aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:251
static std::shared_ptr< DXFeedSubscription > create(const EventTypeEnum &eventType)
Creates a detached subscription for a single event type.
Definition DXFeedSubscription.cpp:119
std::int32_t getEventsBatchLimit() const
Definition DXFeedSubscription.cpp:299
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:257
OnEventHandler & onEvent()
Returns a reference to an incoming events' handler (delegate), to which listeners can be added and re...
Definition DXFeedSubscription.cpp:259
void addSymbols(const SymbolsCollection &collection) const
Adds the specified collection of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:456
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:355
void setAggregationPeriod(std::int64_t aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.hpp:584
void removeChangeListener(std::size_t changeListenerId) override
Removes subscription change listener by id.
Definition DXFeedSubscription.cpp:282
std::vector< SymbolWrapper > getDecoratedSymbols() const
Returns a set of decorated symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:204
void clear() const
Clears the set of subscribed symbols.
Definition DXFeedSubscription.cpp:186
void detach(std::shared_ptr< DXFeed > feed)
Detaches subscription from the specified feed.
Definition DXFeedSubscription.cpp:151
void addSymbols(const SymbolWrapper &symbolWrapper) const
Adds the specified symbol to the set of subscribed symbols.
Definition DXFeedSubscription.cpp:217
void setAggregationPeriod(std::chrono::milliseconds aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.hpp:571
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:243
std::vector< SymbolWrapper > getSymbols() const
Returns a set of subscribed symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:195
Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols an...
Definition DXFeedSubscription.hpp:786
std::int64_t getFromTime()
Returns the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:331
void setFromTime(std::chrono::milliseconds fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:342
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeedSubscription.cpp:327
void setFromTime(std::int64_t fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:335
The enumeration type that provides additional information about the dxFeed Graal C++-API event type.
Definition EventTypeEnum.hpp:21
Source identifier for IndexedEvent.
Definition IndexedEventSource.hpp:22
Mixin for wrapping calls to common promise methods.
Definition Promise.hpp:73
JavaException getException() const
Returns exceptional outcome of computation.
Definition Promise.hpp:121
void cancel() const
This method cancels computation.
Definition Promise.hpp:168
bool hasResult() const
Returns true when computation has completed normally.
Definition Promise.hpp:89
bool isCancelled() const
Returns true when computation was cancelled.
Definition Promise.hpp:108
bool hasException() const
Returns true when a computation has completed exceptionally or was canceled.
Definition Promise.hpp:98
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:155
bool isDone() const
Returns true when a computation has completed normally, or exceptionally, or was canceled.
Definition Promise.hpp:79
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:138
Manages network connections to feed or publisher.
Definition DXEndpoint.hpp:172
bool isClosed() const
Definition DXEndpoint.cpp:499
SimpleHandler< void(DXEndpoint::State, DXEndpoint::State)> & onStateChange() noexcept
Returns the onStateChange handler that can be used to add or remove listeners.
Definition DXEndpoint.cpp:511
static const std::string DXFEED_PASSWORD_PROPERTY
"dxfeed.password"
Definition DXEndpoint.hpp:238
static std::shared_ptr< DXEndpoint > create(Role role)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:486
std::shared_ptr< DXFeed > getFeed() const
Definition DXEndpoint.cpp:212
std::shared_ptr< DXEndpoint > password(const StringLike &password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:139
State
Represents the current state of endpoint.
Definition DXEndpoint.hpp:436
@ CLOSED
Endpoint was closed.
Definition DXEndpoint.hpp:456
@ CONNECTING
The connect method was called to establish connection to remove endpoint, but the connection is not e...
Definition DXEndpoint.hpp:446
@ CONNECTED
The connection to the remote endpoint is established.
Definition DXEndpoint.hpp:451
@ NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition DXEndpoint.hpp:440
std::shared_ptr< DXEndpoint > user(const StringLike &user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:132
void reconnect() const
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:158
static std::shared_ptr< DXEndpoint > create()
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:477
void removeStateChangeListener(std::size_t listenerId) noexcept
Removes a listener notified about changes in state property.
Definition DXEndpoint.cpp:507
const std::string & getName() const &noexcept
Definition DXEndpoint.cpp:503
Role
Represents the role of an endpoint that was specified during its creation.
Definition DXEndpoint.hpp:365
@ PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition DXEndpoint.hpp:410
@ STREAM_FEED
STREAM_FEED endpoint is similar to DXEndpoint::FEED and also connects to the remote data feed provide...
Definition DXEndpoint.hpp:398
@ LOCAL_HUB
LOCAL_HUB endpoint is a local hub without the ability to establish network connections.
Definition DXEndpoint.hpp:426
@ ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXEndpoint::FEED, but it is designed to be used with OnDemandSe...
Definition DXEndpoint.hpp:389
@ STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXEndpoint::PUBLISHER and also connects to the remote publish...
Definition DXEndpoint.hpp:419
@ FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition DXEndpoint.hpp:376
std::string toString() const override
Returns a string representation of the current object.
Definition DXEndpoint.cpp:376
void awaitProcessed() const
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:194
std::shared_ptr< DXPublisher > getPublisher() const
Definition DXEndpoint.cpp:221
static const std::string DXFEED_WILDCARD_ENABLE_PROPERTY
"dxfeed.wildcard.enable"
Definition DXEndpoint.hpp:266
std::size_t addStateChangeListener(std::function< void(State, State)> listener) noexcept
Adds a listener notified about changes in state property.
Definition DXEndpoint.hpp:611
static const std::string DXENDPOINT_EVENT_TIME_PROPERTY
"dxendpoint.eventTime"
Definition DXEndpoint.hpp:311
static const std::string DXPUBLISHER_THREAD_POOL_SIZE_PROPERTY
"dxpublisher.threadPoolSize"
Definition DXEndpoint.hpp:294
State getState() const
Returns the state of this endpoint.
Definition DXEndpoint.cpp:128
static const std::string DXENDPOINT_STORE_EVERYTHING_PROPERTY
"dxendpoint.storeEverything"
Definition DXEndpoint.hpp:324
void awaitNotConnected() const
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:185
static std::shared_ptr< DXEndpoint > getInstance(Role role)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:459
static const std::string DXFEED_AGGREGATION_PERIOD_PROPERTY
"dxfeed.aggregationPeriod"
Definition DXEndpoint.hpp:257
void close() const
Closes this endpoint.
Definition DXEndpoint.cpp:515
static const std::string DXFEED_THREAD_POOL_SIZE_PROPERTY
"dxfeed.threadPoolSize"
Definition DXEndpoint.hpp:247
void disconnect() const
Terminates all remote network connections.
Definition DXEndpoint.cpp:167
void closeAndAwaitTermination() const
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:203
static std::shared_ptr< DXEndpoint > getInstance()
Returns a default application-wide singleton instance of DXEndpoint with a FEED role.
Definition DXEndpoint.cpp:450
static const std::string DXPUBLISHER_ADDRESS_PROPERTY
"dxpublisher.address"
Definition DXEndpoint.hpp:285
static const std::string DXFEED_USER_PROPERTY
"dxfeed.user"
Definition DXEndpoint.hpp:228
static const std::string NAME_PROPERTY
"name"
Definition DXEndpoint.hpp:189
static const std::string DXSCHEME_ENABLED_PROPERTY_PREFIX
"dxscheme.enabled."
Definition DXEndpoint.hpp:358
static const std::string DXPUBLISHER_PROPERTIES_PROPERTY
"dxpublisher.properties"
Definition DXEndpoint.hpp:275
static const std::string DXSCHEME_NANO_TIME_PROPERTY
"dxscheme.nanoTime"
Definition DXEndpoint.hpp:344
static const std::string DXFEED_ADDRESS_PROPERTY
"dxfeed.address"
Definition DXEndpoint.hpp:218
void disconnectAndClear() const
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:176
Role getRole() const noexcept
Returns the role of this endpoint.
Definition DXEndpoint.cpp:495
static const std::string DXFEED_PROPERTIES_PROPERTY
"dxfeed.properties"
Definition DXEndpoint.hpp:200
static std::shared_ptr< Builder > newBuilder()
Creates a new Builder instance.
Definition DXEndpoint.cpp:468
std::shared_ptr< DXEndpoint > connect(const StringLike &address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:146
Main entry class for dxFeed API (read it first).
Definition DXFeed.hpp:115
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:65
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::int64_t fromTime) const
Returns time series of events for the specified event type, symbol and a range of time (without an up...
Definition DXFeed.hpp:1000
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(EventTypeIt begin, EventTypeIt end)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:469
std::shared_ptr< DXFeedSubscription > createSubscription(EventTypeIt begin, EventTypeIt end)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:357
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypesCollection &eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:407
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypesCollection &eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:534
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:716
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:984
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::int64_t fromTime, std::int64_t 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:932
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:85
std::shared_ptr< Promise< std::vector< std::shared_ptr< E > > > > getTimeSeriesPromise(const SymbolWrapper &symbol, std::int64_t fromTime, std::int64_t toTime) const
Requests time series of events for the specified event type, symbol and a range of time.
Definition DXFeed.hpp:880
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:670
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:304
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:98
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:1015
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:16
std::shared_ptr< E > getLastEvent(std::shared_ptr< E > event)
Returns the last event for the specified event instance.
Definition DXFeed.hpp:244
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:623
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:575
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(std::initializer_list< EventTypeEnum > eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:135
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeed.cpp:224
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:769
void detachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed.
Definition DXFeed.cpp:45
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:825
const Collection & getLastEvents(const Collection &events)
Returns the last events for the specified list of event instances.
Definition DXFeed.hpp:265
void attachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Attaches the given subscription to this feed.
Definition DXFeed.cpp:25
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:113
Provides API for publishing of events to local or remote DXFeed.
Definition DXPublisher.hpp:56
Base abstract class for all dxFeed C++ API entities.
Definition Entity.hpp:13
virtual ~Entity() noexcept=default
The default virtual d-tor.
Mixin for wrapping Promise method calls for a single event.
Definition Promise.hpp:237
std::shared_ptr< E > getResult() const
Returns result of computation.
Definition Promise.hpp:245
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:255
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:285
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:270
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:31
The wrapper over CEntryPointErrorsEnum, the error code returned by GraalVM.
Definition GraalException.hpp:21
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:41
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition InvalidArgumentException.hpp:18
A wrapper over the interceptable Java exceptions thrown by the dxFeed Native Graal SDK.
Definition JavaException.hpp:20
static void throwIfJavaThreadExceptionExists()
Throws a JavaException if it exists (i.e. intercepted by Graal SDK)
Definition JavaException.cpp:31
static JavaException create(void *exceptionHandle)
Creates an exception using native (GraalVM) Java exception handle.
Definition JavaException.cpp:21
JavaException(const StringLike &message, const StringLike &className, const StringLike &stackTrace)
Creates an exception using Java message, className and stack trace.
Definition JavaException.cpp:13
Represents up-to-date information about some condition or state of an external entity that updates in...
Definition LastingEvent.hpp:28
Base class for all market events.
Definition MarketEvent.hpp:24
The listener interface for receiving notifications on the changes of observed subscription.
Definition ObservableSubscriptionChangeListener.hpp:23
Observable set of subscription symbols.
Definition ObservableSubscription.hpp:21
Provides on-demand historical tick data replay controls.
Definition OnDemandService.hpp:71
A list of event receiving results that will be completed normally or exceptionally in the future.
Definition Promise.hpp:435
Result of a computation that will be completed normally or exceptionally in the future.
Definition Promise.hpp:351
A class that represents a promise-based implementation often used for handling asynchronous operation...
Definition Promises.hpp:41
A helper class needed to construct smart pointers to objects and does not allow explicit construction...
Definition SharedEntity.hpp:88
static auto createShared(Args &&...args)
Creates a smart pointer to an object.
Definition SharedEntity.hpp:102
A runtime axception with stacktrace.
Definition RuntimeException.hpp:20
const std::string & getStackTrace() const &
Definition RuntimeException.cpp:81
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:20
virtual std::string toString() const
Returns a string representation of the current object.
Definition SharedEntity.hpp:77
std::shared_ptr< T > sharedAs() const noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T.
Definition SharedEntity.hpp:68
std::shared_ptr< T > sharedAs() noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T.
Definition SharedEntity.hpp:55
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:34
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:377
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:397
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:315
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:326
SimpleHandler() noexcept=default
Creates the new handler.
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:357
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:416
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:388
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:336
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition Common.hpp:959
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition StringUtils.hpp:171
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:842
A lightweight wrapper around strings or string-like inputs.
Definition StringUtils.hpp:27
Value class for period of time with support for ISO8601 duration format.
Definition TimePeriod.hpp:21
static TimePeriod valueOf(std::int64_t value)
Returns TimePeriod with value milliseconds.
Definition TimePeriod.cpp:20
Represents time-series snapshots of some process that is evolving in time or actual events in some ex...
Definition TimeSeriesEvent.hpp:81
Mixin for wrapping Promise method calls for a void.
Definition Promise.hpp:178
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:210
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:225
void await() const
Wait for the computation to complete and return its result or throw an exception in case of exception...
Definition Promise.hpp:195
void getResult() const
Returns result of computation.
Definition Promise.hpp:185
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