VLink  2.0.0
A high-performance communication middleware
vlink::SubscriberImpl Class Referenceabstract

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

#include <subscriber_impl.h>

Inheritance diagram for vlink::SubscriberImpl:
Collaboration diagram for vlink::SubscriberImpl:

Public Member Functions

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

Public Attributes

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

Protected Member Functions

 SubscriberImpl ()
 Stamps the node as kSubscriber. More...
 

Additional Inherited Members

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~SubscriberImpl()

vlink::SubscriberImpl::~SubscriberImpl ( )
override

Releases backend resources.

◆ SubscriberImpl()

vlink::SubscriberImpl::SubscriberImpl ( )
protected

Stamps the node as kSubscriber.

Member Function Documentation

◆ 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.

Returns
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.

Returns
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.

Returns
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.

Parameters
callbackCallable void(const IntraData&) invoked for each in-process delivery.
Returns
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.

Parameters
callbackCallable void(const Bytes&) invoked on every received frame.
Returns
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.

Parameters
enabletrue to enable; false to disable.

Member Data Documentation

◆ is_listened

bool vlink::SubscriberImpl::is_listened {false}

true once listen() has been registered successfully.


The documentation for this class was generated from the following file: