dxFeed Graal CXX API v8.1.0
Loading...
Searching...
No Matches
ObservableSubscriptionChangeListener Struct Reference

The listener interface for receiving notifications on the changes of observed subscription. More...

#include <ObservableSubscriptionChangeListener.hpp>

+ Inheritance diagram for ObservableSubscriptionChangeListener:

Public Member Functions

 ~ObservableSubscriptionChangeListener () noexcept override
 Destroys this listener and invalidates its native callback registration context.
 
const JavaObjectHandle< ObservableSubscriptionChangeListener > & getHandle (Key) const
 Returns the native listener handle to an owning subscription implementation.
 
void notifySymbolsAdded (Key, const std::unordered_set< SymbolWrapper > &symbols)
 Delivers an added-symbol notification from an owning subscription implementation.
 
void notifySymbolsRemoved (Key, const std::unordered_set< SymbolWrapper > &symbols)
 Delivers a removed-symbol notification from an owning subscription implementation.
 
void notifySubscriptionClosed (Key)
 Delivers a subscription-closed notification from an owning subscription implementation.
 
- 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.
 
virtual std::string toString () const
 Returns a string representation of the current object.
 
- Public Member Functions inherited from Entity
virtual ~Entity () noexcept
 The default virtual d-tor.
 

Static Public Member Functions

static std::shared_ptr< ObservableSubscriptionChangeListener > create (std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsAdded)
 Creates a listener that will notify the callback about added symbols.
 
static std::shared_ptr< ObservableSubscriptionChangeListener > create (std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsAdded, std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsRemoved, std::function< void()> onSubscriptionClosed)
 Creates a listener that will notify callbacks about events of adding and deleting symbols, as well as about the event of closing a subscription.
 
- Static Public Member Functions inherited from RequireMakeShared< ObservableSubscriptionChangeListener >
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.
 

Detailed Description

The listener interface for receiving notifications on the changes of observed subscription.

All methods on this interface are invoked while holding a lock on the ObservableSubscription instance, thus all changes for a given subscription are synchronized with respect to each other.

Constructor & Destructor Documentation

◆ ~ObservableSubscriptionChangeListener()

ObservableSubscriptionChangeListener::~ObservableSubscriptionChangeListener ( )
overridenoexcept

Destroys this listener and invalidates its native callback registration context.

Subscriptions that still have the listener installed keep it alive, so destruction cannot race with a callback that has successfully acquired the listener.

Member Function Documentation

◆ create() [1/2]

std::shared_ptr< ObservableSubscriptionChangeListener > ObservableSubscriptionChangeListener::create ( std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsAdded)
static

Creates a listener that will notify the callback about added symbols.

Parameters
onSymbolsAddedA callback that will handle the event when symbols are added.
Returns
The new listener.

◆ create() [2/2]

std::shared_ptr< ObservableSubscriptionChangeListener > ObservableSubscriptionChangeListener::create ( std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsAdded,
std::function< void(const std::unordered_set< SymbolWrapper > &symbols)> onSymbolsRemoved,
std::function< void()> onSubscriptionClosed )
static

Creates a listener that will notify callbacks about events of adding and deleting symbols, as well as about the event of closing a subscription.

Parameters
onSymbolsAddedA callback that will handle the symbol addition event.
onSymbolsRemovedA callback that will handle the symbol deletion event.
onSubscriptionClosedA callback that will handle the subscription close event.
Returns
The new listener.

◆ getHandle()

const JavaObjectHandle< ObservableSubscriptionChangeListener > & ObservableSubscriptionChangeListener::getHandle ( Key ) const

Returns the native listener handle to an owning subscription implementation.

Returns
The native listener handle.

◆ notifySymbolsAdded()

void ObservableSubscriptionChangeListener::notifySymbolsAdded ( Key ,
const std::unordered_set< SymbolWrapper > & symbols )

Delivers an added-symbol notification from an owning subscription implementation.

Parameters
symbolsThe symbols added to the subscription.

◆ notifySymbolsRemoved()

void ObservableSubscriptionChangeListener::notifySymbolsRemoved ( Key ,
const std::unordered_set< SymbolWrapper > & symbols )

Delivers a removed-symbol notification from an owning subscription implementation.

Parameters
symbolsThe symbols removed from the subscription.