holoscan::FastDdsDiscovery

Beta
View as Markdown

DDS-based implementation of PubSubDiscovery.

Wraps FastDDS’s built-in SPDP/SEDP discovery protocols.

The announce_publisher and announce_subscriber methods don’t actually register with an external service; instead, they track local endpoints while DDS handles the actual discovery via SEDP.

Discovery callbacks are driven by DDS listener events.

#include <holoscan/fastdds_discovery.hpp>

Inherits from: nvidia::gxf::PubSubDiscovery (public)


Constructors

FastDdsDiscovery

Construct a FastDdsDiscovery with a FastDdsPubSubContext.

Parameters

context
FastDdsPubSubContext *

FastDdsPubSubContext providing DomainParticipant

Destructor

~FastDdsDiscovery

holoscan::FastDdsDiscovery::~FastDdsDiscovery() override

Destructor - calls shutdown() if needed.


Assignment operators

operator=

FastDdsDiscovery & holoscan::FastDdsDiscovery::operator=(
const FastDdsDiscovery &
) = delete

Methods

initialize

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::initialize() override

shutdown

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::shutdown() override

is_initialized

bool holoscan::FastDdsDiscovery::is_initialized() const override

discovery_model

nvidia::gxf::DiscoveryModel holoscan::FastDdsDiscovery::discovery_model() const override

DDS uses decentralized passive discovery (SPDP/SEDP).

announce_publisher()/announce_subscriber() are local bookkeeping only; actual network discovery happens when DataWriters/DataReaders are created.

announce_publisher

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::announce_publisher(
const nvidia::gxf::PublisherInfo &info
) override

Announce a local publisher (no-op for DDS).

Local endpoint tracking is handled by the shared TopicRegistry (set by PubSubContext via set_topic_registry()). The actual DDS discovery happens when FastDdsTransport::create_publisher_endpoint() creates the DataWriter.

announce_subscriber

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::announce_subscriber(
const nvidia::gxf::SubscriberInfo &info
) override

Announce a local subscriber (no-op for DDS).

Local endpoint tracking is handled by the shared TopicRegistry (set by PubSubContext via set_topic_registry()). The actual DDS discovery happens when FastDdsTransport::create_subscriber_endpoint() creates the DataReader.

remove_publisher

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::remove_publisher(
const nvidia::gxf::PublisherGid &gid
) override

remove_subscriber

nvidia::gxf::Expected<void> holoscan::FastDdsDiscovery::remove_subscriber(
const nvidia::gxf::SubscriberGid &gid
) override

query_publishers

nvidia::gxf::Expected<std::vector<nvidia::gxf::PublisherInfo>> holoscan::FastDdsDiscovery::query_publishers(
const std::string &topic_name
) override

Query discovered publishers on a topic.

Returns: List of publisher info, or error

Parameters

topic_name
const std::string &

Topic to query (empty string returns all publishers)

query_subscribers

nvidia::gxf::Expected<std::vector<nvidia::gxf::SubscriberInfo>> holoscan::FastDdsDiscovery::query_subscribers(
const std::string &topic_name
) override

Query discovered subscribers on a topic.

Returns: List of subscriber info, or error

Parameters

topic_name
const std::string &

Topic to query (empty string returns all subscribers)

get_all_topics

nvidia::gxf::Expected<std::vector<std::string>> holoscan::FastDdsDiscovery::get_all_topics() override

Get all known topic names.

Returns: List of topic names with at least one publisher or subscriber

set_on_publisher_discovered

void holoscan::FastDdsDiscovery::set_on_publisher_discovered(
PublisherDiscoveredCallback callback
) override

set_on_subscriber_discovered

void holoscan::FastDdsDiscovery::set_on_subscriber_discovered(
SubscriberDiscoveredCallback callback
) override

set_on_publisher_lost

void holoscan::FastDdsDiscovery::set_on_publisher_lost(
PublisherLostCallback callback
) override

set_on_subscriber_lost

void holoscan::FastDdsDiscovery::set_on_subscriber_lost(
SubscriberLostCallback callback
) override

set_local_native_capability

void holoscan::FastDdsDiscovery::set_local_native_capability(
const nvidia::gxf::NativeBufferCapability &cap
)

Set the local NativeBufferCapability to be serialized into participant UserData.

Must be called before initialize() (the participant is already created by that point, so the capability is set during FastDdsPubSubContext::initialize()).

local_native_capability

nvidia::gxf::NativeBufferCapability holoscan::FastDdsDiscovery::local_native_capability(
int device_id = -1
) const override

guid_to_gid

static nvidia::gxf::Gid holoscan::FastDdsDiscovery::guid_to_gid(
const eprosima::fastdds::rtps::GUID_t &guid
)

Helper to convert DDS GUID to GXF Gid.

capability_for_device

nvidia::gxf::NativeBufferCapability holoscan::FastDdsDiscovery::capability_for_device(
int device_id
) const

Build a capability for a specific device by querying its UUID via CUDA.

Returns the default capability (with empty UUID) if the query fails.


Static methods

serialize_native_capability

static std::vector<uint8_t> holoscan::FastDdsDiscovery::serialize_native_capability(
const nvidia::gxf::NativeBufferCapability &cap
)

Serialize NativeBufferCapability into participant UserData QoS bytes.

parse_native_capability

static nvidia::gxf::NativeBufferCapability holoscan::FastDdsDiscovery::parse_native_capability(
const std::vector<uint8_t> &user_data
)

Parse NativeBufferCapability from participant UserData QoS bytes.


Member variables

NameTypeDescription
context_FastDdsPubSubContext *
initialized_bool
discovered_participant_capabilities_std::unordered_map< nvidia::gxf::Gid, nvidia::gxf::NativeBufferCapability >
discovered_publishers_std::unordered_map< nvidia::gxf::Gid, nvidia::gxf::PublisherInfo >
discovered_subscribers_std::unordered_map< nvidia::gxf::Gid, nvidia::gxf::SubscriberInfo >
mutex_std::mutex
on_publisher_discovered_PublisherDiscoveredCallback
on_subscriber_discovered_SubscriberDiscoveredCallback
on_publisher_lost_PublisherLostCallback
on_subscriber_lost_SubscriberLostCallback
listener_std::unique_ptr< DiscoveryListener >
local_native_capability_nvidia::gxf::NativeBufferCapability