dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
InstrumentProfileCollector Class Referencefinal

Collects instrument profile updates and provides the live list of instrument profiles. More...

#include <InstrumentProfileCollector.hpp>

+ Inheritance diagram for InstrumentProfileCollector:

Public Types

using Ptr = std::shared_ptr<InstrumentProfileCollector>
 The alias to a type of shared pointer to the InstrumentProfileCollector object.
 
using Unique = std::unique_ptr<InstrumentProfileCollector>
 The alias to a type of unique pointer to the InstrumentProfileCollector object.
 
- Public Types inherited from SharedEntity
using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.
 

Public Member Functions

std::int64_t getLastUpdateTime () const
 Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
 
std::chrono::milliseconds getLastUpdateTimeAsDuration () const
 Returns last modification time (as std::chrono::milliseconds) of instrument profiles or zero if it is unknown.
 
void updateInstrumentProfile (std::shared_ptr< InstrumentProfile > ip) const
 Convenience method to update one instrument profile in this collector.
 
std::shared_ptr< IterableInstrumentProfileview () const
 Returns a concurrent view of the set of instrument profiles.
 
- 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.
 
virtual std::string toString () const
 Returns a string representation of the current object.
 
- Public Member Functions inherited from Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Static Public Member Functions

static Ptr create ()
 Creates the new InstrumentProfileCollector.
 

Detailed Description

Collects instrument profile updates and provides the live list of instrument profiles.

This class contains a map that keeps a unique instrument profile per symbol. This class is intended to be used with InstrumentProfileConnection as a repository that keeps profiles of all known instruments. See InstrumentProfileConnection for a usage example.

As set of instrument profiles stored in this collector can be accessed with view method. A snapshot plus a live stream of updates can be accessed with addUpdateListener method.

Removal of instrument profile is represented by an InstrumentProfile instance with a type equal to InstrumentProfileType::REMOVED.getName().

This class is thread-safe.

Member Function Documentation

◆ create()

InstrumentProfileCollector::Ptr InstrumentProfileCollector::create ( )
static

Creates the new InstrumentProfileCollector.

Returns
The new InstrumentProfileCollector

◆ getLastUpdateTime()

std::int64_t InstrumentProfileCollector::getLastUpdateTime ( ) const

Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.

Note, that while the time is represented in milliseconds, the actual granularity of time here is a second.

Returns
The last modification time (in milliseconds) of instrument profiles or zero if it is unknown.

◆ getLastUpdateTimeAsDuration()

std::chrono::milliseconds InstrumentProfileCollector::getLastUpdateTimeAsDuration ( ) const
inline

Returns last modification time (as std::chrono::milliseconds) of instrument profiles or zero if it is unknown.

Note, that while the time is represented in milliseconds, the actual granularity of time here is a second.

Returns
The last modification time (as std::chrono::milliseconds) of instrument profiles or zero if it is unknown.

◆ updateInstrumentProfile()

void InstrumentProfileCollector::updateInstrumentProfile ( std::shared_ptr< InstrumentProfile > ip) const

Convenience method to update one instrument profile in this collector.

This is a shortcut for:


   updateInstrumentProfiles({ip}, nullptr);
Parameters
ipThe instrument profile.

◆ view()

std::shared_ptr< IterableInstrumentProfile > InstrumentProfileCollector::view ( ) const

Returns a concurrent view of the set of instrument profiles.

Note, that removal of instrument profile is represented by an InstrumentProfile instance with a type equal to InstrumentProfileType::REMOVED.getName(). Normally, this view exposes only non-removed profiles. However, if iteration is concurrent with removal, then a removed instrument profile (with a removed type) can be exposed by this view.

Returns
A concurrent view of the set of instrument profiles.