Class ServiceRegistry

Nested Relationships

Nested Types

Class Documentation

class ServiceRegistry

Public Types

enum class Error

Values:

enumerator SERVICE_REGISTRY_FULL
using ReferenceCounter_t = uint64_t

Public Functions

cxx::expected<Error> addPublisher(const capro::ServiceDescription &serviceDescription) noexcept

Adds a given publisher service description to registry.

Parameters:

serviceDescription, service[in] to be added

Returns:

ServiceRegistryError, error wrapped in cxx::expected

void removePublisher(const capro::ServiceDescription &serviceDescription) noexcept

Removes a given publisher service description from registry if service is found, in case of multiple occurrences only one occurrence is removed.

Parameters:

serviceDescription, service[in] to be removed

cxx::expected<Error> addServer(const capro::ServiceDescription &serviceDescription) noexcept

Adds a given server service description to registry.

Parameters:

serviceDescription, service[in] to be added

Returns:

ServiceRegistryError, error wrapped in cxx::expected

void removeServer(const capro::ServiceDescription &serviceDescription) noexcept

Removes a given server service description from registry if service is found, in case of multiple occurrences only one occurrence is removed.

Parameters:

serviceDescription, service[in] to be removed

void purge(const capro::ServiceDescription &serviceDescription) noexcept

Removes given service description from registry if service is found, all occurences are removed.

Parameters:

serviceDescription, service[in] to be removed

void find(const cxx::optional<capro::IdString_t> &service, const cxx::optional<capro::IdString_t> &instance, const cxx::optional<capro::IdString_t> &event, cxx::function_ref<void(const ServiceDescriptionEntry&)> callable) const noexcept

Searches for given service description in registry.

Parameters:
  • service, string[in] or wildcard (= iox::cxx::nullopt) to search for

  • instance, string[in] or wildcard (= iox::cxx::nullopt) to search for

  • event, string[in] or wildcard (= iox::cxx::nullopt) to search for

  • callable, callable[in] to apply to each matching entry

void forEach(cxx::function_ref<void(const ServiceDescriptionEntry&)> callable) const noexcept

Applys a callable to all entries.

Note

Can be used to obtain all entries or count them

Parameters:

callable, callable[in] to apply to each entry

Public Static Attributes

static constexpr uint32_t CAPACITY = iox::SERVICE_REGISTRY_CAPACITY
struct ServiceDescriptionEntry

Public Functions

ServiceDescriptionEntry(const capro::ServiceDescription &serviceDescription)

Public Members

capro::ServiceDescription serviceDescription
ReferenceCounter_t publisherCount = {0U}
ReferenceCounter_t serverCount = {0U}