dxFeed Graal Native SDK 3.12.0
Loading...
Searching...
No Matches
OnDemand (v4)

The v4 functions and type names of the group OnDemand. Every function returns DXFG_EXECUTE_SUCCESSFULLY or DXFG_EXECUTE_FAIL and writes its result to a DXFG_OUT parameter, see The v4 functions. More...

Typedefs

typedef dxfg_java_object_handler dxfg_v4_java_object_handler
 The handle of a Java object: the reference by which the C code refers to an object that lives in Java.
typedef dxfg_on_demand_service_t dxfg_v4_on_demand_service_t
 A handle of a Java OnDemandService object; release it with dxfg_JavaObjectHandler_release().

Functions

int32_t dxfg_v4_OnDemandService_getInstance (graal_isolatethread_t *thread, DXFG_OUT dxfg_v4_on_demand_service_t **onDemandService)
 Returns the on-demand service of the default endpoint with the DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED role.
int32_t dxfg_v4_OnDemandService_getInstanceByEndpoint (graal_isolatethread_t *thread, dxfg_v4_endpoint_t *endpoint, DXFG_OUT dxfg_v4_on_demand_service_t **onDemandService)
 Returns the on-demand service of the specified endpoint.
int32_t dxfg_v4_OnDemandService_getEndpoint (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT dxfg_v4_endpoint_t **endpoint)
 Returns the endpoint that is associated with the service.
int32_t dxfg_v4_OnDemandService_isReplaySupported (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT int32_t *replaySupported)
 Tells whether the on-demand historical data replay mode is supported.
int32_t dxfg_v4_OnDemandService_isReplay (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT int32_t *replay)
 Tells whether the service is in the replay mode.
int32_t dxfg_v4_OnDemandService_isClear (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT int32_t *clear)
 Tells whether the service is in the clear mode.
int32_t dxfg_v4_OnDemandService_getTime (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT int64_t *time)
 Returns the current or the last replay time.
int32_t dxfg_v4_OnDemandService_getSpeed (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, DXFG_OUT double *speed)
 Returns the replay speed.
int32_t dxfg_v4_OnDemandService_replay (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, int64_t time)
 Turns the replay mode on from the specified time with the real-time speed (1).
int32_t dxfg_v4_OnDemandService_replayWithSpeed (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, int64_t time, double speed)
 Turns the replay mode on from the specified time with the specified speed.
int32_t dxfg_v4_OnDemandService_pause (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service)
 Pauses the replay and keeps the data snapshot.
int32_t dxfg_v4_OnDemandService_stopAndResume (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service)
 Stops the replay and resumes the ordinary data feed.
int32_t dxfg_v4_OnDemandService_stopAndClear (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service)
 Stops the incoming data and clears it without resuming the data updates.
int32_t dxfg_v4_OnDemandService_setSpeed (graal_isolatethread_t *thread, dxfg_v4_on_demand_service_t *service, double speed)
 Changes the replay speed and continues the replay at the current time.

Detailed Description

The v4 functions and type names of the group OnDemand. Every function returns DXFG_EXECUTE_SUCCESSFULLY or DXFG_EXECUTE_FAIL and writes its result to a DXFG_OUT parameter, see The v4 functions.

Typedef Documentation

◆ dxfg_v4_java_object_handler

The handle of a Java object: the reference by which the C code refers to an object that lives in Java.

The handle is allocated by the SDK and owned by the caller: release it with dxfg_JavaObjectHandler_release(), which frees the structure and drops the reference to the Java object. As long as any handle of an object exists, the object is not garbage collected. Use dxfg_JavaObjectHandler_clone() to get another handle of the same object.

The typed handle structures (e.g. dxfg_executor_t, dxfg_time_zone_t) consist of this structure only (the field handler), so a pointer to a typed handle is passed to the functions that take a dxfg_java_object_handler * as &typed->handler (or by a cast).

Use dxfg_Object_toString() to get the string representation of the object, dxfg_Object_equals() to compare objects and dxfg_Object_hashCode() to get the hash code.

◆ dxfg_v4_on_demand_service_t

A handle of a Java OnDemandService object; release it with dxfg_JavaObjectHandler_release().

One service is associated with each endpoint that has the role DXFG_ENDPOINT_ROLE_FEED or DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED: get it with dxfg_OnDemandService_getInstance() or dxfg_OnDemandService_getInstance2(). Releasing the handle does not stop the replay and does not close the endpoint.

Javadoc

Function Documentation

◆ dxfg_v4_OnDemandService_getEndpoint()

int32_t dxfg_v4_OnDemandService_getEndpoint ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT dxfg_v4_endpoint_t ** endpoint )

Returns the endpoint that is associated with the service.

Java: OnDemandService.getEndpoint().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]endpointThe pointer to the variable that receives the endpoint (release the handle with dxfg_v4_JavaObjectHandler_release(); this does not close the endpoint); must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_getInstance()

int32_t dxfg_v4_OnDemandService_getInstance ( graal_isolatethread_t * thread,
DXFG_OUT dxfg_v4_on_demand_service_t ** onDemandService )

Returns the on-demand service of the default endpoint with the DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED role.

The endpoint is the application-wide default endpoint of that role (dxfg_v4_OnDemandService_getEndpoint() returns it; dxfg_v4_DXEndpoint_getInstanceWithRole() creates a new endpoint instead), which is not connected to any other real-time or delayed data feed. It is created on the first call, is configured by the system properties and is closed by dxfg_v4_system_close_all_and_await_termination(). To switch another feed to the replay and back, use dxfg_v4_OnDemandService_getInstanceByEndpoint() with the endpoint of that feed.

The call fails if the on-demand implementation is not available in the library.

Java: OnDemandService.getInstance().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[out]onDemandServiceThe pointer to the variable that receives the service (release the handle with dxfg_v4_JavaObjectHandler_release()); must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_getInstanceByEndpoint()

int32_t dxfg_v4_OnDemandService_getInstanceByEndpoint ( graal_isolatethread_t * thread,
dxfg_v4_endpoint_t * endpoint,
DXFG_OUT dxfg_v4_on_demand_service_t ** onDemandService )

Returns the on-demand service of the specified endpoint.

Each endpoint is associated with one service, so the calls for the same endpoint return handles of the same service. The endpoint must have the role DXFG_ENDPOINT_ROLE_FEED or DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED, otherwise the call fails. It also fails if the on-demand implementation is not available in the library.

Java: OnDemandService.getInstance(DXEndpoint).

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]endpointThe endpoint; the caller keeps its ownership.
[out]onDemandServiceThe pointer to the variable that receives the service (release the handle with dxfg_v4_JavaObjectHandler_release()); must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_getSpeed()

int32_t dxfg_v4_OnDemandService_getSpeed ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT double * speed )

Returns the replay speed.

The speed is measured with respect to the real-time playback speed: 1 is the real-time speed. It is 0 while the service is not in the replay mode.

Java: OnDemandService.getSpeed().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]speedThe pointer to the variable that receives the replay speed; must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_getTime()

int32_t dxfg_v4_OnDemandService_getTime ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT int64_t * time )

Returns the current or the last replay time.

In the replay mode it is the time that is being replayed, otherwise the last time that was replayed. If the replay was never started, it is 0 (the Unix epoch).

Java: OnDemandService.getTime(), the result of Date.getTime().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]timeThe pointer to the variable that receives the time in milliseconds since the Unix epoch (UTC); must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_isClear()

int32_t dxfg_v4_OnDemandService_isClear ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT int32_t * clear )

Tells whether the service is in the clear mode.

The clear mode is in effect after dxfg_v4_OnDemandService_stopAndClear() and before dxfg_v4_OnDemandService_stopAndResume(), dxfg_v4_OnDemandService_replay() or dxfg_v4_OnDemandService_replayWithSpeed().

Java: OnDemandService.isClear().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]clearThe pointer to the variable that receives 1 if the service is in the clear mode, 0 if not; must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_isReplay()

int32_t dxfg_v4_OnDemandService_isReplay ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT int32_t * replay )

Tells whether the service is in the replay mode.

The replay mode is in effect after dxfg_v4_OnDemandService_replay() or dxfg_v4_OnDemandService_replayWithSpeed() and before dxfg_v4_OnDemandService_stopAndResume() or dxfg_v4_OnDemandService_stopAndClear().

Java: OnDemandService.isReplay().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]replayThe pointer to the variable that receives 1 if the service is in the replay mode, 0 if not; must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_isReplaySupported()

int32_t dxfg_v4_OnDemandService_isReplaySupported ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
DXFG_OUT int32_t * replaySupported )

Tells whether the on-demand historical data replay mode is supported.

It is supported when the endpoint is connected to an address with the "(ondemand:<address>)" component that specifies an on-demand historical data provider. While it is not supported, the replay functions fail.

Java: OnDemandService.isReplaySupported().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[out]replaySupportedThe pointer to the variable that receives 1 if the replay mode is supported, 0 if not; must not be NULL.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_pause()

int32_t dxfg_v4_OnDemandService_pause ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service )

Pauses the replay and keeps the data snapshot.

It is the same as dxfg_v4_OnDemandService_setSpeed() with the speed 0: the current replay time is captured and the replay stops at it. Outside the replay mode the call has no effect (and succeeds).

Java: OnDemandService.pause().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_replay()

int32_t dxfg_v4_OnDemandService_replay ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
int64_t time )

Turns the replay mode on from the specified time with the real-time speed (1).

The call is the same as dxfg_v4_OnDemandService_replayWithSpeed() with the speed 1. It fails if the replay mode is not supported (see dxfg_v4_OnDemandService_isReplaySupported()).

Java: OnDemandService.replay(Date).

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[in]timeThe time to start the replay from, in milliseconds since the Unix epoch (UTC).
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_replayWithSpeed()

int32_t dxfg_v4_OnDemandService_replayWithSpeed ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
int64_t time,
double speed )

Turns the replay mode on from the specified time with the specified speed.

The feed is disconnected from the other data providers, pre-buffers the historical tick data and replays it as if it came from the data feeds now. After the call dxfg_v4_OnDemandService_isReplay() returns 1, dxfg_v4_OnDemandService_isClear() returns 0, dxfg_v4_OnDemandService_getTime() returns the time that is being replayed and dxfg_v4_OnDemandService_getSpeed() returns speed. The call fails if the replay mode is not supported (see dxfg_v4_OnDemandService_isReplaySupported()) or if the speed is negative.

Java: OnDemandService.replay(Date, double).

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[in]timeThe time to start the replay from, in milliseconds since the Unix epoch (UTC).
[in]speedThe speed to start the replay with: 1 is the real-time speed, more than 1 is faster, less than 1 is slower and 0 is a pause.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_setSpeed()

int32_t dxfg_v4_OnDemandService_setSpeed ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service,
double speed )

Changes the replay speed and continues the replay at the current time.

The speed is measured with respect to the real-time playback speed. The call fails if the speed is negative, or if the service is not in the replay mode and the speed is not 0.

Java: OnDemandService.setSpeed(double).

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
[in]speedThe new replay speed: 1 is the real-time speed, more than 1 is faster, less than 1 is slower and 0 is a pause.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_stopAndClear()

int32_t dxfg_v4_OnDemandService_stopAndClear ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service )

Stops the incoming data and clears it without resuming the data updates.

The call works both in the replay mode and for the ordinary data feed: all the incoming data updates are suspended and the current data is cleared. After the call dxfg_v4_OnDemandService_isReplay() returns 0, dxfg_v4_OnDemandService_isClear() returns 1, dxfg_v4_OnDemandService_getTime() returns the last replayed time and dxfg_v4_OnDemandService_getSpeed() returns 0. The ordinary feed is resumed by dxfg_v4_OnDemandService_stopAndResume(), the replay is continued by dxfg_v4_OnDemandService_replay() or dxfg_v4_OnDemandService_replayWithSpeed().

Java: OnDemandService.stopAndClear().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.

◆ dxfg_v4_OnDemandService_stopAndResume()

int32_t dxfg_v4_OnDemandService_stopAndResume ( graal_isolatethread_t * thread,
dxfg_v4_on_demand_service_t * service )

Stops the replay and resumes the ordinary data feed.

The call has no effect if the service is neither in the replay mode nor in the clear mode. After the call dxfg_v4_OnDemandService_isReplay() and dxfg_v4_OnDemandService_isClear() return 0, dxfg_v4_OnDemandService_getTime() returns the last replayed time and dxfg_v4_OnDemandService_getSpeed() returns 0. An endpoint with the role DXFG_ENDPOINT_ROLE_ON_DEMAND_FEED has no ordinary feed, so for it the call works like dxfg_v4_OnDemandService_stopAndClear().

Java: OnDemandService.stopAndResume().

Parameters
[in]threadThe current GraalVM Isolate's thread.
[in]serviceThe service.
Returns
DXFG_EXECUTE_SUCCESSFULLY (0) on successful function execution or DXFG_EXECUTE_FAIL (-1) on error. Use dxfg_v4_get_and_clear_thread_exception() to determine if an exception was thrown.