VLink  2.0.0
A high-performance communication middleware
vlink::SubscriberImpl类 参考abstract

Event-model receive base shared by every transport-specific subscriber. 更多...

#include <subscriber_impl.h>

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

Public 成员函数

 ~SubscriberImpl () override
 Releases backend resources. 更多...
 
virtual bool listen (MsgCallback &&callback)=0
 Installs the serialised-message receive callback. 更多...
 
virtual bool listen (IntraMsgCallback &&callback)
 Installs the zero-copy in-process receive callback. 更多...
 
virtual void set_latency_and_lost_enabled (bool enable)
 Enables or disables per-message latency / loss tracking. 更多...
 
virtual bool is_latency_and_lost_enabled () const
 Reports whether tracking is currently enabled. 更多...
 
virtual int64_t get_latency () const
 Returns the most recently measured end-to-end latency in nanoseconds. 更多...
 
virtual SampleLostInfo get_lost () const
 Returns cumulative delivered / lost counters. 更多...
 

Public 属性

bool is_listened {false}
 true once listen() has been registered successfully. 更多...
 

Protected 成员函数

 SubscriberImpl ()
 Stamps the node as kSubscriber. 更多...
 

额外继承的成员函数

详细描述

Event-model receive base shared by every transport-specific subscriber.

Provides safe defaults for the optional latency / loss instrumentation so backends without those signals can be plugged in without empty overrides. Concrete backends override listen() to bind the supplied callback to the transport receive path.

构造及析构函数说明

◆ ~SubscriberImpl()

vlink::SubscriberImpl::~SubscriberImpl ( )
override

Releases backend resources.

◆ SubscriberImpl()

vlink::SubscriberImpl::SubscriberImpl ( )
protected

Stamps the node as kSubscriber.

成员函数说明

◆ get_latency()

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

Returns the most recently measured end-to-end latency in nanoseconds.

Only meaningful when is_latency_and_lost_enabled() returns true.

返回
Latency in nanoseconds; 0 when tracking is off or unsupported.

◆ get_lost()

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

Returns cumulative delivered / lost counters.

Only meaningful when tracking is enabled. Default returns a zero-initialised SampleLostInfo.

返回
SampleLostInfo with total and lost counts.

◆ is_latency_and_lost_enabled()

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

Reports whether tracking is currently enabled.

返回
true when the backend is collecting latency / loss data.

◆ listen() [1/2]

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

Installs the zero-copy in-process receive callback.

Only the intra:// backend overrides this overload; the default logs a warning and returns false.

参数
callbackCallable void(const IntraData&) invoked for each in-process delivery.
返回
true when registration succeeded; false when the transport does not support IntraData.

◆ listen() [2/2]

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

Installs the serialised-message receive callback.

Pure virtual. Backends invoke callback with the raw payload bytes for each frame received. The public Subscriber sets is_listened to true on success.

参数
callbackCallable void(const Bytes&) invoked on every received frame.
返回
true when 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 / loss tracking.

Default no-op. Backends that maintain timestamps and sequence numbers override the method.

参数
enabletrue to enable; false to disable.

类成员变量说明

◆ is_listened

bool vlink::SubscriberImpl::is_listened {false}

true once listen() has been registered successfully.


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