dxFeed Graal CXX API
|
Collects instrument profile updates and provides the live list of instrument profiles. More...
#include <InstrumentProfileCollector.hpp>
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 noexcept |
Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown. | |
std::chrono::milliseconds | getLastUpdateTimeAsDuration () const noexcept |
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. | |
void | updateInstrumentProfile (const InstrumentProfile &ip) const |
Convenience method to update one instrument profile in this collector. | |
std::shared_ptr< IterableInstrumentProfile > | view () const noexcept |
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 noexcept |
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. | |
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.
|
staticnoexcept |
Creates the new InstrumentProfileCollector.
|
noexcept |
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.
|
inlinenoexcept |
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.
void InstrumentProfileCollector::updateInstrumentProfile | ( | const InstrumentProfile & | ip | ) | const |
Convenience method to update one instrument profile in this collector.
This is a shortcut for:
updateInstrumentProfiles({ip}, nullptr);
ip | The instrument profile. |
References InstrumentProfile::freeGraal(), and InstrumentProfile::toGraal().
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);
ip | The instrument profile. |
|
noexcept |
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.