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

Background MessageLoop that aggregates live VLink endpoint discovery data. More...

#include <discovery_viewer.h>

Inheritance diagram for vlink::DiscoveryViewer:
Collaboration diagram for vlink::DiscoveryViewer:

Classes

struct  Process
 Information about one process that hosts a VLink endpoint. More...
struct  Info
 Aggregated discovery entry for one VLink URL. More...

Public Types

enum  FilterType : uint8_t { kFilterNone = 0 , kFilterAvailable = 1 , kFilterNative = 2 }
 Controls which endpoints are included in the discovery view. More...
using Callback = std::function<void(const std::vector<Info>& info_list)>
 Callback fired whenever the discovery information is updated.
 Queue implementation type. More...
 Idle strategy controlling CPU and latency trade-offs. More...
 Pre-defined task priority levels for kPriorityType loops. More...

Public Member Functions

 DiscoveryViewer (FilterType type=kFilterNone)
 Constructs a DiscoveryViewer with the given filter type.
 ~DiscoveryViewer () override
 Destructor – stops the viewer loop.
void register_callback (Callback &&callback)
 Registers the callback invoked when the endpoint list changes.
std::vector< Infoget_info_list ()
 Returns a snapshot of the current discovery information.
std::string get_ser_type (const std::string &url) const
 Returns the serialisation type string for a given URL.
SchemaType get_schema_type (const std::string &url) const
 Returns the coarse schema family for a given URL.

Static Public Member Functions

static ImplType convert_type (std::string_view str)
 Converts a transport string to the corresponding ImplType value.
static std::string convert_type_to_view (uint32_t type)
 Returns a display string for an ImplType bitmask.
static std::string convert_type_to_view (uint32_t type, const std::vector< Process > &process_list)
 Returns a combined type-and-process display string.
static std::string get_listen_address ()
 Returns the intra-process address used by the discovery subsystem.
static DiscoveryViewerglobal_get ()
 Returns the process-global DiscoveryViewer singleton.

Protected Member Functions

size_t get_max_task_count () const override
 Returns the maximum queue depth.
uint32_t get_max_elapsed_time () const override
 Returns the maximum allowed task execution time in milliseconds.
void on_begin () override
 Called from the loop thread just before the first task is processed.
void on_end () override
 Called from the loop thread just after the last task has been processed.

Detailed Description

Background MessageLoop that aggregates live VLink endpoint discovery data.

Member Typedef Documentation

◆ Callback

using vlink::DiscoveryViewer::Callback = std::function<void(const std::vector<Info>& info_list)>

Callback fired whenever the discovery information is updated.

Invoked on the viewer's event loop thread. The vector is a snapshot of the current live endpoint list.

Member Enumeration Documentation

◆ FilterType

Controls which endpoints are included in the discovery view.

Value Meaning
kFilterNone All discovered endpoints
kFilterAvailable Endpoints with at least one live process
kFilterNative Endpoints from the local host only
Enumerator
kFilterNone 

Show all endpoints.

kFilterAvailable 

Show only endpoints with live processes.

kFilterNative 

Show only local-host endpoints.

Constructor & Destructor Documentation

◆ DiscoveryViewer()

vlink::DiscoveryViewer::DiscoveryViewer ( FilterType type = kFilterNone)
explicit

Constructs a DiscoveryViewer with the given filter type.

Parameters
typeControls which endpoints are included. Default: kFilterNone.
Here is the caller graph for this function:

◆ ~DiscoveryViewer()

vlink::DiscoveryViewer::~DiscoveryViewer ( )
override

Destructor – stops the viewer loop.

Member Function Documentation

◆ convert_type()

ImplType vlink::DiscoveryViewer::convert_type ( std::string_view str)
staticnodiscard

Converts a transport string to the corresponding ImplType value.

Parameters
strTransport string (e.g., "dds", "shm").
Returns
Corresponding ImplType, or 0 if unknown.

◆ convert_type_to_view() [1/2]

std::string vlink::DiscoveryViewer::convert_type_to_view ( uint32_t type)
staticnodiscard

Returns a display string for an ImplType bitmask.

Parameters
typeImplType bitmask.
Returns
Human-readable type string.

◆ convert_type_to_view() [2/2]

std::string vlink::DiscoveryViewer::convert_type_to_view ( uint32_t type,
const std::vector< Process > & process_list )
staticnodiscard

Returns a combined type-and-process display string.

Parameters
typeImplType bitmask.
process_listList of processes to include in the display.
Returns
Combined display string.

◆ get_info_list()

std::vector< Info > vlink::DiscoveryViewer::get_info_list ( )
nodiscard

Returns a snapshot of the current discovery information.

Returns
Copy of the live Info list at the time of the call.

◆ get_listen_address()

std::string vlink::DiscoveryViewer::get_listen_address ( )
staticnodiscard

Returns the intra-process address used by the discovery subsystem.

Returns
Discovery listen address string.

◆ get_max_elapsed_time()

uint32_t vlink::DiscoveryViewer::get_max_elapsed_time ( ) const
overrideprotectedvirtual

Returns the maximum allowed task execution time in milliseconds.

When a task exceeds this duration, on_task_timeout() is called. Returns 0 to disable timeout checking.

Returns
Maximum execution time in ms.

Reimplemented from vlink::MessageLoop.

◆ get_max_task_count()

size_t vlink::DiscoveryViewer::get_max_task_count ( ) const
overrideprotectedvirtual

Returns the maximum queue depth.

Returns
kMaxTaskSize (10000) by default.

Reimplemented from vlink::MessageLoop.

◆ get_schema_type()

SchemaType vlink::DiscoveryViewer::get_schema_type ( const std::string & url) const
nodiscard

Returns the coarse schema family for a given URL.

Parameters
urlTopic URL to look up.
Returns
Schema family, or SchemaType::kUnknown if not known.

◆ get_ser_type()

std::string vlink::DiscoveryViewer::get_ser_type ( const std::string & url) const
nodiscard

Returns the serialisation type string for a given URL.

Parameters
urlTopic URL to look up.
Returns
Serialisation type (e.g., "demo.proto.PointCloud"), or empty if not known.

◆ global_get()

DiscoveryViewer * vlink::DiscoveryViewer::global_get ( )
static

Returns the process-global DiscoveryViewer singleton.

Created with kFilterNone on first call. The singleton is destroyed on process exit.

Returns
Raw pointer to the global DiscoveryViewer.
Here is the call graph for this function:

◆ on_begin()

void vlink::DiscoveryViewer::on_begin ( )
overrideprotectedvirtual

Called from the loop thread just before the first task is processed.

Override in subclasses to perform per-thread initialisation.

Reimplemented from vlink::MessageLoop.

◆ on_end()

void vlink::DiscoveryViewer::on_end ( )
overrideprotectedvirtual

Called from the loop thread just after the last task has been processed.

Override in subclasses to perform per-thread cleanup.

Reimplemented from vlink::MessageLoop.

Here is the call graph for this function:

◆ register_callback()

void vlink::DiscoveryViewer::register_callback ( Callback && callback)

Registers the callback invoked when the endpoint list changes.

Replaces any previously registered callback. The callback is invoked on the viewer's loop thread.

Parameters
callbackFunction receiving the updated Info list.

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