VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::SubscriberImpl类 参考abstract

Transport-agnostic base for subscriber node implementations. 更多...

#include <subscriber_impl.h>

类 vlink::SubscriberImpl 继承关系图:
vlink::SubscriberImpl 的协作图:

Public 成员函数

 ~SubscriberImpl () override
 Destructor.
virtual bool listen (MsgCallback &&callback)=0
 Registers the serialised-message receive callback.
virtual bool listen (IntraMsgCallback &&callback)
 Registers the zero-copy in-process receive callback.
virtual void set_latency_and_lost_enabled (bool enable)
 Enables or disables per-message latency and sample-loss tracking.
virtual bool is_latency_and_lost_enabled () const
 Returns whether latency and sample-loss tracking is currently enabled.
virtual int64_t get_latency () const
 Returns the most recently measured end-to-end message latency in microseconds.
virtual SampleLostInfo get_lost () const
 Returns cumulative sample delivery statistics.

Public 属性

bool is_listened {false}
 true after listen() has been successfully called.

Protected 成员函数

 SubscriberImpl ()
 Protected constructor; initialises the subscriber with kSubscriber role.

额外继承的成员函数

详细描述

Transport-agnostic base for subscriber node implementations.

Provides default (no-op) implementations for the optional latency/loss tracking interface. Concrete transport backends override listen(MsgCallback&&) to register their receive callback and, optionally, override the latency/loss methods if the transport provides that information.

构造及析构函数说明

◆ ~SubscriberImpl()

vlink::SubscriberImpl::~SubscriberImpl ( )
override

Destructor.

◆ SubscriberImpl()

vlink::SubscriberImpl::SubscriberImpl ( )
protected

Protected constructor; initialises the subscriber with kSubscriber role.

函数调用图:
这是这个函数的调用关系图:

成员函数说明

◆ get_latency()

virtual int64_t vlink::SubscriberImpl::get_latency ( ) const
nodiscardvirtual

Returns the most recently measured end-to-end message latency in microseconds.

Only meaningful when is_latency_and_lost_enabled() returns true. The default implementation returns 0. Transports that support latency measurement override this to return the measured value.

返回
Latency in microseconds, or 0 if tracking is disabled or unsupported.

◆ get_lost()

virtual SampleLostInfo vlink::SubscriberImpl::get_lost ( ) const
nodiscardvirtual

Returns cumulative sample delivery statistics.

Returns the total number of expected samples and the number that were lost due to queue overflow or network gaps. Only meaningful when is_latency_and_lost_enabled() returns true. The default implementation returns a zero-initialised SampleLostInfo.

返回
SampleLostInfo containing total and lost counts.

◆ is_latency_and_lost_enabled()

virtual bool vlink::SubscriberImpl::is_latency_and_lost_enabled ( ) const
nodiscardvirtual

Returns whether latency and sample-loss tracking is currently enabled.

The default implementation always returns false. Transports that support tracking override this to reflect the current enabled state.

返回
true if tracking is active; false otherwise.

◆ listen() [1/2]

virtual bool vlink::SubscriberImpl::listen ( IntraMsgCallback && callback)
virtual

Registers the zero-copy in-process receive callback.

Used exclusively on the intra:// transport to receive IntraData directly from a co-located publisher without serialisation. The default implementation logs a warning and returns false; only IntraSubscriberImpl overrides this.

参数
callbackCallable void(const IntraData&) invoked on every received in-process message.
返回
true if registration succeeded; false if this transport does not support IntraData.

◆ listen() [2/2]

virtual bool vlink::SubscriberImpl::listen ( MsgCallback && callback)
pure virtual

Registers the serialised-message receive callback.

Must be implemented by each concrete transport backend. The callback is invoked with a Bytes buffer containing the raw serialised message each time a new message arrives. After registration is_listened is set to true by the Subscriber<T> layer.

参数
callbackCallable void(const Bytes&) invoked on every received message.
返回
true if registration succeeded; false on error.

◆ set_latency_and_lost_enabled()

virtual void vlink::SubscriberImpl::set_latency_and_lost_enabled ( bool enable)
virtual

Enables or disables per-message latency and sample-loss tracking.

When enabled, the transport backend tracks message timestamps (for latency) and sequence numbers (for loss detection). The default implementation is a no-op; transports that support tracking override this method.

参数
enabletrue to enable tracking; false to disable.

类成员变量说明

◆ is_listened

bool vlink::SubscriberImpl::is_listened {false}

true after listen() has been successfully called.


该类的文档由以下文件生成: