Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::events::ServicePublisher Class Reference

RAII service publisher. More...

#include <service_discovery.hpp>

Public Member Functions

 ServicePublisher (std::string_view name, std::string_view type, uint16_t port, NetworkServiceDiscovery::TxtRecords txt_records={})
 ~ServicePublisher ()
 ServicePublisher (const ServicePublisher &)=delete
ServicePublisher & operator= (const ServicePublisher &)=delete
bool is_published () const noexcept
NetworkServiceDiscovery & nsd () noexcept
 Access the underlying NSD object — for tests that want to install a fake backend instead of the platform default.

Static Public Member Functions

static std::unique_ptr< ServicePublisher > with_backend (std::unique_ptr< NetworkServiceDiscovery::Backend > backend, std::string_view name, std::string_view type, uint16_t port, NetworkServiceDiscovery::TxtRecords txt_records={})
 Construct a publisher that uses a caller-supplied backend instead of the platform default.

Detailed Description

RAII service publisher.

Builds an internal NetworkServiceDiscovery configured with the platform's default backend, then registers the requested service. Destructor unregisters and releases the backend.

is_published() returns true when the underlying backend accepted the registration. On platforms with no backend it returns false and callers can decide whether to surface the failure or proceed without service publication.

Constructor & Destructor Documentation

◆ ServicePublisher() [1/2]

pulp::events::ServicePublisher::ServicePublisher ( std::string_view name,
std::string_view type,
uint16_t port,
NetworkServiceDiscovery::TxtRecords txt_records = {} )

◆ ~ServicePublisher()

pulp::events::ServicePublisher::~ServicePublisher ( )

◆ ServicePublisher() [2/2]

pulp::events::ServicePublisher::ServicePublisher ( const ServicePublisher & )
delete

Member Function Documentation

◆ is_published()

bool pulp::events::ServicePublisher::is_published ( ) const
inlinenoexcept

◆ nsd()

NetworkServiceDiscovery & pulp::events::ServicePublisher::nsd ( )
inlinenoexcept

Access the underlying NSD object — for tests that want to install a fake backend instead of the platform default.

◆ operator=()

ServicePublisher & pulp::events::ServicePublisher::operator= ( const ServicePublisher & )
delete

◆ with_backend()

std::unique_ptr< ServicePublisher > pulp::events::ServicePublisher::with_backend ( std::unique_ptr< NetworkServiceDiscovery::Backend > backend,
std::string_view name,
std::string_view type,
uint16_t port,
NetworkServiceDiscovery::TxtRecords txt_records = {} )
static

Construct a publisher that uses a caller-supplied backend instead of the platform default.

Primarily for tests.


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