StreamSubscription
StreamSubscription
Inherits from VariantStreamSubscription
Public Functions
| Name | |
|---|---|
| StreamSubscription(DataStream< T > * stream) | |
| ~StreamSubscription() override | |
| std::optional< T > | next() Obtain next element from stream, block in case there is no new element. |
| std::optional< T > | peekNext() Obtain the next stream element if there is any, otherwise return std::nullopt This function behaves the same as next(), but does return immediately without blocking. To see if the stream as ended, check the active() property on this subscription. |
| virtual bool | callIfNextVar(const ProcessVarFn & fn) override Call function on the next element, if there is any. |
| virtual int | dataTypeId() const override |
| virtual QString | dataTypeName() const override |
| virtual QHash< QString, QVariant > | metadata() const override |
| virtual QVariant | metadataValue(const QString & key, const QVariant & defaultValue =QVariant()) const override |
| virtual QVariant | metadataValue(CommonMetadataKey key, const QVariant & defaultValue =QVariant()) const override |
| virtual bool | unsubscribe() override |
| virtual bool | active() const override |
| virtual int | enableNotify() override Enable notifiucations on this stream subscription. |
| virtual void | disableNotify() override Disable notifications via eventFD. |
| virtual void | suspend() override Stop receiving data, but do not unsubscribe from the stream. |
| virtual void | resume() override Resume data transmission, reverses suspend() |
| virtual void | clearPending() override Clear all pending data from the subscription. |
| virtual size_t | approxPendingCount() const override |
| virtual bool | hasPending() const override |
| uint | throttleValue() const |
| uint | retrieveApproxSkippedElements() |
| virtual void | setThrottleItemsPerSec(uint itemsPerSec, bool allowMore =true) override Set a throttle on the output frequency of this subscription By setting a positive integer value, the output of this subscription is effectively limited to the given integer value per second. This will result in some values being thrown away. By setting a throttle value of 0, all output is passed through and no limits apply. Internally, the throttle value is represented as the minimum needed time in microseconds between elements. This effectively means you can not throttle a connection over 1000000 items/sec. |
| virtual void | forcePushNullopt() override |
Additional inherited members
Public Functions inherited from VariantStreamSubscription
| Name | |
|---|---|
| virtual | ~VariantStreamSubscription() |
Detailed Description
template <typename T >
class StreamSubscription;Public Functions Documentation
function StreamSubscription
inline explicit StreamSubscription(
DataStream< T > * stream
)function ~StreamSubscription
inline ~StreamSubscription() overridefunction next
inline std::optional< T > next()Obtain next element from stream, block in case there is no new element.
Return: The obtained value, or std::nullopt in case the stream ended.
function peekNext
inline std::optional< T > peekNext()Obtain the next stream element if there is any, otherwise return std::nullopt This function behaves the same as next(), but does return immediately without blocking. To see if the stream as ended, check the active() property on this subscription.
function callIfNextVar
inline virtual bool callIfNextVar(
const ProcessVarFn & fn
) overrideCall function on the next element, if there is any.
Parameters:
- fn The function to call with the next element.
Return: True if an element was processed, false if there was no element.
Reimplements: VariantStreamSubscription::callIfNextVar
function dataTypeId
inline virtual int dataTypeId() const overrideReimplements: VariantStreamSubscription::dataTypeId
function dataTypeName
inline virtual QString dataTypeName() const overrideReimplements: VariantStreamSubscription::dataTypeName
function metadata
inline virtual QHash< QString, QVariant > metadata() const overrideReimplements: VariantStreamSubscription::metadata
function metadataValue
inline virtual QVariant metadataValue(
const QString & key,
const QVariant & defaultValue =QVariant()
) const overrideReimplements: VariantStreamSubscription::metadataValue
function metadataValue
inline virtual QVariant metadataValue(
CommonMetadataKey key,
const QVariant & defaultValue =QVariant()
) const overrideReimplements: VariantStreamSubscription::metadataValue
function unsubscribe
inline virtual bool unsubscribe() overrideReimplements: VariantStreamSubscription::unsubscribe
function active
inline virtual bool active() const overrideReimplements: VariantStreamSubscription::active
function enableNotify
inline virtual int enableNotify() overrideEnable notifiucations on this stream subscription.
Return: An eventfd file descriptor that is written to when new data is received.
Reimplements: VariantStreamSubscription::enableNotify
function disableNotify
inline virtual void disableNotify() overrideDisable notifications via eventFD.
Reimplements: VariantStreamSubscription::disableNotify
Do not disable notifications unless you know for sure that nothing is listening on this subscription anymore.
function suspend
inline virtual void suspend() overrideStop receiving data, but do not unsubscribe from the stream.
Reimplements: VariantStreamSubscription::suspend
function resume
inline virtual void resume() overrideResume data transmission, reverses suspend()
Reimplements: VariantStreamSubscription::resume
function clearPending
inline virtual void clearPending() overrideClear all pending data from the subscription.
Reimplements: VariantStreamSubscription::clearPending
function approxPendingCount
inline virtual size_t approxPendingCount() const overrideReimplements: VariantStreamSubscription::approxPendingCount
function hasPending
inline virtual bool hasPending() const overrideReimplements: VariantStreamSubscription::hasPending
function throttleValue
inline uint throttleValue() constfunction retrieveApproxSkippedElements
inline uint retrieveApproxSkippedElements()function setThrottleItemsPerSec
inline virtual void setThrottleItemsPerSec(
uint itemsPerSec,
bool allowMore =true
) overrideSet a throttle on the output frequency of this subscription By setting a positive integer value, the output of this subscription is effectively limited to the given integer value per second. This will result in some values being thrown away. By setting a throttle value of 0, all output is passed through and no limits apply. Internally, the throttle value is represented as the minimum needed time in microseconds between elements. This effectively means you can not throttle a connection over 1000000 items/sec.
Reimplements: VariantStreamSubscription::setThrottleItemsPerSec
function forcePushNullopt
inline virtual void forcePushNullopt() overrideReimplements: VariantStreamSubscription::forcePushNullopt
Updated on 2025-08-14 at 02:33:43 +0000