Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/user_config…
Browse files Browse the repository at this point in the history
…_implementation
  • Loading branch information
Peguen committed May 17, 2024
2 parents 287c24f + 2bb37a3 commit e3bb375
Show file tree
Hide file tree
Showing 117 changed files with 2,807 additions and 2,910 deletions.
4 changes: 2 additions & 2 deletions app/mon/mon_cli/CMakeLists.txt
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 - 2024 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 @@ -45,7 +45,7 @@ target_link_libraries(${PROJECT_NAME}
tclap::tclap
eCAL::core_protobuf
eCAL::core_pb)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

ecal_install_app(${PROJECT_NAME})

Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_cli/src/ecal_mon_cli.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 - 2024 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 @@ -363,7 +363,7 @@ void ProcProto(const std::string& topic_name, int msg_count)
// create dynamic subscribers for receiving and decoding messages and assign callback
eCAL::protobuf::CDynamicSubscriber sub(topic_name);
std::atomic<int> cnt(msg_count);
auto msg_cb = [&cnt](const google::protobuf::Message& msg_) { if (cnt != 0) { std::cout << msg_.DebugString() << std::endl; if (cnt > 0) cnt--; } };
auto msg_cb = [&cnt](const std::shared_ptr<google::protobuf::Message>& msg_) { if (cnt != 0) { std::cout << msg_->DebugString() << std::endl; if (cnt > 0) cnt--; } };
sub.AddReceiveCallback(std::bind(msg_cb, std::placeholders::_2));

// enter main loop
Expand Down
4 changes: 3 additions & 1 deletion app/mon/mon_plugins/capnproto_reflection/CMakeLists.txt
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 - 2024 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 @@ -67,6 +67,8 @@ target_link_libraries (${PROJECT_NAME}
eCAL::mon_plugin_lib
MonitorTreeView
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

target_link_options(${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/ignore:4099>)

target_include_directories(${PROJECT_NAME} PRIVATE src)
Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_plugins/protobuf_reflection/CMakeLists.txt
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 - 2024 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 @@ -69,7 +69,7 @@ target_link_libraries (${PROJECT_NAME}
MonitorTreeView
eCAL::mon_plugin_lib
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

if(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4127 /wd4714")
Expand Down
12 changes: 4 additions & 8 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 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 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 @@ -110,7 +110,7 @@ PluginWidget::~PluginWidget()

{
std::lock_guard<std::mutex> lock(proto_message_mutex_);
delete last_proto_message_;
last_proto_message_.reset();
}
}

Expand Down Expand Up @@ -157,19 +157,15 @@ void PluginWidget::updatePublishTimeLabel()
////////////////////////////////////////////////////////////////////////////////

// eCAL Callback
void PluginWidget::onProtoMessageCallback(const google::protobuf::Message& message, long long send_time_usecs)
void PluginWidget::onProtoMessageCallback(const std::shared_ptr<google::protobuf::Message>& message, long long send_time_usecs)
{

{
// Lock the mutex
std::lock_guard<std::mutex> lock(proto_message_mutex_);

// Delete the old message
delete last_proto_message_;

// Create a copy of the new message as member variable. We cannot use a reference here, as this may cause a deadlock with the GUI thread
last_proto_message_ = message.New();
last_proto_message_->CopyFrom(message);
last_proto_message_ = message;

last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::duration_cast<eCAL::Time::ecal_clock::duration>(std::chrono::microseconds(send_time_usecs)));

Expand Down
14 changes: 7 additions & 7 deletions app/mon/mon_plugins/protobuf_reflection/src/plugin_widget.h
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 - 2024 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 @@ -68,11 +68,11 @@ private slots:
eCAL::protobuf::CProtoDecoder protobuf_decoder;
std::shared_ptr<ProtobufTreeBuilder> protobuf_tree_builder;

std::mutex proto_message_mutex_;
google::protobuf::Message* last_proto_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
QString last_error_string_;
bool last_message_was_error_;
std::mutex proto_message_mutex_;
std::shared_ptr<google::protobuf::Message> last_proto_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
QString last_error_string_;
bool last_message_was_error_;

bool currently_showing_error_item_;
int error_counter_;
Expand All @@ -83,7 +83,7 @@ private slots:
bool new_msg_available_;
int received_message_counter_;

void onProtoMessageCallback(const google::protobuf::Message& message, long long send_time_usecs);
void onProtoMessageCallback(const std::shared_ptr<google::protobuf::Message>& message, long long send_time_usecs);
void onProtoErrorCallback(const std::string& error);
void updatePublishTimeLabel();

Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_plugins/signals_plotting/CMakeLists.txt
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 - 2024 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 @@ -84,7 +84,7 @@ target_link_libraries (${PROJECT_NAME}
CustomQt
)

target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

if(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4127 /wd4714" )
Expand Down
12 changes: 4 additions & 8 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 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 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 @@ -132,7 +132,7 @@ PluginWidget::~PluginWidget()

{
std::lock_guard<std::mutex> lock(proto_message_mutex_);
delete last_proto_message_;
last_proto_message_.reset();
}
}

Expand Down Expand Up @@ -256,19 +256,15 @@ void PluginWidget::setVisibleSplitterHandle(bool state)
////////////////////////////////////////////////////////////////////////////////

// eCAL Callback
void PluginWidget::onProtoMessageCallback(const google::protobuf::Message& message, long long send_time_usecs)
void PluginWidget::onProtoMessageCallback(const std::shared_ptr<google::protobuf::Message>& message, long long send_time_usecs)
{

{
// Lock the mutex
std::lock_guard<std::mutex> lock(proto_message_mutex_);

// Delete the old message
delete last_proto_message_;

// Create a copy of the new message as member variable. We cannot use a reference here, as this may cause a deadlock with the GUI thread
last_proto_message_ = message.New();
last_proto_message_->CopyFrom(message);
last_proto_message_ = message;

last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::duration_cast<eCAL::Time::ecal_clock::duration>(std::chrono::microseconds(send_time_usecs)));

Expand Down
10 changes: 5 additions & 5 deletions app/mon/mon_plugins/signals_plotting/src/plugin_widget.h
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 - 2024 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 @@ -102,9 +102,9 @@ private slots:
eCAL::protobuf::CProtoDecoder protobuf_decoder;
std::shared_ptr<ProtobufTreeBuilder> protobuf_tree_builder;

std::mutex proto_message_mutex_;
google::protobuf::Message* last_proto_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
std::mutex proto_message_mutex_;
std::shared_ptr<google::protobuf::Message> last_proto_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
QString last_error_string_;
bool last_message_was_error_;
int error_counter_;
Expand All @@ -119,7 +119,7 @@ private slots:

QString key_to_close_;

void onProtoMessageCallback(const google::protobuf::Message& message, long long send_time_usecs);
void onProtoMessageCallback(const std::shared_ptr<google::protobuf::Message>& message, long long send_time_usecs);
void onProtoErrorCallback(const std::string& error);
void updatePublishTimeLabel();
bool find_items(QAbstractTreeItem* tree_item);
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 - 2024 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 @@ -261,7 +261,7 @@ class TreeMessageVisitor : public MessageVisitor

}

void PopulateProtoTree(ftxui::TreeNode &root, google::protobuf::Message *message, const std::shared_ptr<StyleSheet> style)
void PopulateProtoTree(ftxui::TreeNode &root, const std::shared_ptr<google::protobuf::Message>& message, const std::shared_ptr<StyleSheet> style)
{
auto tree_builder = std::make_shared<eCAL::protobuf::TreeMessageVisitor>(root, style);
if(message)
Expand All @@ -272,7 +272,7 @@ void PopulateProtoTree(ftxui::TreeNode &root, google::protobuf::Message *message
}
}

ftxui::TreeNodePtr ProtoTree(google::protobuf::Message *message, const std::shared_ptr<StyleSheet> style)
ftxui::TreeNodePtr ProtoTree(const std::shared_ptr<google::protobuf::Message>& message, const std::shared_ptr<StyleSheet> style)
{
using namespace ftxui;
auto root = std::make_shared<TreeNode>();
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 - 2024 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 @@ -20,6 +20,7 @@

#include <string>
#include <functional>
#include <memory>
#include <mutex>

#include <ecal/ecal.h>
Expand All @@ -35,15 +36,13 @@ class ProtoMessageVisualizationViewModel : public MessageVisualizationViewModel
eCAL::protobuf::CDynamicSubscriber subscriber;

mutable std::mutex message_mtx;
google::protobuf::Message *latest_message = nullptr;
std::shared_ptr<google::protobuf::Message> latest_message = nullptr;

void OnMessage(const google::protobuf::Message& message, long long send_time_usecs)
void OnMessage(const std::shared_ptr<google::protobuf::Message>& message, long long send_time_usecs)
{
{
std::lock_guard<std::mutex> lock(message_mtx);
delete latest_message;
latest_message = message.New();
latest_message->CopyFrom(message);
latest_message = message;

message_timestamp = send_time_usecs;
}
Expand All @@ -56,7 +55,7 @@ class ProtoMessageVisualizationViewModel : public MessageVisualizationViewModel
//NOTE: Use with caution!
struct ProtectedMessage
{
google::protobuf::Message *message;
std::shared_ptr<google::protobuf::Message> message;
std::unique_lock<std::mutex> lock;
};

Expand Down
10 changes: 6 additions & 4 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ endif()
if(ECAL_CORE_PUBLISHER)
set(ecal_pub_src
src/pubsub/ecal_publisher.cpp
src/pubsub/ecal_publisher_config.cpp
src/pubsub/ecal_pubgate.cpp
src/pubsub/ecal_pubgate.h
)
Expand Down Expand Up @@ -226,8 +227,8 @@ if(ECAL_CORE_PUBLISHER)
)
if(ECAL_CORE_TRANSPORT_UDP)
list(APPEND ecal_writer_src
src/readwrite/udp/ecal_writer_udp_mc.cpp
src/readwrite/udp/ecal_writer_udp_mc.h
src/readwrite/udp/ecal_writer_udp.cpp
src/readwrite/udp/ecal_writer_udp.h
)
endif()
if(ECAL_CORE_TRANSPORT_TCP)
Expand All @@ -253,8 +254,8 @@ if(ECAL_CORE_SUBSCRIBER)
)
if(ECAL_CORE_TRANSPORT_UDP)
list(APPEND ecal_reader_src
src/readwrite/udp/ecal_reader_udp_mc.cpp
src/readwrite/udp/ecal_reader_udp_mc.h
src/readwrite/udp/ecal_reader_udp.cpp
src/readwrite/udp/ecal_reader_udp.h
)
endif()
if(ECAL_CORE_TRANSPORT_TCP)
Expand Down Expand Up @@ -466,6 +467,7 @@ set(ecal_header_cmn
include/ecal/ecal_process.h
include/ecal/ecal_process_severity.h
include/ecal/ecal_publisher.h
include/ecal/ecal_publisher_config.h
include/ecal/ecal_server.h
include/ecal/ecal_service_info.h
include/ecal/ecal_subscriber.h
Expand Down
4 changes: 1 addition & 3 deletions ecal/core/include/ecal/cimpl/ecal_core_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ extern "C"
/**
* @brief Finalize eCAL API.
*
* @param components_ Defines which component to initialize (not yet supported).
*
* @return Zero if succeeded, 1 if already finalized, -1 if failed.
**/
ECALC_API int eCAL_Finalize(unsigned int components_);
ECALC_API int eCAL_Finalize();

/**
* @brief Check eCAL initialize state.
Expand Down
20 changes: 0 additions & 20 deletions ecal/core/include/ecal/cimpl/ecal_publisher_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,6 @@ extern "C"
**/
ECALC_API int eCAL_Pub_ClearAttribute(ECAL_HANDLE handle_, const char* attr_name_, int attr_name_len_);

/**
* @brief Share topic type.
*
* @param handle_ Publisher handle.
* @param state_ Set type share mode (none zero == share type).
*
* @return None zero if succeeded.
**/
ECALC_API int eCAL_Pub_ShareType(ECAL_HANDLE handle_, int state_);

/**
* @brief Share topic description.
*
* @param handle_ Publisher handle.
* @param state_ Set description share mode (none zero == share description).
*
* @return None zero if succeeded.
**/
ECALC_API int eCAL_Pub_ShareDescription(ECAL_HANDLE handle_, int state_);

/**
* @brief Set the specific topic id.
*
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/include/ecal/ecal_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ namespace eCAL

protected:
std::shared_ptr<eCAL::CServiceClientImpl> m_service_client_impl;
bool m_created;
bool m_created;
};
}
4 changes: 1 addition & 3 deletions ecal/core/include/ecal/ecal_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ namespace eCAL
/**
* @brief Finalize eCAL API.
*
* @param components_ Defines which component to finalize (not yet supported).
*
* @return Zero if succeeded, 1 if already finalized, -1 if failed.
**/
ECAL_API int Finalize(unsigned int components_ = Init::Default);
ECAL_API int Finalize();

/**
* @brief Check eCAL initialize state.
Expand Down
Loading

0 comments on commit e3bb375

Please sign in to comment.