VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::GetterImpl Class Referenceabstract

Transport-agnostic base for getter (field reader) node implementations. More...

#include <getter_impl.h>

Inheritance diagram for vlink::GetterImpl:
Collaboration diagram for vlink::GetterImpl:

Public Member Functions

 ~GetterImpl () override
 Destructor.
virtual bool listen (MsgCallback &&callback)=0
 Registers the value-change callback for field updates.
virtual void set_latency_and_lost_enabled (bool enable)
 Enables or disables per-update 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 field update latency in microseconds.
virtual SampleLostInfo get_lost () const
 Returns cumulative sample delivery statistics for field updates.

Public Attributes

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

Protected Member Functions

 GetterImpl ()
 Protected constructor; initialises the getter with kGetter role.

Additional Inherited Members

Detailed Description

Transport-agnostic base for getter (field reader) node implementations.

Provides default (no-op) implementations for the optional latency/loss tracking interface. Concrete transport backends override listen(MsgCallback&&) to register their value-change callback.

Constructor & Destructor Documentation

◆ ~GetterImpl()

vlink::GetterImpl::~GetterImpl ( )
override

Destructor.

◆ GetterImpl()

vlink::GetterImpl::GetterImpl ( )
protected

Protected constructor; initialises the getter with kGetter role.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ get_latency()

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

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

Only meaningful when is_latency_and_lost_enabled() returns true. The default implementation returns 0.

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

◆ get_lost()

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

Returns cumulative sample delivery statistics for field updates.

Returns the total number of expected updates and the number that were lost. Only meaningful when is_latency_and_lost_enabled() returns true. The default implementation returns a zero-initialised SampleLostInfo.

Returns
SampleLostInfo containing total and lost counts.

◆ is_latency_and_lost_enabled()

virtual bool vlink::GetterImpl::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.

Returns
true if tracking is active; false otherwise.

◆ listen()

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

Registers the value-change callback for field updates.

Must be implemented by each concrete transport backend. The callback is invoked with a Bytes buffer containing the serialised latest value each time the corresponding Setter writes a new value. After registration is_listened is set to true by the Getter<T> layer.

Parameters
callbackCallable void(const Bytes&) invoked on each value update.
Returns
true if registration succeeded; false on error.

◆ set_latency_and_lost_enabled()

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

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

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

Parameters
enabletrue to enable tracking; false to disable.

Member Data Documentation

◆ is_listened

bool vlink::GetterImpl::is_listened {false}

true after listen() has been successfully called.


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