dxFeed Graal CXX API v4.2.0
Loading...
Searching...
No Matches
api.h
Go to the documentation of this file.
1// Copyright (c) 2025 Devexperts LLC.
2// SPDX-License-Identifier: MPL-2.0
3
4#ifndef DXFEED_NATIVE_API_H_INCLUDED
5#define DXFEED_NATIVE_API_H_INCLUDED
6
7#ifdef __cplusplus
8# include <cstddef>
9# include <cstdint>
10
11extern "C" {
12#else
13# include <stddef.h>
14# include <stdint.h>
15#endif
16
17#define DXFC_OUT
18
19#ifndef DXFCPP_EXPORT
20# if defined(DXFCPP_USE_DLLS) && defined(_MSC_VER)
21# if defined(LIBDXFCPP_EXPORTS)
22# define DXFCPP_EXPORT __declspec(dllexport)
23# define DXFCPP_EXPORT_TEMPLATE_DECLARE
24# define DXFCPP_EXPORT_TEMPLATE_DEFINE __declspec(dllexport)
25# else
26# define DXFCPP_EXPORT __declspec(dllimport)
27# define DXFCPP_EXPORT_TEMPLATE_DECLARE
28# define DXFCPP_EXPORT_TEMPLATE_DEFINE __declspec(dllimport)
29# endif // defined(LIBDXFCPP_EXPORTS)
30# elif defined(DXFCPP_USE_DLLS) && defined(LIBDXFCPP_EXPORTS)
31# define DXFCPP_EXPORT __attribute__((visibility("default")))
32# define DXFCPP_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default")))
33# define DXFCPP_EXPORT_TEMPLATE_DEFINE
34# else
35# define DXFCPP_EXPORT
36# define DXFCPP_EXPORT_TEMPLATE_DECLARE
37# define DXFCPP_EXPORT_TEMPLATE_DEFINE
38# endif
39#endif
40
41/**
42 * @file
43 * @brief dxFeed Native C API enums, structs and functions declarations
44 */
45
46/**
47 * @brief List of error codes.
48 */
49typedef enum dxfc_error_code_t {
50 /**
51 * @brief OK.
52 */
54 /**
55 * @brief dxFeed Graal Native API error.
56 */
58
59 /// The error returned if the current operation cannot be completed.
61} dxfc_error_code_t;
62
63/**
64 * Sets the system property indicated by the specified key.
65 *
66 * @param key The name of the system property (UTF-8 string).
67 * @param value The value of the system property (UTF-8 string).
68 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
69 */
70DXFCPP_EXPORT dxfc_error_code_t dxfc_system_set_property(const char *key, const char *value);
71
72/**
73 * Gets the system property indicated by the specified key.
74 *
75 * The buffer must be allocated in advance. If the system property value does not fit into the buffer, it will be
76 * truncated. The buffer should be large enough to the \0 at the end.
77 * Invalid UTF-8 characters resulting from a string that does not fit in the buffer will be discarded.
78 *
79 * @param key The name of the system property (UTF-8 string)
80 * @param[out] buffer The buffer to store the system property (UTF-8 string)
81 * @param buffer_size The buffer's size.
82 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
83 */
84DXFCPP_EXPORT dxfc_error_code_t dxfc_system_get_property(const char *key, DXFC_OUT char *buffer, size_t buffer_size);
85
86/**
87 * Represents the role of endpoint that was specified during its @ref dxfc_dxendpoint_create() "creation".
88 */
90 /**
91 * `FEED` endpoint connects to the remote data feed provider and is optimized for real-time or
92 * delayed data processing (<b>this is a default role</b>). dxfc_dxendpoint_get_feed() function
93 * returns feed object that subscribes to the remote data feed provider and receives events from it.
94 * When event processing threads cannot keep up (don't have enough CPU time), data is dynamically conflated to
95 * minimize latency between received events and their processing time.
96 *
97 * This endpoint is automatically connected to the configured data feed.
98 */
100
101 /**
102 * `ON_DEMAND_FEED` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with
103 * dxfc_on_demand_service_t for historical data replay only.
104 *
105 * `ON_DEMAND_FEED` endpoint cannot be connected to an ordinary data feed at all.
106 */
108
109 /**
110 * `STREAM_FEED` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data feed
111 * provider, but is designed for bulk parsing of data from files. dxfc_dxendpoint_get_feed() function returns feed
112 * object that subscribes to the data from the opened files and receives events from them. Events from the files are
113 * not conflated, are not skipped, and are processed as fast as possible. Note, that in this role,
114 * dxfc_dxfeed_get_last_event() function does not work.
115 */
117
118 /**
119 * `PUBLISHER` endpoint connects to the remote publisher hub (also known as multiplexor) or
120 * creates a publisher on the local host. dxfc_dxendpoint_get_publisher() function returns
121 * a publisher object that publishes events to all connected feeds.
122 * Note, that in this role, dxfc_dxfeed_get_last_event() function does not work and
123 * time-series subscription is not supported.
124 *
125 * This endpoint is automatically connected to the configured data feed.
126 */
128
129 /**
130 * `STREAM_PUBLISHER` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remote
131 * publisher hub, but is designed for bulk publishing of data. dxfc_dxendpoint_get_publisher() function returns a
132 * publisher object that publishes events to all connected feeds. Published events are not conflated, are not
133 * skipped, and are processed as fast as possible. Note, that in this role, dxfc_dxfeed_get_last_event() function
134 * does not work and time-series subscription is not supported.
135 */
137
138 /**
139 * `LOCAL_HUB` endpoint is a local hub without ability to establish network connections.
140 * Events that are published via @ref dxfc_dxendpoint_get_publisher() "publisher" are delivered to local
141 * @ref dxfc_dxendpoint_get_feed() "feed" only.
142 */
144} dxfc_dxendpoint_role_t;
145
146/**
147 * Represents the current state of endpoint.
148 */
150 /**
151 * Endpoint was created by is not connected to remote endpoints.
152 */
154
155 /**
156 * The @ref dxfc_dxendpoint_connect() "connect" function was called to establish connection to
157 * remove endpoint, but connection is not actually established yet or was lost.
158 */
160
161 /**
162 * The connection to remote endpoint is established.
163 */
165
166 /**
167 * Endpoint was @ref dxfc_dxendpoint_close() "closed".
168 */
170} dxfc_dxendpoint_state_t;
171
172/**
173 * The endpoint current state change listener
174 *
175 * @see dxfc_dxendpoint_add_state_change_listener()
176 * @see dxfc_dxendpoint_remove_state_change_listener()
177 */
178typedef void (*dxfc_dxendpoint_state_change_listener)(dxfc_dxendpoint_state_t old_state,
179 dxfc_dxendpoint_state_t new_state, void *user_data);
180
181/**
182 * The simple key-value structure that represents an endpoint's property
183 */
185 /// The property's key
186 const char *key;
187 /// The property's value
188 const char *value;
189} dxfc_dxendpoint_property_t;
190
191/**
192 * The dxFeed endpoint handle. It is used for searching, adding endpoints to the "registry", deleting endpoints from
193 * the "registry" and calling functions associated with a particular endpoint.
194 *
195 * The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown.
196 * This can be forced by calling the dxfc_dxendpoint_free() function.
197 */
198typedef void *dxfc_dxendpoint_t;
199
200/**
201 * The dxFeed endpoint's builder handle. It is used for searching, adding builders to the "registry", deleting builders
202 * from the "registry" and calling functions associated with a particular builder.
203 *
204 * The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown.
205 * This can be forced by calling the dxfc_dxendpoint_builder_free() function.
206 */
208
209/**
210 * The dxFeed handle.
211 */
212typedef void *dxfc_dxfeed_t;
213
214/**
215 * The dxFeed publisher handle.
216 */
217typedef void *dxfc_dxpublisher_t;
218
219/**
220 * Creates new dxFeed endpoint's builder instance.
221 * Use dxfc_dxendpoint_builder_build to build an instance of dxFeed endpoint when all configuration properties were set.
222 *
223 * @param[out] builder The created endpoint's builder.
224 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
225 */
227
228/**
229 * Sets role for the created dxFeed endpoint.
230 * Default role is @ref DXFC_DXENDPOINT_ROLE_FEED "FEED".
231 *
232 * @param builder The endpoint's builder
233 * @param role The endpoint's role
234 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
235 */
237 dxfc_dxendpoint_role_t role);
238
239/**
240 * Changes name that is used to distinguish multiple endpoints
241 * in the same process (GraalVM Isolate) in logs and in other diagnostic means.
242 *
243 * @param builder The endpoint's builder
244 * @param name The endpoint's name
245 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
246 */
247DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builder, const char *name);
248
249/**
250 * Sets the specified property. Unsupported properties are ignored.
251 *
252 * @param builder The endpoint's builder
253 * @param key The endpoint's property key
254 * @param value The endpoint's property value
255 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
256 */
258 const char *key, const char *value);
259
260/**
261 * Sets all supported properties from the provided properties object.
262 *
263 * @param builder The endpoint's builder
264 * @param properties The endpoint's properties
265 * @param size The size of the endpoint's properties
266 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
267 */
269 const dxfc_dxendpoint_property_t **properties,
270 size_t size);
271
272/**
273 * Checks if a property is supported
274 *
275 * @param builder The endpoint's builder
276 * @param key The property's key to be checked for support
277 * @param[out] supports `1` if the corresponding property key is supported.
278 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
279 */
281 const char *key, DXFC_OUT int *supports);
282
283/**
284 * Builds the new dxFeed endpoint instance.
285 *
286 * @param builder The endpoint's builder
287 * @param user_data User data that will be passed to the endpoint's state transition listeners.
288 * @param[out] endpoint The created endpoint
289 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
290 */
291DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data,
292 DXFC_OUT dxfc_dxendpoint_t *endpoint);
293
294/**
295 * Removes a builder from the registry.
296 *
297 * @param builder The endpoint's builder
298 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
299 */
301
302/**
303 * Returns a default application-wide singleton instance of dxFeed endpoint with a @ref DXFC_DXENDPOINT_ROLE_FEED "FEED"
304 * role. Most applications use only a single data-source and should rely on this function to get one. This function
305 * creates an endpoint on the first use with a default configuration. You can provide configuration via system
306 * properties.
307 *
308 * This is a shortcut to
309 * ```c
310 * dxfc_dxendpoint_t endpoint;
311 *
312 * dxfc_dxendpoint_get_instance2(DXFC_DXENDPOINT_ROLE_FEED, user_data, &endpoint);
313 * ```
314 *
315 * @param user_data User data that will be passed to the endpoint's state transition listeners.
316 * @param[out] endpoint The created endpoint
317 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
318 */
319DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint);
320
321/**
322 * Returns a default application-wide singleton instance of DXEndpoint for a specific role.
323 * Most applications use only a single data-source and should rely on this function to get one.
324 * This function creates an endpoint with the corresponding role on the first use with a default
325 * configuration.
326 * You can provide configuration via system properties.
327 *
328 * The configuration does not have to include an address. You can use @ref dxfc_dxendpoint_connect()
329 * "connect(endpoint, address)" and dxfc_dxendpoint_disconnect() functions on the instance that is returned by this
330 * function to programmatically
331 * establish and tear-down connection to a user-provided address.
332 *
333 * If you need a fully programmatic configuration and/or multiple endpoints of the same role in your
334 * application, then create a custom instance of dxFeed endpoint with dxfc_dxendpoint_new_builder() function, configure
335 * it, and use dxfc_dxendpoint_builder_build() function.
336 *
337 * @param role The role of dxFeed endpoint instance
338 * @param user_data User data that will be passed to the endpoint's state transition listeners.
339 * @param[out] endpoint The created endpoint
340 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
341 */
342DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data,
343 DXFC_OUT dxfc_dxendpoint_t *endpoint);
344
345/**
346 * Creates an endpoint with @ref DXFC_DXENDPOINT_ROLE_FEED "FEED" role.
347 * The result of this function is the same as <b>`dxfc_dxendpoint_create2(DXFC_DXENDPOINT_ROLE_FEED, user_data,
348 * &endpoint)`</b>. This is a shortcut to
349 * ```c
350 * dxfc_dxendpoint_builder_t builder;
351 * dxfc_dxendpoint_t endpoint;
352 *
353 * dxfc_dxendpoint_new_builder(&builder);
354 * dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
355 * ```
356 *
357 * @param user_data User data that will be passed to the endpoint's state transition listeners.
358 * @param[out] endpoint The created endpoint
359 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
360 */
361DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint);
362
363/**
364 * Creates an endpoint with a specified role.
365 * This is a shortcut to
366 * ```c
367 * dxfc_dxendpoint_builder_t builder;
368 * dxfc_dxendpoint_t endpoint;
369 *
370 * dxfc_dxendpoint_new_builder(&builder);
371 * dxfc_dxendpoint_builder_with_role(builder, role);
372 * dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
373 * ```
374 *
375 * @param role The role of dxFeed endpoint instance
376 * @param user_data User data that will be passed to the endpoint's state transition listeners.
377 * @param[out] endpoint The created endpoint
378 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
379 */
380DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create2(dxfc_dxendpoint_role_t role, void *user_data,
381 DXFC_OUT dxfc_dxendpoint_t *endpoint);
382
383/**
384 * Closes this endpoint. All network connection are terminated as with dxfc_dxendpoint_disconnect() function and no
385 * further connections can be established.
386 *
387 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
388 * All resources associated with this endpoint are released.
389 *
390 * @param endpoint The dxFeed endpoint to close
391 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
392 */
393DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint);
394
395/**
396 * Closes this endpoint and wait until all pending data processing tasks are completed.
397 * This function performs the same actions as dxfc_dxendpoint_close(), but also awaits
398 * termination of all outstanding data processing tasks. It is designed to be used
399 * with @ref DXFC_DXENDPOINT_ROLE_STREAM_FEED "STREAM_FEED" role after dxfc_dxendpoint_await_not_connected() function
400 * returns to make sure that file was completely processed.
401 *
402 * <p><b>This function is blocking.</b>
403 *
404 * @param endpoint The dxFeed endpoint
405 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
406 */
408
409/**
410 * Returns the role of this endpoint.
411 *
412 * @param endpoint The dxFeed endpoint
413 * @param[out] role The role of this endpoint
414 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
415 */
417 DXFC_OUT dxfc_dxendpoint_role_t *role);
418
419/**
420 * Changes username for this endpoint.
421 * This function shall be called before @ref dxfc_dxendpoint_connect() "connect" together
422 * with @ref dxfc_dxendpoint_password() "password" to configure service access credentials.
423 *
424 * @param endpoint The dxFeed endpoint
425 * @param user The username
426 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
427 */
428DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user);
429
430/**
431 * Changes password for this endpoint.
432 * This function shall be called before @ref dxfc_dxendpoint_connect() "connect" together
433 * with @ref dxfc_dxendpoint_user() "user" to configure service access credentials.
434 *
435 * @param endpoint The dxFeed endpoint
436 * @param password The user password
437 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
438 */
439DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password);
440
441/**
442 * Connects to the specified remote address. Previously established connections are closed if
443 * the new address is different from the old one.
444 * This function does nothing if address does not change or if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED
445 * "CLOSED". The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref
446 * DXFC_DXENDPOINT_STATE_CONNECTING "CONNECTING" otherwise.
447 *
448 * <p> The address string is provided with the market data vendor agreement.
449 * Use "demo.dxfeed.com:7300" for a demo quote feed.
450 *
451 * <p> The simplest address strings have the following format:
452 * * `host:port` to establish a TCP/IP connection.
453 * * `:port` to listen for a TCP/IP connection with a plain socket connector (good for up to a
454 * few hundred of connections).
455 *
456 * <p>For premium services access credentials must be configured before invocation of `connect` function
457 * using @ref dxfc_dxendpoint_user() "user" and @ref dxfc_dxendpoint_password() "password" functions.
458 *
459 * <p> <b>This function does not wait until connection actually gets established</b>. The actual connection
460 * establishment happens asynchronously after the invocation of this function. However, this function waits until
461 * notification about state transition from DXFC_DXENDPOINT_STATE_NOT_CONNECTED to DXFC_DXENDPOINT_STATE_CONNECTING gets
462 * processed by all listeners.
463 *
464 * [Javadoc.](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/DXEndpoint.html#connect-java.lang.String-)
465 *
466 * @param endpoint The dxFeed endpoint
467 * @param address The data source address
468 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
469 */
470DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_connect(dxfc_dxendpoint_t endpoint, const char *address);
471
472/**
473 * Terminates all established network connections and initiates connecting again with the same address.
474 *
475 * <p>The effect of the function is alike to invoking dxfc_dxendpoint_disconnect() and dxfc_dxendpoint_connect()
476 * with the current address, but internal resources used for connections may be reused by implementation.
477 * TCP connections with multiple target addresses will try switch to an alternative address, configured
478 * reconnect timeouts will apply.
479 *
480 * <p><b>Note:</b> The function will not connect endpoint that was not initially connected with
481 * dxfc_dxendpoint_connect() function or was disconnected with dxfc_dxendpoint_disconnect() function.
482 *
483 * <p>The function initiates a short-path way for reconnecting, so whether observers will have a chance to see
484 * an intermediate state DXFC_DXENDPOINT_STATE_NOT_CONNECTED depends on the implementation.
485 *
486 * @param endpoint The dxFeed endpoint to reconnect
487 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
488 */
490
491/**
492 * Terminates all remote network connections.
493 * This function does nothing if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
494 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
495 * "NOT_CONNECTED" otherwise.
496 *
497 * <p>This function does not release all resources that are associated with this endpoint.
498 * Use dxfc_dxendpoint_disconnect() function to release all resources.
499 *
500 * @param endpoint The dxFeed endpoint to disconnect
501 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
502 */
504
505/**
506 * Terminates all remote network connections and clears stored data.
507 * This function does nothing if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
508 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
509 * "NOT_CONNECTED" otherwise.
510 *
511 * <p>This function does not release all resources that are associated with this endpoint.
512 * Use dxfc_dxendpoint_close() function to release all resources.
513 *
514 * @param endpoint The dxFeed endpoint
515 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
516 */
518
519/**
520 * Waits until this endpoint stops processing data (becomes quiescent).
521 * This is important when writing data to file via "tape:..." connector to make sure that
522 * all published data was written before closing this endpoint.
523 *
524 * @param endpoint The dxFeed endpoint
525 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
526 */
528
529/**
530 * Waits while this endpoint @ref dxfc_dxendpoint_get_state() "state" becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
531 * "NOT_CONNECTED" or
532 * @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED". It is a signal that any files that were opened with
533 * @ref dxfc_dxendpoint_connect() "dxfc_dxendpoint_connect(endpoint, \"file:...\")" function were finished reading, but
534 * not necessary were completely processed by the corresponding subscription listeners. Use
535 * dxfc_dxendpoint_and_await_termination() after this function returns to make sure that all processing has completed.
536 *
537 * <p><b>This function is blocking.</b>
538 *
539 * @param endpoint The dxFeed endpoint
540 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
541 */
543
544/**
545 * Returns the state of this endpoint.
546 *
547 * @param endpoint The dxFeed endpoint
548 * @param[out] state The state of this endpoint
549 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
550 */
552 DXFC_OUT dxfc_dxendpoint_state_t *state);
553
554/**
555 * Adds listener that is notified about changes in @ref dxfc_dxendpoint_get_state() "state" property.
556 *
557 * <p>Installed listener can be removed by dxfc_dxendpoint_remove_state_change_listener() function.
558 *
559 * @param endpoint The dxFeed endpoint
560 * @param listener The listener to add
561 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
562 */
563DXFCPP_EXPORT dxfc_error_code_t
565
566/**
567 * Removes listener that is notified about changes in @ref dxfc_dxendpoint_get_state() "state" property.
568 * It removes the listener that was previously installed with dxfc_dxendpoint_add_state_change_listener() function.
569 *
570 * @param endpoint The dxFeed endpoint
571 * @param listener The listener to remove
572 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
573 */
576
577/**
578 *
579 * @param endpoint The dxFeed endpoint
580 * @param[out] feed
581 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
582 */
584
585/**
586 *
587 * @param endpoint The dxFeed endpoint
588 * @param[out] publisher
589 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
590 */
592 DXFC_OUT dxfc_dxpublisher_t *publisher);
593
594/**
595 * Removes the dxFeed endpoint from the registry.
596 * @param endpoint The dxFeed endpoint to remove
597 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
598 */
599DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint);
600
601#ifdef __cplusplus
602}
603#endif
604
605#endif // DXFEED_NATIVE_API_H_INCLUDED
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:22
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:70
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:67
#define DXFCXX_DISABLE_GCC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:38
#define DXFCXX_DISABLE_GCC_WARNINGS_POP()
Definition Conf.hpp:40
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:21
#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_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:700
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:943
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1133
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:727
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Adds listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1079
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:994
#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:892
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:1045
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 connection is not act...
Definition api.h:159
@ DXFC_DXENDPOINT_STATE_CONNECTED
The connection to 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:785
#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:1062
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:683
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:773
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:960
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 listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1105
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builder, const char *name)
Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in ...
Definition DXEndpoint.cpp:667
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:68
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:744
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1128
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:1028
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:875
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:634
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:977
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:909
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:926
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 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 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:830
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:807
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:650
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:852
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1138
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:1011
Base abstract class for all dxFeed C++ API entities.
Definition Entity.hpp:13
virtual ~Entity() noexcept=default
The default virtual d-tor.
Event type parametrized by a symbol.
Definition EventType.hpp:116
virtual const std::optional< Symbol > & getEventSymbolOpt() const &noexcept=0
Returns event symbol that identifies this event type in subscription.
virtual void setEventSymbol(const Symbol &eventSymbol) noexcept=0
Changes event symbol that identifies this event type in subscription.
virtual const Symbol & getEventSymbol() const &noexcept=0
Returns event symbol that identifies this event type in subscription.
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:31
std::string toString() const override
Returns a string representation of the current object.
Definition EventType.hpp:89
virtual std::int64_t getEventTime() const noexcept
Returns time when event was created or zero when time is not available.
Definition EventType.hpp:54
virtual void assign(std::shared_ptr< EventType > event)
Replaces the contents of the event.
Definition EventType.hpp:84
virtual void * toGraal() const =0
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
virtual void setEventTime(std::int64_t) noexcept
Changes event creation time.
Definition EventType.hpp:66
A helper class needed to construct smart pointers to objects, and does not allow explicit constructio...
Definition SharedEntity.hpp:89
static auto createShared(Args &&...args)
Creates smart pointer to object.
Definition SharedEntity.hpp:103
Base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:21
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.
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.
Definition SharedEntity.hpp:56
bool is() const noexcept
Checks that pointer to the current type could be converted to type T* In other words: whether type T ...
Definition SharedEntity.hpp:35
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition Common.hpp:911
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:794
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