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

eCAL core v5 compatibility modus (part 1) #1930

Merged
merged 3 commits into from
Jan 22, 2025
Merged

Conversation

KerstinKeller
Copy link
Contributor

We want to introduce an eCAL 5 compatibility modus, which will make it easier to migrate to eCAL 6.

This PR is the first step for this.
There are now two targets, ecal_core and ecal_core_v5.
They differentiate on how they define the eCAL namespaces:

ecal_core:

namespace eCAL
{
namespace v5
{
  // deprecated old function
  void old_function();
}
inline namesapce v6
{
  void new_function();
}
}

and

ecal_core_v5:

namespace eCAL
{
inline namespace v5
{
  // deprecated old function
  void old_function();
}
namesapce v6
{
  void new_function();
}
}

In theory, when users migrate to eCAL 6, and enounter deleted functions, they can first use the compatibility mode.
Later they can switch back to core.
We will take the liberty to remove core_v5 during the lifetime of eCAL 6 (e.g. API stability is promised only for the core Target and v6 namespace functions.

Also, the eCAL will use the namespace macros:
ECAL_CORE_NAMESPACE_V5 and ECAL_CORE_NAMESPACE_V6 for opening the namespaces.

v5 files / implementations have been moved to v5 include / src folders to allow easier cleanup at a later stage.

@KerstinKeller KerstinKeller added the cherry-pick-to-NONE Don't cherry-pick these changes label Jan 22, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -40,7 +41,7 @@ namespace eCAL
{
class CServiceClientImpl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: declaration 'CServiceClientImpl' is never referenced, but a declaration with the same name found in another namespace 'eCAL::v6' [bugprone-forward-declaration-namespace]

  class CServiceClientImpl;
        ^
Additional context

ecal/core/include/ecal/ecal_client_instance.h:39: a declaration of 'CServiceClientImpl' is found here

    class CServiceClientImpl;
          ^

@@ -40,7 +41,7 @@
{
class CServiceClientImpl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no definition found for 'CServiceClientImpl', but a definition with the same name 'CServiceClientImpl' found in another namespace 'eCAL::v6' [bugprone-forward-declaration-namespace]

  class CServiceClientImpl;
        ^
Additional context

ecal/core/src/service/ecal_service_client_impl.h:46: a definition of 'CServiceClientImpl' is found here

    class CServiceClientImpl : public std::enable_shared_from_this<CServiceClientImpl>
          ^

@@ -401,7 +401,7 @@ namespace eCAL
return(true);
}

bool CPublisherImpl::SetEventCallback(const PubEventCallbackT callback_)
bool CPublisherImpl::SetEventCallback(const v6::PubEventCallbackT callback_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the const qualified parameter 'callback_' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

ecal/core/src/pubsub/ecal_publisher_impl.h:89:

-     bool SetEventCallback(const v6::PubEventCallbackT callback_);
+     bool SetEventCallback(const v6::PubEventCallbackT& callback_);
Suggested change
bool CPublisherImpl::SetEventCallback(const v6::PubEventCallbackT callback_)
bool CPublisherImpl::SetEventCallback(const v6::PubEventCallbackT& callback_)

if (g_subgate() != nullptr) g_subgate()->Register(topic_name_, m_subscriber_impl);
}

CSubscriber::CSubscriber(const std::string & topic_name_, const SDataTypeInformation & data_type_info_, const SubEventCallbackT event_callback_, const Subscriber::Configuration & config_) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the const qualified parameter 'event_callback_' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

ecal/core/include/ecal/ecal_subscriber.h:68:

-         CSubscriber(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const SubEventCallbackT event_callback_, const Subscriber::Configuration& config_ = GetSubscriberConfiguration());
+         CSubscriber(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const SubEventCallbackT& event_callback_, const Subscriber::Configuration& config_ = GetSubscriberConfiguration());
Suggested change
CSubscriber::CSubscriber(const std::string & topic_name_, const SDataTypeInformation & data_type_info_, const SubEventCallbackT event_callback_, const Subscriber::Configuration & config_) :
CSubscriber::CSubscriber(const std::string & topic_name_, const SDataTypeInformation & data_type_info_, const SubEventCallbackT& event_callback_, const Subscriber::Configuration & config_) :

@@ -232,7 +233,7 @@ namespace eCAL
return(true);
}

bool CSubscriberImpl::SetEventIDCallback(const SubEventCallbackT callback_)
bool CSubscriberImpl::SetEventIDCallback(const v6::SubEventCallbackT callback_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the const qualified parameter 'callback_' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
bool CSubscriberImpl::SetEventIDCallback(const v6::SubEventCallbackT callback_)
bool CSubscriberImpl::SetEventIDCallback(const v6::SubEventCallbackT& callback_)

ecal/core/src/pubsub/ecal_subscriber_impl.h:80:

-     bool SetEventIDCallback(const v6::SubEventCallbackT callback_);
+     bool SetEventIDCallback(const v6::SubEventCallbackT& callback_);

#include <ecal/v5/ecal_client.h>
#include <ecal/v5/ecal_server.h>
#include <ecal/v5/ecal_publisher.h>
#include <ecal/v5/ecal_subscriber.h>

using namespace System;
using namespace System::Collections::Generic;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'System' [clang-diagnostic-error]

using namespace System::Collections::Generic;
                ^

@@ -24,7 +24,7 @@

#pragma once

#include <ecal/ecal_publisher_v5.h>
#include <ecal/v5/ecal_publisher.h>
#include <ecal/msg/capnproto/helper.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ecal/msg/capnproto/helper.h' file not found [clang-diagnostic-error]

#include <ecal/msg/capnproto/helper.h>
         ^

@@ -25,7 +25,7 @@
#pragma once

#include <ecal/ecal_deprecate.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ecal/ecal_deprecate.h' file not found [clang-diagnostic-error]

#include <ecal/ecal_deprecate.h>
         ^

@@ -27,7 +27,7 @@
#include <cstddef>
#include <ecal/ecal_deprecate.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ecal/ecal_deprecate.h' file not found [clang-diagnostic-error]

#include <ecal/ecal_deprecate.h>
         ^

@@ -24,7 +24,7 @@

#pragma once

#include <ecal/ecal_server_v5.h>
#include <ecal/v5/ecal_server.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ecal/v5/ecal_server.h' file not found [clang-diagnostic-error]

#include <ecal/v5/ecal_server.h>
         ^

@rex-schilasky rex-schilasky self-requested a review January 22, 2025 15:13
Copy link
Contributor

@rex-schilasky rex-schilasky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANK YOU!

@KerstinKeller KerstinKeller merged commit b411864 into master Jan 22, 2025
21 checks passed
@KerstinKeller KerstinKeller deleted the feature/ecal-core-v5 branch January 22, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-NONE Don't cherry-pick these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants