|
dxFeed Graal CXX API v7.0.0
|
An incremental model for time-series events. More...
#include <TimeSeriesTxModel.hpp>
Inheritance diagram for TimeSeriesTxModel< E >:Classes | |
| struct | Builder |
| A builder class for creating an instance of TimeSeriesTxModel. More... | |
Public Member Functions | |
| ~TimeSeriesTxModel () noexcept override | |
| Calls close method and destructs this model. | |
| bool | isBatchProcessing () const |
| Returns whether batch processing is enabled. | |
| bool | isSnapshotProcessing () const |
| Returns whether snapshot processing is enabled. | |
| void | attach (const std::shared_ptr< DXFeed > &feed) const |
| Attaches this model to the specified feed. | |
| void | detach (const std::shared_ptr< DXFeed > &feed) const |
| Detaches this model from the specified feed. | |
| void | close () const |
| Closes this model and makes it permanently detached. | |
| std::int64_t | getFromTime () const |
Returns the time from which to subscribe for time-series, or std::numeric_limits<std::int64_t>::max() if this model is not subscribed (this is a default value). | |
| void | setFromTime (std::int64_t fromTime) const |
| Sets the time from which to subscribe for time-series. | |
| void | setFromTime (std::chrono::milliseconds fromTime) const |
| Sets the time from which to subscribe for time-series. | |
| std::string | toString () const override |
| Returns a string representation of the current object. | |
Public Member Functions inherited from SharedEntity | |
| template<typename T> | |
| bool | is () const noexcept |
| Checks that the pointer to the current type could be converted to type T* In other words: whether type T belongs to the type hierarchy in which the current type resides. | |
| template<typename T> | |
| std::shared_ptr< T > | sharedAs () noexcept |
| Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr. | |
| template<typename T> | |
| std::shared_ptr< T > | sharedAs () const noexcept |
| Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr. | |
Public Member Functions inherited from Entity | |
| virtual | ~Entity () noexcept |
| The default virtual d-tor. | |
Static Public Member Functions | |
| static std::shared_ptr< Builder > | newBuilder () |
| Factory method to create a new builder for this model. | |
Static Public Member Functions inherited from RequireMakeShared< TimeSeriesTxModel< E > > | |
| static auto | createShared (Args &&...args) |
| Creates a smart pointer to an object. | |
Additional Inherited Members | |
Public Types inherited from SharedEntity | |
| using | Ptr = std::shared_ptr<SharedEntity> |
| The alias to a type of shared pointer to the SharedEntity object. | |
An incremental model for time-series events.
This model manages all snapshot and transaction logic, subscription handling, and listener notifications.
This model is designed to handle incremental transactions. Users of this model only see the list of events in a consistent state. This model delays incoming events that are part of an incomplete snapshot or ongoing transaction until the snapshot is complete or the transaction has ended. This model notifies the user of received transactions through an installed listener.
This model must be configured using the builder, as most configuration settings cannot be changed once the model is built. This model requires configuration with a symbol and a fromTime for subscription, and it must be attached to a DXFeed instance to begin operation. For ease of use, some of these configurations can be changed after the model is built, see setFromTime, attach.
This model only supports single symbol subscriptions; multiple symbols cannot be configured.
Attached model is a potential memory leak. If the pointer to attached model is lost, then there is no way to detach this model from the feed.
The convenient way to detach model from the feed is to call its close method (it is automatically called when the destructor is called, i.e. RAII). Closed model becomes permanently detached from all feeds, removes all its listeners.
This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
Sample:
| E | The type of event (derived from TimeSeriesEvent) |
|
inline |
Attaches this model to the specified feed.
Technically, this model can be attached to multiple feeds at once, but this is rarely needed and not recommended.
| feed | The feed to attach to. |
|
inline |
Closes this model and makes it permanently detached.
This method clears installed listener.
Referenced by ~TimeSeriesTxModel().
|
inline |
Detaches this model from the specified feed.
| feed | The feed to detach from. |
|
inline |
Returns the time from which to subscribe for time-series, or std::numeric_limits<std::int64_t>::max() if this model is not subscribed (this is a default value).
|
inline |
Returns whether batch processing is enabled.
See withBatchProcessing.
true if batch processing is enabled; false otherwise.
|
inline |
Returns whether snapshot processing is enabled.
true if snapshot processing is enabled; false otherwise.
|
inlinestatic |
Factory method to create a new builder for this model.
|
inline |
Sets the time from which to subscribe for time-series.
If this time has already been set, nothing happens.
| fromTime | The duration in milliseconds, since Unix epoch of January 1, 1970. |
References setFromTime().
Referenced by setFromTime().
|
inline |
Sets the time from which to subscribe for time-series.
If this time has already been set, nothing happens.
| fromTime | The time in milliseconds, since Unix epoch of January 1, 1970. |
|
inlineoverridevirtual |
Returns a string representation of the current object.
Reimplemented from SharedEntity.