dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
IndexedTxModelListener< E > Struct Template Referencefinal

The listener for receiving indexed events with the specified type from the IndexedTxModel. More...

#include <TxModelListener.hpp>

+ Inheritance diagram for IndexedTxModelListener< E >:

Public Member Functions

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 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.
 
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.
 
- Public Member Functions inherited from Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Static Public Member Functions

static std::shared_ptr< IndexedTxModelListener< E > > create (std::function< void(const IndexedEventSource &, const std::vector< std::shared_ptr< E > > &, bool)> onEventsReceived)
 Creates a listener for receiving indexed events (with instantiation by event type E and verification)
 
- Static Public Member Functions inherited from RequireMakeShared< IndexedTxModelListener< E > >
static auto createShared (Args &&...args)
 Creates smart pointer to 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

template<Derived< IndexedEvent > E>
struct IndexedTxModelListener< E >

The listener for receiving indexed events with the specified type from the IndexedTxModel.

Member Function Documentation

◆ create()

template<Derived< IndexedEvent > E>
static std::shared_ptr< IndexedTxModelListener< E > > IndexedTxModelListener< E >::create ( std::function< void(const IndexedEventSource &, const std::vector< std::shared_ptr< E > > &, bool)> onEventsReceived)
inlinestatic

Creates a listener for receiving indexed events (with instantiation by event type E and verification)

auto listener = IndexedTxModelListener<Order>::create([](const auto & orderSource, const auto &events, bool
isSnapshot) { if (isSnapshot) { std::cout << "Snapshot:" << std::endl; } else { std::cout << "Update:" <<
std::endl;
}
for (const auto &e : events) {
std::cout << "[" << e->getEventFlagsMask().toString() << "]:" << e << std::endl;
}
std::cout << std::endl;
});
builder->withListener(listener);
static std::shared_ptr< IndexedTxModelListener< E > > create(std::function< void(const IndexedEventSource &, const std::vector< std::shared_ptr< E > > &, bool)> onEventsReceived)
Creates a listener for receiving indexed events (with instantiation by event type E and verification)
Definition TxModelListener.hpp:100
Template Parameters
EThe event type.
Parameters
onEventsReceivedA functional object, lambda, or function to which indexed event data will be passed.
Returns
A smart pointer to the listener.

References IndexedTxModelListener< E >::create().

Referenced by IndexedTxModelListener< E >::create(), and IndexedTxModelListener< E >::toString().

◆ toString()

template<Derived< IndexedEvent > E>
std::string IndexedTxModelListener< E >::toString ( ) const
inlineoverridevirtual

Returns a string representation of the current object.

Returns
a string representation

Reimplemented from SharedEntity.

References IndexedTxModelListener< E >::create().