Skip to content

Commit

Permalink
iox-#27 iox-eclipse-iceoryx#415 Rename findService() to find()
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice committed Feb 19, 2022
1 parent fc7e2d9 commit 5d32380
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 229 deletions.
18 changes: 9 additions & 9 deletions iceoryx_posh/include/iceoryx_posh/runtime/service_discovery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ class ServiceDiscovery
/// @param[in] event event string to search for, a nullopt corresponds to a wildcard
/// @return ServiceContainer
/// ServiceContainer: container that is filled with all matching instances
ServiceContainer findService(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const MessagingPattern pattern) noexcept;
ServiceContainer find(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const MessagingPattern pattern) noexcept;

/// @brief Searches all services that match the provided service description and applies a function to each of them
/// @param[in] service service string to search for, a nullopt corresponds to a wildcard
/// @param[in] instance instance string to search for, a nullopt corresponds to a wildcard
/// @param[in] event event string to search for, a nullopt corresponds to a wildcard
/// @param[in] callable to apply to all matching services
void findService(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const cxx::function_ref<void(const ServiceContainer&)>& callable,
const MessagingPattern pattern) noexcept;
void find(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const cxx::function_ref<void(const ServiceContainer&)>& callable,
const MessagingPattern pattern) noexcept;

friend iox::popo::NotificationAttorney;

Expand Down
20 changes: 10 additions & 10 deletions iceoryx_posh/source/runtime/service_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ namespace iox
{
namespace runtime
{
ServiceContainer ServiceDiscovery::findService(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const MessagingPattern pattern) noexcept
ServiceContainer ServiceDiscovery::find(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const MessagingPattern pattern) noexcept
{
m_serviceRegistrySubscriber.take().and_then([&](popo::Sample<const roudi::ServiceRegistry>& serviceRegistrySample) {
m_serviceRegistry = *serviceRegistrySample;
Expand Down Expand Up @@ -64,18 +64,18 @@ ServiceContainer ServiceDiscovery::findService(const cxx::optional<capro::IdStri
return searchResult;
}

void ServiceDiscovery::findService(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const cxx::function_ref<void(const ServiceContainer&)>& callable,
const MessagingPattern pattern) noexcept
void ServiceDiscovery::find(const cxx::optional<capro::IdString_t>& service,
const cxx::optional<capro::IdString_t>& instance,
const cxx::optional<capro::IdString_t>& event,
const cxx::function_ref<void(const ServiceContainer&)>& callable,
const MessagingPattern pattern) noexcept
{
if (!callable)
{
return;
}

auto searchResult = findService(service, instance, event, pattern);
auto searchResult = find(service, instance, event, pattern);
callable(searchResult);
}

Expand Down
Loading

0 comments on commit 5d32380

Please sign in to comment.