Controls the subscription of an object that owns an underlying DXFeedSubscription (for example, IndexedEventTxModel): attaches it to and detaches it from a feed and changes the settings of the event delivery.
More...
#include <SubscriptionController.hpp>
|
| void | attach (const std::shared_ptr< DXFeed > &feed) const |
| | Attaches the underlying subscription to the given feed.
|
| void | detach (const std::shared_ptr< DXFeed > &feed) const |
| | Detaches the underlying subscription from the given feed.
|
| std::int32_t | getEventsBatchLimit () const |
| | Returns the maximum number of events in a single notification of the listener.
|
| void | setEventsBatchLimit (std::int32_t eventsBatchLimit) const |
| | Sets the maximum number of events in a single notification of the listener.
|
| TimePeriod | getAggregationPeriod () const |
| | Returns the aggregation period of the events: the listener is notified at most once per this period, and the events of the same symbol within the period may be conflated.
|
| void | setAggregationPeriod (const TimePeriod &aggregationPeriod) const |
| | Sets the aggregation period of the events.
|
| void | setAggregationPeriod (std::chrono::milliseconds aggregationPeriod) const |
| | Sets the aggregation period of the events.
|
| void | setAggregationPeriod (std::int64_t aggregationPeriod) const |
| | Sets the aggregation period of the events.
|
| template<typename Executor> |
| void | setExecutor (const std::shared_ptr< Executor > &executor) const |
| | Sets the executor that notifies the listener (for example, InPlaceExecutor).
|
|
void | setExecutor (std::nullptr_t) const |
| | Makes the executor of the endpoint of the feed notify the listener.
|
| template<typename T> |
| bool | is () const noexcept |
| | Checks that the object is of type T: its dynamic type is T or derived from T.
|
| 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.
|
| virtual std::string | toString () const |
| | Returns a string representation of the current object.
|
|
virtual | ~Entity () noexcept |
| | The default virtual d-tor.
|
|
| static auto | createShared (Args &&...args) |
| | Creates a smart pointer to an object.
|
Controls the subscription of an object that owns an underlying DXFeedSubscription (for example, IndexedEventTxModel): attaches it to and detaches it from a feed and changes the settings of the event delivery.
auto controller = model->getSubscriptionController();
controller->setAggregationPeriod(std::chrono::milliseconds(100));
controller->detach(feed);
◆ attach()
| void SubscriptionController::attach |
( |
const std::shared_ptr< DXFeed > & | feed | ) |
const |
Attaches the underlying subscription to the given feed.
- Parameters
-
| feed | The feed to attach to. |
◆ detach()
| void SubscriptionController::detach |
( |
const std::shared_ptr< DXFeed > & | feed | ) |
const |
Detaches the underlying subscription from the given feed.
- Parameters
-
| feed | The feed to detach from. |
◆ getAggregationPeriod()
| TimePeriod SubscriptionController::getAggregationPeriod |
( |
| ) |
const |
Returns the aggregation period of the events: the listener is notified at most once per this period, and the events of the same symbol within the period may be conflated.
- Returns
- the aggregation period; TimePeriod::ZERO when it is not set (then only the aggregation period of the feed applies).
◆ getEventsBatchLimit()
| std::int32_t SubscriptionController::getEventsBatchLimit |
( |
| ) |
const |
◆ setAggregationPeriod() [1/3]
| void SubscriptionController::setAggregationPeriod |
( |
const TimePeriod & | aggregationPeriod | ) |
const |
◆ setAggregationPeriod() [2/3]
| void SubscriptionController::setAggregationPeriod |
( |
std::chrono::milliseconds | aggregationPeriod | ) |
const |
Sets the aggregation period of the events.
- Parameters
-
| aggregationPeriod | The aggregation period. |
- See also
- getAggregationPeriod()
◆ setAggregationPeriod() [3/3]
| void SubscriptionController::setAggregationPeriod |
( |
std::int64_t | aggregationPeriod | ) |
const |
Sets the aggregation period of the events.
- Parameters
-
| aggregationPeriod | The aggregation period in milliseconds. |
- See also
- getAggregationPeriod()
◆ setEventsBatchLimit()
| void SubscriptionController::setEventsBatchLimit |
( |
std::int32_t | eventsBatchLimit | ) |
const |
Sets the maximum number of events in a single notification of the listener.
- Parameters
-
◆ setExecutor()
template<typename Executor>
| void SubscriptionController::setExecutor |
( |
const std::shared_ptr< Executor > & | executor | ) |
const |
|
inline |
Sets the executor that notifies the listener (for example, InPlaceExecutor).
- Template Parameters
-
| Executor | The type of the executor. |
- Parameters
-
| executor | The executor, or nullptr to use the executor of the endpoint of the feed. |