Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Rename TopicIDCallbackT to TopicEventCallbackT. #1919

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ecal/core/include/ecal/ecal_registration.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,8 @@ namespace eCAL
deleted_entity //!< Represents a deletion of an entity
};

using TopicIDCallbackT = std::function<void(const STopicId&, RegistrationEventType)>;
/* @brief Event callback, when a topic related entity (publisher / subscriber) has been created or deleted */
using TopicEventCallbackT = std::function<void(const STopicId&, RegistrationEventType)>;

/**
* @brief Get complete snapshot of all known publisher.
Expand All @@ -82,7 +83,7 @@ namespace eCAL
*
* @return CallbackToken Token that can be used to unregister the callback.
*/
ECAL_API CallbackToken AddPublisherEventCallback(const TopicIDCallbackT& callback_);
ECAL_API CallbackToken AddPublisherEventCallback(const TopicEventCallbackT& callback_);

/**
* @brief Unregister the publisher callback using the provided token.
Expand Down Expand Up @@ -114,7 +115,7 @@ namespace eCAL
*
* @return CallbackToken Token that can be used to unregister the callback.
*/
ECAL_API CallbackToken AddSubscriberEventCallback(const TopicIDCallbackT& callback_);
ECAL_API CallbackToken AddSubscriberEventCallback(const TopicEventCallbackT& callback_);

/**
* @brief Unregister the subscriber callback using the provided token.
Expand Down
10 changes: 5 additions & 5 deletions ecal/core/src/ecal_descgate.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace eCAL
return GetTopic(id_, m_publisher_info_map, topic_info_);
}

Registration::CallbackToken CDescGate::AddPublisherEventCallback(const Registration::TopicIDCallbackT& callback_)
Registration::CallbackToken CDescGate::AddPublisherEventCallback(const Registration::TopicEventCallbackT& callback_)
{
const std::lock_guard<std::mutex> lock(m_publisher_callback_map.mtx);

Expand All @@ -75,7 +75,7 @@ namespace eCAL
return GetTopic(id_, m_subscriber_info_map, topic_info_);
}

Registration::CallbackToken CDescGate::AddSubscriberEventCallback(const Registration::TopicIDCallbackT& callback_)
Registration::CallbackToken CDescGate::AddSubscriberEventCallback(const Registration::TopicEventCallbackT& callback_)
{
const std::lock_guard<std::mutex> lock(m_subscriber_callback_map.mtx);

Expand Down Expand Up @@ -221,7 +221,7 @@ namespace eCAL
}

void CDescGate::ApplyTopicDescription(STopicIdInfoMap& topic_info_map_,
const STopicIdCallbackMap& topic_callback_map_,
const STopicEventCallbackMap& topic_callback_map_,
const Registration::SampleIdentifier& topic_id_,
const std::string& topic_name_,
const SDataTypeInformation& topic_info_)
Expand Down Expand Up @@ -258,7 +258,7 @@ namespace eCAL
}

void CDescGate::RemTopicDescription(STopicIdInfoMap& topic_info_map_,
const STopicIdCallbackMap& topic_callback_map_,
const STopicEventCallbackMap& topic_callback_map_,
const Registration::SampleIdentifier& topic_id_,
const std::string& topic_name_)
{
Expand Down
20 changes: 10 additions & 10 deletions ecal/core/src/ecal_descgate.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,13 +50,13 @@ namespace eCAL
// get publisher information
std::set<Registration::STopicId> GetPublisherIDs() const;
bool GetPublisherInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const;
Registration::CallbackToken AddPublisherEventCallback(const Registration::TopicIDCallbackT& callback_);
Registration::CallbackToken AddPublisherEventCallback(const Registration::TopicEventCallbackT& callback_);
void RemPublisherEventCallback(Registration::CallbackToken token_);

// get subscriber information
std::set<Registration::STopicId> GetSubscriberIDs() const;
bool GetSubscriberInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const;
Registration::CallbackToken AddSubscriberEventCallback(const Registration::TopicIDCallbackT& callback_);
Registration::CallbackToken AddSubscriberEventCallback(const Registration::TopicEventCallbackT& callback_);
void RemSubscriberEventCallback(Registration::CallbackToken token_);

// get service information
Expand All @@ -83,11 +83,11 @@ namespace eCAL
TopicIdInfoMap map;
};

using TopicIdCallbackMap = std::map<Registration::CallbackToken, Registration::TopicIDCallbackT>;
struct STopicIdCallbackMap
using TopicEventCallbackMap = std::map<Registration::CallbackToken, Registration::TopicEventCallbackT>;
struct STopicEventCallbackMap
{
mutable std::mutex mtx;
TopicIdCallbackMap map;
TopicEventCallbackMap map;
};

using ServiceIdInfoMap = std::map<Registration::SServiceMethodId, SServiceMethodInformation>;
Expand All @@ -104,13 +104,13 @@ namespace eCAL
static bool GetService (const Registration::SServiceMethodId& id_, const SServiceIdInfoMap& service_method_info_map_, SServiceMethodInformation& service_method_info_);

static void ApplyTopicDescription(STopicIdInfoMap& topic_info_map_,
const STopicIdCallbackMap& topic_callback_map_,
const STopicEventCallbackMap& topic_callback_map_,
const Registration::SampleIdentifier& topic_id_,
const std::string& topic_name_,
const SDataTypeInformation& topic_info_);

static void RemTopicDescription(STopicIdInfoMap& topic_info_map_,
const STopicIdCallbackMap& topic_callback_map_,
const STopicEventCallbackMap& topic_callback_map_,
const Registration::SampleIdentifier& topic_id_,
const std::string& topic_name_);

Expand All @@ -130,10 +130,10 @@ namespace eCAL

// internal quality topic info publisher/subscriber maps
STopicIdInfoMap m_publisher_info_map;
STopicIdCallbackMap m_publisher_callback_map;
STopicEventCallbackMap m_publisher_callback_map;

STopicIdInfoMap m_subscriber_info_map;
STopicIdCallbackMap m_subscriber_callback_map;
STopicEventCallbackMap m_subscriber_callback_map;

// internal quality service info service/client maps
SServiceIdInfoMap m_service_info_map;
Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/registration/ecal_registration.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,7 @@ namespace eCAL
return g_descgate()->GetPublisherInfo(id_, topic_info_);
}

CallbackToken AddPublisherEventCallback(const TopicIDCallbackT& callback_)
CallbackToken AddPublisherEventCallback(const TopicEventCallbackT& callback_)
{
if (g_descgate() == nullptr) return CallbackToken();
return g_descgate()->AddPublisherEventCallback(callback_);
Expand All @@ -70,7 +70,7 @@ namespace eCAL
return g_descgate()->GetSubscriberInfo(id_, topic_info_);
}

ECAL_API CallbackToken AddSubscriberEventCallback(const TopicIDCallbackT& callback_)
ECAL_API CallbackToken AddSubscriberEventCallback(const TopicEventCallbackT& callback_)
{
if (g_descgate() == nullptr) return CallbackToken();
return g_descgate()->AddSubscriberEventCallback(callback_);
Expand Down
Loading