Skip to content

Commit

Permalink
[core] Split C and C++ implementations (#1904)
Browse files Browse the repository at this point in the history
C++ implementation and C wrapper are no longer located in the same folder.
At the same time, a lot of shared enums are converted to `enum class` for C++.
  • Loading branch information
KerstinKeller authored Jan 16, 2025
1 parent 0e30c01 commit 90d9daa
Show file tree
Hide file tree
Showing 194 changed files with 1,596 additions and 1,088 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ else()
)
endif()

set(ECAL_CSHARP_BUILD_SAMPLES ${BUILD_SAMPLES})



# there is a CMake issue with testing threading availibility via TEST_RUN
Expand Down Expand Up @@ -324,9 +324,15 @@ endif()
# ecal core csharp binding
# --------------------------------------------------------
if(BUILD_CSHARP_BINDING AND WIN32)
set(ECAL_CSHARP_BUILD_SAMPLES ${BUILD_SAMPLES})
set(ECAL_CSHARP_BUILD_TESTS ${BUILD_ECAL_TESTS})
add_subdirectory(lang/csharp)
endif()

set(ECAL_C_BUILD_SAMPLES ${BUILD_SAMPLES})
set(ECAL_C_BUILD_TESTS ${BUILD_ECAL_TESTS})
add_subdirectory(lang/c)

# --------------------------------------------------------
# console applications
# --------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion app/mon/mon_cli/src/ecal_mon_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main(int argc, char** argv)
eCAL::Initialize(config, "eCALMon CLI", eCAL::Init::All);

// set process state
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
eCAL::Process::SetState(eCAL::Process::eSeverity::healthy, eCAL::Process::eSeverityLevel::level1, "Running");

switch (cmd_option)
{
Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_gui/src/ecalmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Ecalmon::Ecalmon(QWidget *parent)
auto config = eCAL::Init::Configuration();
config.logging.receiver.enable = true;
eCAL::Initialize(config, "eCALMon", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
eCAL::Process::SetState(eCAL::Process::eSeverity::healthy, eCAL::Process::eSeverityLevel::level1, "Running");

ui_.setupUi(this);

Expand Down Expand Up @@ -372,7 +372,7 @@ void Ecalmon::updateMonitor()
#ifndef NDEBUG
qDebug().nospace() << "[" << metaObject()->className() << "Error getting Monitoring Information";
#endif // NDEBUG
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_error, "Error getting eCAL Monitoring information");
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_error, "Error getting eCAL Monitoring information");
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/mon/mon_gui/src/plugin/plugin_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 @@ -135,14 +135,14 @@ void PluginManager::AddFoundPlugins(const QVector<QString>& library_paths)
plugins_.insert(iid, ActivePlugin{ plugin, false });
else {
if (plugin_iter->wrapper.getPluginData().path != file_path)
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_warning,
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_warning,
"Ambiguous plugin iid " + iid.toStdString() + " of " + meta_data.name.toStdString() + " " +
meta_data.version.toStdString() + ". Plugin " + file_path.toStdString() +
" was not loaded.");
}
}
catch (const std::runtime_error &e) {
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_warning,
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_warning,
std::string(e.what()) + " Plugin " + file_path.toStdString() + " was not loaded.");
}
}
Expand Down
12 changes: 6 additions & 6 deletions app/mon/mon_gui/src/plugin/plugin_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 @@ -104,25 +104,25 @@ bool PluginWrapper::load()
eCAL::mon::PluginInterface* plugin = qobject_cast<eCAL::mon::PluginInterface*>(instance);
if (plugin)
{
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_info, "Plugin " + plugin_data_.meta_data.name.toStdString() + " " + plugin_data_.meta_data.version.toStdString() + " has been loaded.");
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_info, "Plugin " + plugin_data_.meta_data.name.toStdString() + " " + plugin_data_.meta_data.version.toStdString() + " has been loaded.");
instance_ = std::shared_ptr<eCAL::mon::PluginInterface>(plugin,
[this](eCAL::mon::PluginInterface* p)
{
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_info, "Plugin " + plugin_data_.meta_data.name.toStdString() + " " + plugin_data_.meta_data.version.toStdString() + " has been unloaded.");
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_info, "Plugin " + plugin_data_.meta_data.name.toStdString() + " " + plugin_data_.meta_data.version.toStdString() + " has been unloaded.");
delete dynamic_cast<QObject*>(p);
});
return true;
}
else
{
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_warning, "Plugin " + plugin_data_.path.toStdString() + " is not suitable for eCAL Monitor");
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_warning, "Plugin " + plugin_data_.path.toStdString() + " is not suitable for eCAL Monitor");
loader.unload();
}
}
else
{
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_warning, "Unable to load plugin " + plugin_data_.path.toStdString() + ".");
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_warning, loader.errorString().toStdString());
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_warning, "Unable to load plugin " + plugin_data_.path.toStdString() + ".");
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_warning, loader.errorString().toStdString());
}
}
else
Expand Down
26 changes: 13 additions & 13 deletions app/mon/mon_gui/src/widgets/log_widget/log_widget.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 @@ -211,30 +211,30 @@ void LogWidget::getEcalLogs()

void LogWidget::updateLogLevelFilter()
{
int log_level_filter = eCAL_Logging_eLogLevel::log_level_none;
int log_level_filter = eCAL::Logging::eLogLevel::log_level_none;

if (ui_.debug_checkbox->isChecked())
{
log_level_filter |= (eCAL_Logging_eLogLevel::log_level_debug1 | eCAL_Logging_eLogLevel::log_level_debug2 | eCAL_Logging_eLogLevel::log_level_debug3 | eCAL_Logging_eLogLevel::log_level_debug4);
log_level_filter |= (eCAL::Logging::eLogLevel::log_level_debug1 | eCAL::Logging::eLogLevel::log_level_debug2 | eCAL::Logging::eLogLevel::log_level_debug3 | eCAL::Logging::eLogLevel::log_level_debug4);
}
if (ui_.info_checkbox->isChecked())
{
log_level_filter |= eCAL_Logging_eLogLevel::log_level_info;
log_level_filter |= eCAL::Logging::eLogLevel::log_level_info;
}
if (ui_.warning_checkbox->isChecked())
{
log_level_filter |= eCAL_Logging_eLogLevel::log_level_warning;
log_level_filter |= eCAL::Logging::eLogLevel::log_level_warning;
}
if (ui_.error_checkbox->isChecked())
{
log_level_filter |= eCAL_Logging_eLogLevel::log_level_error;
log_level_filter |= eCAL::Logging::eLogLevel::log_level_error;
}
if (ui_.fatal_checkbox->isChecked())
{
log_level_filter |= eCAL_Logging_eLogLevel::log_level_fatal;
log_level_filter |= eCAL::Logging::eLogLevel::log_level_fatal;
}

log_proxy_model_->setLogLevelFilter((eCAL_Logging_eLogLevel)log_level_filter);
log_proxy_model_->setLogLevelFilter((eCAL::Logging::eLogLevel)log_level_filter);
}

void LogWidget::setPaused(bool paused)
Expand Down Expand Up @@ -402,11 +402,11 @@ void LogWidget::setLogLevelFilter(int log_level)
ui_.error_checkbox ->blockSignals(true);
ui_.fatal_checkbox ->blockSignals(true);

ui_.debug_checkbox ->setChecked(log_level & (eCAL_Logging_eLogLevel::log_level_debug1 | eCAL_Logging_eLogLevel::log_level_debug2 | eCAL_Logging_eLogLevel::log_level_debug3 | eCAL_Logging_eLogLevel::log_level_debug4));
ui_.info_checkbox ->setChecked(log_level & eCAL_Logging_eLogLevel::log_level_info);
ui_.warning_checkbox->setChecked(log_level & eCAL_Logging_eLogLevel::log_level_warning);
ui_.error_checkbox ->setChecked(log_level & eCAL_Logging_eLogLevel::log_level_error);
ui_.fatal_checkbox ->setChecked(log_level & eCAL_Logging_eLogLevel::log_level_fatal);
ui_.debug_checkbox ->setChecked(log_level & (eCAL::Logging::eLogLevel::log_level_debug1 | eCAL::Logging::eLogLevel::log_level_debug2 | eCAL::Logging::eLogLevel::log_level_debug3 | eCAL::Logging::eLogLevel::log_level_debug4));
ui_.info_checkbox ->setChecked(log_level & eCAL::Logging::eLogLevel::log_level_info);
ui_.warning_checkbox->setChecked(log_level & eCAL::Logging::eLogLevel::log_level_warning);
ui_.error_checkbox ->setChecked(log_level & eCAL::Logging::eLogLevel::log_level_error);
ui_.fatal_checkbox ->setChecked(log_level & eCAL::Logging::eLogLevel::log_level_fatal);

updateLogLevelFilter();

Expand Down
24 changes: 12 additions & 12 deletions app/mon/mon_gui/src/widgets/models/log_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,21 @@ QString LogModel::logLevelToString(int log_level)
{
switch (log_level)
{
case eCAL_Logging_eLogLevel::log_level_debug1:
case eCAL::Logging::eLogLevel::log_level_debug1:
return "Debug 1";
case eCAL_Logging_eLogLevel::log_level_debug2:
case eCAL::Logging::eLogLevel::log_level_debug2:
return "Debug 2";
case eCAL_Logging_eLogLevel::log_level_debug3:
case eCAL::Logging::eLogLevel::log_level_debug3:
return "Debug 3";
case eCAL_Logging_eLogLevel::log_level_debug4:
case eCAL::Logging::eLogLevel::log_level_debug4:
return "Debug 4";
case eCAL_Logging_eLogLevel::log_level_info:
case eCAL::Logging::eLogLevel::log_level_info:
return "Info";
case eCAL_Logging_eLogLevel::log_level_warning:
case eCAL::Logging::eLogLevel::log_level_warning:
return "Warning";
case eCAL_Logging_eLogLevel::log_level_error:
case eCAL::Logging::eLogLevel::log_level_error:
return "Error";
case eCAL_Logging_eLogLevel::log_level_fatal:
case eCAL::Logging::eLogLevel::log_level_fatal:
return "Fatal";
default:
return "Unknown";
Expand All @@ -140,13 +140,13 @@ QVariant LogModel::logLevelColor(int log_level)
{
switch (log_level)
{
case eCAL_Logging_eLogLevel::log_level_info:
case eCAL::Logging::eLogLevel::log_level_info:
return QColor(91, 155, 213);
case eCAL_Logging_eLogLevel::log_level_warning:
case eCAL::Logging::eLogLevel::log_level_warning:
return QColor(255, 192, 0);
case eCAL_Logging_eLogLevel::log_level_error:
case eCAL::Logging::eLogLevel::log_level_error:
return QColor(255, 100, 10);
case eCAL_Logging_eLogLevel::log_level_fatal:
case eCAL::Logging::eLogLevel::log_level_fatal:
return QColor(192, 0, 0);
default:
return QVariant(); // Invalid QVariant // Default color for "Debug x"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 All @@ -24,7 +24,7 @@
#include "item_data_roles.h"

LogSortFilterProxyModel::LogSortFilterProxyModel(QObject* parent)
: QMulticolumnSortFilterProxyModel(parent), log_level_filter_(log_level_none)
: QMulticolumnSortFilterProxyModel(parent), log_level_filter_(eCAL::Logging::eLogLevel::log_level_none)
{
setRecursiveFilteringEnabled(true);
}
Expand All @@ -44,13 +44,13 @@ bool LogSortFilterProxyModel::filterDirectAcceptsRow(int source_row, const QMode
return false;
}

void LogSortFilterProxyModel::setLogLevelFilter(eCAL_Logging_eLogLevel log_levels)
void LogSortFilterProxyModel::setLogLevelFilter(eCAL::Logging::eLogLevel log_levels)
{
log_level_filter_ = log_levels;
invalidateFilter();
}

eCAL_Logging_eLogLevel LogSortFilterProxyModel::logLevelFilter() const
eCAL::Logging::eLogLevel LogSortFilterProxyModel::logLevelFilter() const
{
return log_level_filter_;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 @@ -29,12 +29,12 @@ class LogSortFilterProxyModel :
LogSortFilterProxyModel(QObject* parent = 0);
~LogSortFilterProxyModel();

void setLogLevelFilter(eCAL_Logging_eLogLevel log_levels);
void setLogLevelFilter(eCAL::Logging::eLogLevel log_levels);

eCAL_Logging_eLogLevel logLevelFilter() const;
eCAL::Logging::eLogLevel logLevelFilter() const;

private:
eCAL_Logging_eLogLevel log_level_filter_;
eCAL::Logging::eLogLevel log_level_filter_;

bool filterDirectAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
};
Expand Down
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 @@ -208,7 +208,7 @@ void PluginWidget::updateTree()
// tree view and replace it with a dummy error-item. We also log an eCAL
// error message.

eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());

tree_model_->removeAllChildren();
currently_showing_error_item_ = true;
Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_plugins/protobuf_reflection/src/plugin_widget.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 @@ -206,7 +206,7 @@ void PluginWidget::updateTree()
// tree view and replace it with a dummy error-item. We also log an eCAL
// error message.

eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());

tree_model_->removeAllChildren();
currently_showing_error_item_ = true;
Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_plugins/signals_plotting/src/plugin_widget.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 @@ -323,7 +323,7 @@ void PluginWidget::updateTree()

void PluginWidget::showErrorMessage()
{
eCAL::Logging::Log(eCAL_Logging_eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());
eCAL::Logging::Log(eCAL::Logging::eLogLevel::log_level_error, "Error when receiving data on topic \"" + topic_name_.toStdString() + "\": " + last_error_string_.toStdString());

tree_model_->removeAllChildren();
tree_view_->setVisible(false);
Expand Down
2 changes: 1 addition & 1 deletion app/mon/mon_tui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char** argv)

auto status = eCAL::Initialize(config, "eCALMon TUI", eCAL::Init::Default | eCAL::Init::Monitoring);
if (status == -1) std::cerr << "Failed to init" << std::endl;
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
eCAL::Process::SetState(eCAL::Process::eSeverity::healthy, eCAL::Process::eSeverityLevel::level1, "Running");

TUI::Start(args);

Expand Down
18 changes: 9 additions & 9 deletions app/mon/mon_tui/src/model/log.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 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 @@ -73,21 +73,21 @@ class LogModel
{
switch (val)
{
case eCAL_Logging_eLogLevel::log_level_debug1:
case eCAL::Logging::eLogLevel::log_level_debug1:
return LogEntry::Level::DEBUG1;
case eCAL_Logging_eLogLevel::log_level_debug2:
case eCAL::Logging::eLogLevel::log_level_debug2:
return LogEntry::Level::DEBUG2;
case eCAL_Logging_eLogLevel::log_level_debug3:
case eCAL::Logging::eLogLevel::log_level_debug3:
return LogEntry::Level::DEBUG3;
case eCAL_Logging_eLogLevel::log_level_debug4:
case eCAL::Logging::eLogLevel::log_level_debug4:
return LogEntry::Level::DEBUG4;
case eCAL_Logging_eLogLevel::log_level_warning:
case eCAL::Logging::eLogLevel::log_level_warning:
return LogEntry::Level::WARNING;
case eCAL_Logging_eLogLevel::log_level_error:
case eCAL::Logging::eLogLevel::log_level_error:
return LogEntry::Level::ERROR;
case eCAL_Logging_eLogLevel::log_level_fatal:
case eCAL::Logging::eLogLevel::log_level_fatal:
return LogEntry::Level::FATAL;
case eCAL_Logging_eLogLevel::log_level_info:
case eCAL::Logging::eLogLevel::log_level_info:
default:
return LogEntry::Level::INFO;
}
Expand Down
Loading

0 comments on commit 90d9daa

Please sign in to comment.