diff --git a/app/meas_cutter/src/config_file_parser.h b/app/meas_cutter/src/config_file_parser.h index 4efa8e3583..e545b80c86 100644 --- a/app/meas_cutter/src/config_file_parser.h +++ b/app/meas_cutter/src/config_file_parser.h @@ -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. @@ -21,7 +21,7 @@ #include #include -#define YAML_CPP_STATIC_DEFINE +//#define YAML_CPP_STATIC_DEFINE // set by CMake #include #include "utils.h" diff --git a/app/meas_cutter/src/utils.h b/app/meas_cutter/src/utils.h index 48736c8f9b..0523391c10 100644 --- a/app/meas_cutter/src/utils.h +++ b/app/meas_cutter/src/utils.h @@ -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. @@ -26,7 +26,7 @@ #include #include -#define YAML_CPP_STATIC_DEFINE +//#define YAML_CPP_STATIC_DEFINE // set by CMake #include "yaml-cpp/yaml.h" #include diff --git a/app/mon/mon_cli/src/ecal_mon_cli.cpp b/app/mon/mon_cli/src/ecal_mon_cli.cpp index 226a29d466..d961546d5d 100644 --- a/app/mon/mon_cli/src/ecal_mon_cli.cpp +++ b/app/mon/mon_cli/src/ecal_mon_cli.cpp @@ -351,15 +351,6 @@ void ProcProto(const std::string& topic_name, int msg_count) // sleep 1000 ms std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - // get topic type - eCAL::SDataTypeInformation topic_info; - eCAL::Registration::GetTopicDataTypeInformation(topic_name, topic_info); - if(topic_info.name.empty()) - { - std::cout << "could not get type name for topic " << topic_name << std::endl; - return; - } - // create dynamic subscribers for receiving and decoding messages and assign callback eCAL::protobuf::CDynamicSubscriber sub(topic_name); std::atomic cnt(msg_count); diff --git a/app/mon/mon_plugins/capnproto_reflection/src/plugin_widget.cpp b/app/mon/mon_plugins/capnproto_reflection/src/plugin_widget.cpp index 77dd0f0124..f028405537 100644 --- a/app/mon/mon_plugins/capnproto_reflection/src/plugin_widget.cpp +++ b/app/mon/mon_plugins/capnproto_reflection/src/plugin_widget.cpp @@ -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. @@ -59,7 +59,7 @@ PluginWidget::PluginWidget(const QString& topic_name, const QString& topic_type, // Add eCAL Callbacks subscriber_.AddReceiveCallback(std::bind(&PluginWidget::onProtoMessageCallback, this, std::placeholders::_2, std::placeholders::_3)); - //subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1)); + subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1)); // Button connections connect(ui_.expand_button, &QPushButton::clicked, [this]() { tree_view_->expandAll(); }); @@ -323,13 +323,13 @@ void PluginWidget::onResume() { // Add eCAL Callbacks subscriber_.AddReceiveCallback(std::bind(&PluginWidget::onProtoMessageCallback, this, std::placeholders::_2, std::placeholders::_3)); - //subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1)); + subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1)); } void PluginWidget::onPause() { subscriber_.RemReceiveCallback(); - //subscriber_.RemErrorCallback(); + subscriber_.RemErrorCallback(); } QWidget* PluginWidget::getWidget() diff --git a/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp b/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp index 31c3d1afb3..8b4c4b13ad 100644 --- a/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp +++ b/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp @@ -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. @@ -59,7 +59,12 @@ PluginWidget::PluginWidget(const QString& topic_name, const QString&, QWidget* p ui_.content_layout->addWidget(frame); // Connect the eCAL Subscriber - subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_2)); + subscriber_.AddReceiveCallback([this](const eCAL::Registration::STopicId& /*topic_id*/, + const eCAL::SDataTypeInformation& /*data_type_info*/, + const eCAL::SReceiveCallbackData& callback_data) + { + ecalMessageReceivedCallback(callback_data); + }); } PluginWidget::~PluginWidget() @@ -67,12 +72,12 @@ PluginWidget::~PluginWidget() subscriber_.RemReceiveCallback(); } -void PluginWidget::ecalMessageReceivedCallback(const struct eCAL::SReceiveCallbackData* callback_data) +void PluginWidget::ecalMessageReceivedCallback(const eCAL::SReceiveCallbackData& callback_data) { std::lock_guard message_lock(message_mutex_); - last_message_ = QByteArray(static_cast(callback_data->buf), callback_data->size); + last_message_ = QByteArray(static_cast(callback_data.buf), callback_data.size); - last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::microseconds(callback_data->time)); + last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::microseconds(callback_data.time)); received_message_counter_++; new_msg_available_ = true; @@ -128,7 +133,13 @@ void PluginWidget::onUpdate() void PluginWidget::onResume() { - subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_2)); + // (Re)Connect the eCAL Subscriber + subscriber_.AddReceiveCallback([this](const eCAL::Registration::STopicId& /*topic_id*/, + const eCAL::SDataTypeInformation& /*data_type_info*/, + const eCAL::SReceiveCallbackData& callback_data) + { + ecalMessageReceivedCallback(callback_data); + }); } void PluginWidget::onPause() diff --git a/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.h b/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.h index d2491849d4..72bd872525 100644 --- a/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.h +++ b/app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.h @@ -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. @@ -63,7 +63,7 @@ private slots: bool new_msg_available_; int received_message_counter_; - void ecalMessageReceivedCallback(const struct eCAL::SReceiveCallbackData* callback_data); + void ecalMessageReceivedCallback(const eCAL::SReceiveCallbackData& callback_data); #if QT_VERSION < QT_VERSION_CHECK(5, 9, 0) static QString bytesToHex(const QByteArray& byte_array, char separator = '\0'); diff --git a/app/mon/mon_plugins/string_reflection/src/plugin_widget.h b/app/mon/mon_plugins/string_reflection/src/plugin_widget.h index ae99943f77..f09c455b1f 100644 --- a/app/mon/mon_plugins/string_reflection/src/plugin_widget.h +++ b/app/mon/mon_plugins/string_reflection/src/plugin_widget.h @@ -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. @@ -56,12 +56,12 @@ private slots: QTextEdit* text_edit_; eCAL::string::CSubscriber subscriber_; - std::string last_message_; - eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_; - std::mutex message_mutex_; + std::string last_message_; + eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_; + std::mutex message_mutex_; - bool new_msg_available_; - int received_message_counter_; + bool new_msg_available_; + int received_message_counter_; void ecalMessageReceivedCallback(const std::string& message, long long publish_timestamp_usecs); }; diff --git a/app/rec/rec_server_core/src/rec_server_impl.cpp b/app/rec/rec_server_core/src/rec_server_impl.cpp index 14e507cf5c..90824dd5af 100644 --- a/app/rec/rec_server_core/src/rec_server_impl.cpp +++ b/app/rec/rec_server_core/src/rec_server_impl.cpp @@ -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. diff --git a/app/util/stop/src/ecal_stop.cpp b/app/util/stop/src/ecal_stop.cpp index a28fc3867a..3928fb5311 100644 --- a/app/util/stop/src/ecal_stop.cpp +++ b/app/util/stop/src/ecal_stop.cpp @@ -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. @@ -46,19 +46,37 @@ int main() } eCAL::Process::SleepMS(500); - // shut down local user processes - std::cout << "--------------------------------------" << std::endl; - std::cout << "Shutdown local eCAL user processes." << std::endl; - std::cout << "--------------------------------------" << std::endl; - eCAL::Util::ShutdownProcesses(); - std::cout << std::endl; + eCAL::Monitoring::SMonitoring monitoring; + eCAL::Monitoring::GetMonitoring(monitoring, eCAL::Monitoring::Entity::Process); + const std::string host_name(eCAL::Process::GetHostName()); - // shut down local eCAL core - std::cout << "--------------------------------------" << std::endl; - std::cout << "Shutdown local eCAL core components." << std::endl; - std::cout << "--------------------------------------" << std::endl; - eCAL::Util::ShutdownCore(); - std::cout << std::endl; + for (const auto& process : monitoring.processes) + { + // filter out eCAL system processes + const std::string uname = process.uname; + if ( (uname != "eCALConfig") + && (uname != "eCALMon") + && (uname != "eCALMon CLI") + && (uname != "eCALMon TUI") + && (uname != "eCALPlay") + && (uname != "eCALPlayGUI") + && (uname != "eCALRec") + && (uname != "eCALRecGUI") + && (uname != "eCALRecClient") + && (uname != "eCALRec-Remote") + && (uname != "eCALRec-Server") + && (uname != "eCALSys") + && (uname != "eCALSysGUI") + && (uname != "eCALSysClient") + && (uname != "eCALSys-Remote") + && (uname != "eCALStop") + && (process.hname == host_name) + ) + { + std::cout << "Stopping process " << process.pname << " (" << process.pid << ")" << std::endl; + eCAL::Util::ShutdownProcess(process.pid); + } + } // finalize eCAL API eCAL::Finalize(); diff --git a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h index 8e20c2036d..3d11703a47 100644 --- a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h +++ b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h @@ -39,7 +39,7 @@ namespace eCAL { namespace hdf5 { - class WriterImpl; + struct WriterImpl; /** * @brief Hdf5 based Writer implementation diff --git a/doc/rst/configuration/runtime_configuration.rst b/doc/rst/configuration/runtime_configuration.rst index 2d7c981380..08ed8f0a88 100644 --- a/doc/rst/configuration/runtime_configuration.rst +++ b/doc/rst/configuration/runtime_configuration.rst @@ -12,7 +12,7 @@ The corresponding structure reflects the configuration file (:ref:`configuration Custom types ============ -In order to rule out configuration errors, custom datatypes for IP addresses (IpAddressV4) and sizes (ConstrainedInteger) are introduced. +In order to rule out configuration errors, a custom datatype for IP addresses (IpAddressV4) is introduced. **IpAddressV4:** For assigning an IP address simply assign a string with the desired address. Decimal and hexadecimal format is supported. @@ -25,17 +25,6 @@ The IP address can be used like a normal string object. For example: eCAL::Types::IpAddressV4 ip_address = "192.168.7.1"; // in hex: "C0.A8.7.1" std::cout << ip_address << "\n"; -**ConstrainedInteger**: ConstrainedInteger are specified with a minimum (default: 0), step (default: 1) and maximum (default: maximum of int) value. -In case the assigned value does not fit into the specified limitation, the type will throw a std::invalid_argument exception. - -The size object can be used like a normal integer. - -.. code-block:: c++ - - eCAL::Types::ConstrainedInteger<1024, 512, 8192> size_4mb = 1024 + 6 * 512; - std::cout << size_4mb << "\n"; - -For specifying sizes in the ecal configuration object, refer to the .yaml file or "ecal/config/configuration.h" for the limitations. Global configuration initialization =================================== diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt index 4d5dfb647c..1eeead5727 100644 --- a/ecal/core/CMakeLists.txt +++ b/ecal/core/CMakeLists.txt @@ -479,7 +479,6 @@ set(ecal_c_src src/cimpl/ecal_monitoring_cimpl.cpp src/cimpl/ecal_process_cimpl.cpp src/cimpl/ecal_publisher_cimpl.cpp - src/cimpl/ecal_registration_cimpl.cpp src/cimpl/ecal_server_cimpl.cpp src/cimpl/ecal_subscriber_cimpl.cpp src/cimpl/ecal_time_cimpl.cpp @@ -501,11 +500,19 @@ endif() # public header ###################################### set(ecal_header_cmn - include/ecal/types/logging.h - include/ecal/types/monitoring.h + include/ecal/config/application.h include/ecal/config/configuration.h + include/ecal/config/logging.h + include/ecal/config/monitoring.h include/ecal/config/publisher.h + include/ecal/config/registration.h + include/ecal/config/service.h include/ecal/config/subscriber.h + include/ecal/config/time.h + include/ecal/config/transport_layer.h + include/ecal/config/user_arguments.h + include/ecal/types/logging.h + include/ecal/types/monitoring.h include/ecal/ecal.h include/ecal/ecal_callback.h include/ecal/ecal_config.h @@ -541,7 +548,6 @@ set(ecal_header_cimpl include/ecal/cimpl/ecal_monitoring_cimpl.h include/ecal/cimpl/ecal_process_cimpl.h include/ecal/cimpl/ecal_publisher_cimpl.h - include/ecal/cimpl/ecal_registration_cimpl.h include/ecal/cimpl/ecal_server_cimpl.h include/ecal/cimpl/ecal_service_info_cimpl.h include/ecal/cimpl/ecal_subscriber_cimpl.h @@ -554,6 +560,7 @@ set(ecal_header_cimpl set(ecal_header_msg include/ecal/msg/protobuf/client.h + include/ecal/msg/protobuf/dynamic_json_subscriber.h include/ecal/msg/protobuf/dynamic_publisher.h include/ecal/msg/protobuf/dynamic_subscriber.h include/ecal/msg/protobuf/publisher.h diff --git a/ecal/core/include/ecal/cimpl/ecal_registration_cimpl.h b/ecal/core/include/ecal/cimpl/ecal_registration_cimpl.h deleted file mode 100644 index 7b11172c11..0000000000 --- a/ecal/core/include/ecal/cimpl/ecal_registration_cimpl.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================= eCAL LICENSE ================================= - * - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ========================= eCAL LICENSE ================================= -*/ - -/** - * @file ecal_registration_cimpl.h - * @brief eCAL registration c interface -**/ - -#ifndef ecal_registration_cimpl_h_included -#define ecal_registration_cimpl_h_included - -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif /*__cplusplus*/ - /** - * @brief Gets type name of the specified topic. - * - * @param topic_name_ Topic name. - * @param [out] topic_type_ Pointer to store the type name information. - * @param topic_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetTopicTypeName(const char* topic_name_, void* topic_type_, int topic_type_len_); - - /** - * @brief Gets encoding of the specified topic. - * - * @param topic_name_ Topic name. - * @param [out] topic_encoding_ Pointer to store the encoding information. - * @param topic_encoding__len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetTopicEncoding(const char* topic_name_, void* topic_encoding_, int topic_encoding_len_); - - /** - * @brief Gets type description of the specified topic. - * - * @param topic_name_ Topic name. - * @param [out] topic_desc_ Pointer to store the type description0 information. - * @param topic_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetTopicDescription(const char* topic_name_, void* topic_desc_, int topic_desc_len_); - - /** - * @brief Gets service method request type name. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param [out] req_type_ Pointer to store the request type. - * @param req_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetServiceRequestTypeName(const char* service_name_, const char* method_name_, void* req_type_, int req_type_len_); - - /** - * @brief Gets service method response type name. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param [out] resp_type_ Pointer to store the response type. - * @param resp_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetServiceResponseTypeName(const char* service_name_, const char* method_name_, void* resp_type_, int resp_type_len_); - - /** - * @brief Gets service method request description. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param [out] req_desc_ Pointer to store the request description. - * @param req_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Request description buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetServiceRequestDescription(const char* service_name_, const char* method_name_, void* req_desc_, int req_desc_len_); - - /** - * @brief Gets service method response description. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param [out] resp_desc_ Pointer to store the response description. - * @param resp_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Response description buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetServiceResponseDescription(const char* service_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_); - - /** - * @brief Gets client method request type name. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param [out] req_type_ Pointer to store the request type. - * @param req_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetClientRequestTypeName(const char* client_name_, const char* method_name_, void* req_type_, int req_type_len_); - - /** - * @brief Gets client method response type name. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param [out] resp_type_ Pointer to store the response type. - * @param resp_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * - * @return Type name buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetClientResponseTypeName(const char* client_name_, const char* method_name_, void* resp_type_, int resp_type_len_); - - /** - * @brief Gets client method request description. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param [out] req_desc_ Pointer to store the request description. - * @param req_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Request description buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetClientRequestDescription(const char* client_name_, const char* method_name_, void* req_desc_, int req_desc_len_); - - /** - * @brief Gets client method response description. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param [out] resp_desc_ Pointer to store the response description. - * @param resp_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if - * eCAL should allocate the buffer for you (see eCAL_FreeMem). - * - * @return Response description buffer length or zero if failed. - **/ - ECALC_API int eCAL_Registration_GetClientResponseDescription(const char* client_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_); -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif /*ecal_registration_cimpl_h_included*/ diff --git a/ecal/core/include/ecal/cimpl/ecal_util_cimpl.h b/ecal/core/include/ecal/cimpl/ecal_util_cimpl.h index 843c298039..96d011a892 100644 --- a/ecal/core/include/ecal/cimpl/ecal_util_cimpl.h +++ b/ecal/core/include/ecal/cimpl/ecal_util_cimpl.h @@ -49,11 +49,6 @@ extern "C" * @brief Send shutdown event to all local user processes. **/ ECALC_API void eCAL_Util_ShutdownProcesses(); - - /** - * @brief Send shutdown event to all local core components. - **/ - ECALC_API void eCAL_Util_ShutdownCore(); #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/ecal/core/include/ecal/config/publisher.h b/ecal/core/include/ecal/config/publisher.h index 7ab4316a6e..1b1874d0d5 100644 --- a/ecal/core/include/ecal/config/publisher.h +++ b/ecal/core/include/ecal/config/publisher.h @@ -105,14 +105,14 @@ namespace eCAL { struct Configuration { - bool enable { true }; //!< enable layer + bool enable { true }; //!< enable layer - bool zero_copy_mode { false }; //!< Enable zero copy shared memory transport mode - unsigned int acknowledge_timeout_ms { 0U }; /*!< Force connected subscribers to send acknowledge event after processing the message. - The publisher send call is blocked on this event with this timeout (0 == no handshake).*/ - unsigned int memfile_buffer_count { 1U }; /*!< Maximum number of used buffers (needs to be greater than 1, default = 1) */ - Types::ConstrainedInteger<4096, 4096> memfile_min_size_bytes { 4096 }; //!< Default memory file size for new publisher (Default: 4096) - Types::ConstrainedInteger<50, 1, 100> memfile_reserve_percent { 50 }; //!< Dynamic file size reserve before recreating memory file if topic size changes (Default: 50) + bool zero_copy_mode { false }; //!< Enable zero copy shared memory transport mode + unsigned int acknowledge_timeout_ms { 0U }; /*!< Force connected subscribers to send acknowledge event after processing the message. + The publisher send call is blocked on this event with this timeout (0 == no handshake).*/ + unsigned int memfile_buffer_count { 1U }; /*!< Maximum number of used buffers (needs to be greater than 1, default = 1) */ + unsigned int memfile_min_size_bytes { 4096 }; //!< Default memory file size for new publisher (Default: 4096) + unsigned int memfile_reserve_percent { 50 }; //!< Dynamic file size reserve before recreating memory file if topic size changes (Default: 50) }; } diff --git a/ecal/core/include/ecal/config/transport_layer.h b/ecal/core/include/ecal/config/transport_layer.h index b22866056e..0a30caedc2 100644 --- a/ecal/core/include/ecal/config/transport_layer.h +++ b/ecal/core/include/ecal/config/transport_layer.h @@ -55,24 +55,23 @@ namespace eCAL struct Configuration { - Types::UdpConfigVersion config_version { Types::UdpConfigVersion::V2 }; /*!< UDP configuration version (Since eCAL 5.12.) - v1: default behavior - v2: new behavior, comes with a bit more intuitive handling regarding masking of the groups (Default: v2) */ - unsigned int port { 14002 }; /*!< UDP multicast port number (Default: 14002) */ - Types::UDPMode mode { Types::UDPMode::LOCAL }; /*!< Valid modes: local, network (Default: local)*/ - Types::IpAddressV4 mask { "255.255.255.240" }; /*!< v1: Mask maximum number of dynamic multicast group (Default: 0.0.0.1-0.0.0.255) - v2: masks are now considered like routes masking (Default: 255.0.0.0-255.255.255.255)*/ - - // TODO PG: are these minimum limits correct? - Types::ConstrainedInteger<5242880, 1024> send_buffer { 5242880 }; //!< UDP send buffer in bytes (Default: 5242880) - Types::ConstrainedInteger<5242880, 1024> receive_buffer { 5242880 }; //!< UDP receive buffer in bytes (Default: 5242880) - bool join_all_interfaces { false }; /*!< Linux specific setting to enable joining multicast groups on all network interfacs - independent of their link state. Enabling this makes sure that eCAL processes - receive data if they are started before network devices are up and running. (Default: false)*/ - bool npcap_enabled { false }; //!< Enable to receive UDP traffic with the Npcap based receiver (Default: false) + Types::UdpConfigVersion config_version { Types::UdpConfigVersion::V2 }; /*!< UDP configuration version (Since eCAL 5.12.) + v1: default behavior + v2: new behavior, comes with a bit more intuitive handling regarding masking of the groups (Default: v2) */ + unsigned int port { 14002 }; /*!< UDP multicast port number (Default: 14002) */ + Types::UDPMode mode { Types::UDPMode::LOCAL }; /*!< Valid modes: local, network (Default: local)*/ + Types::IpAddressV4 mask { "255.255.255.240" }; /*!< v1: Mask maximum number of dynamic multicast group (Default: 0.0.0.1-0.0.0.255) + v2: masks are now considered like routes masking (Default: 255.0.0.0-255.255.255.255)*/ + + unsigned int send_buffer { 5242880 }; //!< UDP send buffer in bytes (Default: 5242880) + unsigned int receive_buffer { 5242880 }; //!< UDP receive buffer in bytes (Default: 5242880) + bool join_all_interfaces { false }; /*!< Linux specific setting to enable joining multicast groups on all network interfacs + independent of their link state. Enabling this makes sure that eCAL processes + receive data if they are started before network devices are up and running. (Default: false)*/ + bool npcap_enabled { false }; //!< Enable to receive UDP traffic with the Npcap based receiver (Default: false) - Network::Configuration network; - const Local::Configuration local; + Network::Configuration network; + const Local::Configuration local; ECAL_API Configuration& operator=(const Configuration& other); }; diff --git a/ecal/core/include/ecal/config/user_arguments.h b/ecal/core/include/ecal/config/user_arguments.h index a5af144620..50eb06d211 100644 --- a/ecal/core/include/ecal/config/user_arguments.h +++ b/ecal/core/include/ecal/config/user_arguments.h @@ -35,7 +35,7 @@ namespace eCAL struct Configuration { std::string user_yaml { "" }; //!< The used eCAL yaml file (Default: "") - bool dump_config { false }; //!< If specified, output configuration via standart output (Default: false) + bool dump_config { false }; //!< If specified, output configuration via standard output (Default: false) }; } } \ No newline at end of file diff --git a/ecal/core/include/ecal/ecal_registration.h b/ecal/core/include/ecal/ecal_registration.h index 4222efa840..b477441273 100644 --- a/ecal/core/include/ecal/ecal_registration.h +++ b/ecal/core/include/ecal/ecal_registration.h @@ -38,50 +38,6 @@ namespace eCAL { namespace Registration { - // enumeration of quality bits used for detecting how good a data information is - enum class DescQualityFlags : std::uint8_t - { - NO_QUALITY = 0, //!< Special value for initialization - DESCRIPTION_AVAILABLE = 0x1 << 3, //!< Having a type descriptor available - ENCODING_AVAILABLE = 0x1 << 2, //!< Having a type encoding - TYPENAME_AVAILABLE = 0x1 << 1, //!< Having a type name available - INFO_COMES_FROM_PRODUCER = 0x1 << 0 //!< Info is coming from the producer (like a publisher, service) - }; - - constexpr inline DescQualityFlags operator~ (DescQualityFlags a) { return static_cast( ~static_cast::type>(a) ); } - constexpr inline DescQualityFlags operator| (DescQualityFlags a, DescQualityFlags b) { return static_cast( static_cast::type>(a) | static_cast::type>(b) ); } - constexpr inline DescQualityFlags operator& (DescQualityFlags a, DescQualityFlags b) { return static_cast( static_cast::type>(a) & static_cast::type>(b) ); } - constexpr inline DescQualityFlags operator^ (DescQualityFlags a, DescQualityFlags b) { return static_cast( static_cast::type>(a) ^ static_cast::type>(b) ); } - inline DescQualityFlags& operator|= (DescQualityFlags& a, DescQualityFlags b) { return reinterpret_cast( reinterpret_cast::type&>(a) |= static_cast::type>(b) ); } - inline DescQualityFlags& operator&= (DescQualityFlags& a, DescQualityFlags b) { return reinterpret_cast( reinterpret_cast::type&>(a) &= static_cast::type>(b) ); } - inline DescQualityFlags& operator^= (DescQualityFlags& a, DescQualityFlags b) { return reinterpret_cast( reinterpret_cast::type&>(a) ^= static_cast::type>(b) ); } - - using TopicId = std::uint64_t; - struct SQualityTopicInfo - { - SDataTypeInformation info; - DescQualityFlags quality = DescQualityFlags::NO_QUALITY; - - bool operator<(const SQualityTopicInfo& other) const - { - return std::tie(quality, info) < std::tie(other.quality, info); - } - }; - using QualityTopicInfoMultiMap = std::multimap; - using QualityTopicInfoSet = std::set; - - using ServiceId = std::uint64_t; - struct SQualityServiceInfo - { - SServiceMethodInformation info; - DescQualityFlags request_quality = DescQualityFlags::NO_QUALITY; - DescQualityFlags response_quality = DescQualityFlags::NO_QUALITY; - - bool operator<(const SQualityServiceInfo& other) const - { - return std::tie(request_quality, response_quality) < std::tie(other.request_quality, other.response_quality); - } - }; struct SServiceMethod { std::string service_name; @@ -92,8 +48,6 @@ namespace eCAL return std::tie(service_name, method_name) < std::tie(other.service_name, other.method_name); } }; - using QualityServiceInfoMultimap = std::multimap; - using SQualityServiceInfoSet = std::set; using CallbackToken = std::size_t; @@ -104,7 +58,7 @@ namespace eCAL }; using TopicIDCallbackT = std::function; - using ServiceIDCallbackT = std::function; + using ServiceIDCallbackT = std::function; /** * @brief Get complete snapshot of all known publisher. @@ -118,7 +72,7 @@ namespace eCAL * * @return True if information could be queried. **/ - ECAL_API bool GetPublisherInfo(const STopicId& id_, SQualityTopicInfo& topic_info_); + ECAL_API bool GetPublisherInfo(const STopicId& id_, SDataTypeInformation& topic_info_); /** * @brief Register a callback function to be notified when a new publisher becomes available. @@ -150,7 +104,7 @@ namespace eCAL * * @return True if information could be queried. **/ - ECAL_API bool GetSubscriberInfo(const STopicId& id_, SQualityTopicInfo& topic_info_); + ECAL_API bool GetSubscriberInfo(const STopicId& id_, SDataTypeInformation& topic_info_); /** * @brief Register a callback function to be notified when a new subscriber becomes available. @@ -175,108 +129,28 @@ namespace eCAL * * @return Set of service id's. **/ - ECAL_API std::set GetServiceIDs(); + ECAL_API std::set GetServiceIDs(); /** * @brief Get service method information with quality for specific service. * * @return True if information could be queried. **/ - ECAL_API bool GetServiceInfo(const SServiceId& id_, SQualityServiceInfo& service_info_); + ECAL_API bool GetServiceInfo(const SServiceMethodId& id_, SServiceMethodInformation& service_method_info_); /** * @brief Get complete snapshot of all known clients. * * @return Set of service id's. **/ - ECAL_API std::set GetClientIDs(); + ECAL_API std::set GetClientIDs(); /** * @brief Get service method information with quality for specific client. * * @return True if information could be queried. **/ - ECAL_API bool GetClientInfo(const SServiceId& id_, SQualityServiceInfo& service_info_); - - /** - * @brief Get complete snapshot of data type information with quality and topic id for all known publisher. - * - * @return MultiMap containing the quality datatype information and the topic id's. - **/ - ECAL_API QualityTopicInfoMultiMap GetPublishers(); - - /** - * @brief Get data type information with quality and topic id for this publishers. - * - * @param topic_name_ Topic name. - * - * @return Set containing the quality datatype information for this publisher. - **/ - ECAL_API QualityTopicInfoSet GetPublishers(const std::string& topic_name_); - - /** - * @brief Get complete snapshot of data type information with quality and topic id for all known subscribers. - * - * @return MultiMap containing the quality datatype information and the topic id's. - **/ - ECAL_API QualityTopicInfoMultiMap GetSubscribers(); - - /** - * @brief Get data type information with quality and topic id for this subscriber. - * - * @param topic_name_ Topic name. - * - * @return Set containing the quality datatype information for this subscriber. - **/ - ECAL_API QualityTopicInfoSet GetSubscribers(const std::string& topic_name_); - - /** - * @brief Get highest quality data type information out of a set of quality data type information. - * - * @param quality_topic_info_set_ Set of quality data type information - * - * @return Highest quality data type information. - **/ - ECAL_API SDataTypeInformation GetHighestQualityDataTypeInformation(const QualityTopicInfoSet& quality_topic_info_set_); - - /** - * @brief Get complete snapshot of service method information with quality and service id for all known services. - * - * @return MultiMap containing the quality datatype information and the service id's. - **/ - ECAL_API QualityServiceInfoMultimap GetServices(); - - /** - * @brief Get complete snapshot of service method information with quality and client id for all known clients. - * - * @return MultiMap containing the quality datatype information and the client id's. - **/ - ECAL_API QualityServiceInfoMultimap GetClients(); - - /** - * @brief Get highest quality service method type information out of a set of quality service method information. - * - * @param quality_service_info_set_ Set of quality service method information - * - * @return Highest quality service method information. - **/ - ECAL_API SServiceMethodInformation GetHighestQualityServiceMethodInformation(const SQualityServiceInfoSet& quality_service_info_set_); - - /** - * @brief Get complete topic map. - * - * @param data_type_info_map_ Map to store the datatype information. - * Map { TopicName -> SDataTypeInformation } mapping of all currently known publisher/subscriber. - **/ - ECAL_API void GetTopics(std::map& data_type_info_map_); - - /** - * @brief Get complete quality topic map. - * - * @param quality_topic_info_map_ Map to store the quality datatype information. - * Map { TopicName -> SQualityDataTypeInformation } mapping of all currently known publisher/subscriber. - **/ - ECAL_API void GetTopics(std::map& quality_topic_info_map_); + ECAL_API bool GetClientInfo(const SServiceMethodId& id_, SServiceMethodInformation& service_method_info_); /** * @brief Get all topic names. @@ -285,32 +159,6 @@ namespace eCAL **/ ECAL_API void GetTopicNames(std::set& topic_names_); - /** - * @brief Gets description of the specified topic. - * - * @param topic_name_ Topic name. - * @param data_type_info_ SDataTypeInformation to be filled by this function. - * - * @return True if TopicInformation for specified topic could be retrieved, false otherwise. - **/ - ECAL_API bool GetTopicDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& data_type_info_); - - /** - * @brief Get complete service map. - * - * @param service_method_info_map_ Map to store the service/method descriptions. - * Map { (ServiceName, MethodName) -> SServiceMethodInformation } mapping of all currently known services. - **/ - ECAL_API void GetServices(std::map& service_method_info_map_); - - /** - * @brief Get complete quality service map. - * - * @param quality_service_info_map_ Map to store the quality service/method descriptions. - * Map { (ServiceName, MethodName) -> SQualityServiceMethodInformation } mapping of all currently known services. - **/ - ECAL_API void GetServices(std::map& quality_service_info_map_); - /** * @brief Get all service/method names. * @@ -318,75 +166,11 @@ namespace eCAL **/ ECAL_API void GetServiceMethodNames(std::set& service_method_names_); - /** - * @brief Gets service method request and response type names. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param req_type_ String to store request type. - * @param resp_type_ String to store response type. - * - * @return True if succeeded. - **/ - ECAL_API bool GetServiceTypeNames(const std::string& service_name_, const std::string& method_name_, std::string& req_type_, std::string& resp_type_); - - /** - * @brief Gets service method request and response descriptions. - * - * @param service_name_ Service name. - * @param method_name_ Method name. - * @param req_desc_ String to store request description. - * @param resp_desc_ String to store response description. - * - * @return True if succeeded. - **/ - ECAL_API bool GetServiceDescription(const std::string& service_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_); - - /** - * @brief Get complete client map. - * - * @param client_method_info_map_ Map to store the client/method descriptions. - * Map { (ClientName, MethodName) -> SServiceMethodInformation } mapping of all currently known clients. - **/ - ECAL_API void GetClients(std::map& client_method_info_map_); - - /** - * @brief Get complete quality client map. - * - * @param quality_client_info_map_ Map to store the quality client/method descriptions. - * Map { (ClientName, MethodName) -> SQualityServiceMethodInformation } mapping of all currently known clients. - **/ - ECAL_API void GetClients(std::map& quality_client_info_map_); - /** * @brief Get all client/method names. * * @param client_method_names_ Set to store the client/method names (Set { (ClientName, MethodName) }). **/ ECAL_API void GetClientMethodNames(std::set& client_method_names_); - - /** - * @brief Gets client method request and response type names. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param req_type_ String to store request type. - * @param resp_type_ String to store response type. - * - * @return True if succeeded. - **/ - ECAL_API bool GetClientTypeNames(const std::string& client_name_, const std::string& method_name_, std::string& req_type_, std::string& resp_type_); - - /** - * @brief Gets client method request and response descriptions. - * - * @param client_name_ Client name. - * @param method_name_ Method name. - * @param req_desc_ String to store request description. - * @param resp_desc_ String to store response description. - * - * @return True if succeeded. - **/ - ECAL_API bool GetClientDescription(const std::string& client_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_); } } diff --git a/ecal/core/include/ecal/ecal_types.h b/ecal/core/include/ecal/ecal_types.h index 00d1640898..8da22ad5c8 100644 --- a/ecal/core/include/ecal/ecal_types.h +++ b/ecal/core/include/ecal/ecal_types.h @@ -151,18 +151,18 @@ namespace eCAL return os; } - struct SServiceId + struct SServiceMethodId { SEntityId service_id; std::string service_name; std::string method_name; - bool operator==(const SServiceId& other) const + bool operator==(const SServiceMethodId& other) const { return service_id == other.service_id && service_name == other.service_name && method_name == other.method_name; } - bool operator<(const SServiceId& other) const + bool operator<(const SServiceMethodId& other) const { return std::tie(service_id, service_name, method_name) < std::tie(other.service_id, other.service_name, other.method_name); } diff --git a/ecal/core/include/ecal/ecal_util.h b/ecal/core/include/ecal/ecal_util.h index 82278b73b0..eb0dd0facb 100644 --- a/ecal/core/include/ecal/ecal_util.h +++ b/ecal/core/include/ecal/ecal_util.h @@ -87,11 +87,6 @@ namespace eCAL **/ ECAL_API void ShutdownProcesses(); - /** - * @brief Send shutdown event to all local core components. - **/ - ECAL_API void ShutdownCore(); - /** * @brief Splits the topic type (eCAL < 5.12) into encoding and types (>= eCAL 5.12) * diff --git a/ecal/core/include/ecal/ecalc.h b/ecal/core/include/ecal/ecalc.h index b9ff42d094..b1a212f923 100644 --- a/ecal/core/include/ecal/ecalc.h +++ b/ecal/core/include/ecal/ecalc.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/ecal/core/include/ecal/msg/dynamic.h b/ecal/core/include/ecal/msg/dynamic.h index 1d09b6df4c..ff2bde729e 100644 --- a/ecal/core/include/ecal/msg/dynamic.h +++ b/ecal/core/include/ecal/msg/dynamic.h @@ -84,7 +84,6 @@ namespace eCAL * @param topic_name_ Unique topic name. **/ CDynamicMessageSubscriber(const std::string& topic_name_) : CSubscriber() - , m_topic_name(topic_name_) , m_deserializer() { CSubscriber::Create(topic_name_); @@ -110,7 +109,6 @@ namespace eCAL **/ CDynamicMessageSubscriber(CDynamicMessageSubscriber&& rhs) : CSubscriber(std::move(rhs)) - , m_topic_name(std::move(rhs.m_topic_name)) , m_cb_callback(std::move(rhs.m_cb_callback)) , m_deserializer(std::move(rhs.m_deserializer)) { @@ -141,52 +139,16 @@ namespace eCAL return(CSubscriber::Destroy()); } - /** - * @brief Receive deserialized message. - * - * @param [out] time_ Optional receive time stamp. - * @param rcv_timeout_ Receive timeout in ms. - * - * @return std::optional which holds the value if a value could be received, and std::nullopt if it couldn't. - **/ - // Do we want to call error callbacks on receive? Probably not! std::expected wouuld be a good thing to return the reason why things went wrong. - std::optional Receive(long long* time_ = nullptr, int rcv_timeout_ = 0) - { - std::string rec_buf; - bool success = CSubscriber::ReceiveBuffer(rec_buf, time_, rcv_timeout_); - if (!success) - { - return std::nullopt; - } - // In the future, I would like to get m_datatype_info from the ReceiveBuffer function! - - PopulateDatatypeInfo(); - // We can't possibly receive anything if we don't have datatype info available - if (!m_datatype_info_received) - { - return std::nullopt; - } - - try - { - return(m_deserializer.Deserialize(rec_buf.c_str(), rec_buf.size(), m_datatype_info_received.value())); - } - catch (const DynamicReflectionException& /*e*/) - { - return std::nullopt; - } - } - /** * @brief eCAL message receive callback function * - * @param topic_name_ Topic name of the data source (publisher). - * @param msg_ Message content. - * @param time_ Message time stamp. - * @param clock_ Message writer clock. - * @param id_ Message id. + * @param topic_id_ Topic id of the data source (publisher). + * @param msg_ Message content. + * @param time_ Message time stamp. + * @param clock_ Message writer clock. + * @param id_ Message id. **/ - using MsgReceiveCallbackT = std::function; + using MsgReceiveCallbackT = std::function; /** * @brief Add receive callback for incoming messages. @@ -203,7 +165,8 @@ namespace eCAL std::lock_guard callback_lock(m_cb_callback_mutex); m_cb_callback = callback_; } - auto callback = std::bind(&CDynamicMessageSubscriber::ReceiveCallback, this, std::placeholders::_1, std::placeholders::_2); + + ReceiveIDCallbackT callback = std::bind(&CDynamicMessageSubscriber::ReceiveCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); return(CSubscriber::AddReceiveCallback(callback)); } @@ -258,7 +221,7 @@ namespace eCAL } private: - void ReceiveCallback(const char* topic_name_, const struct eCAL::SReceiveCallbackData* data_) + void ReceiveCallback(const Registration::STopicId& topic_id_, const SDataTypeInformation& topic_info_, const struct SReceiveCallbackData& data_) { MsgReceiveCallbackT fn_callback = nullptr; { @@ -268,19 +231,10 @@ namespace eCAL if (fn_callback == nullptr) return; - PopulateDatatypeInfo(); - - if (!m_datatype_info_received) - { - CallErrorCallback("Dynamic Deserialization: No Prototype available."); - return; - } - try { - // In the future, I would like to get m_datatype_info from the ReceiveBuffer function! - auto msg = m_deserializer.Deserialize(data_->buf, data_->size, m_datatype_info_received.value()); - fn_callback(topic_name_, msg, data_->time, data_->clock, data_->id); + auto msg = m_deserializer.Deserialize(data_.buf, data_.size, topic_info_); + fn_callback(topic_id_, msg, data_.time, data_.clock, data_.id); } catch (const DynamicReflectionException& e) { @@ -288,20 +242,6 @@ namespace eCAL } } - void PopulateDatatypeInfo() - { - if (!m_datatype_info_received) - { - SDataTypeInformation datatype_info_received; - auto received_info = eCAL::Registration::GetTopicDataTypeInformation(m_topic_name, datatype_info_received); - // empty datatype informations are not valid to do reflection on! - if (received_info && datatype_info_received != SDataTypeInformation{}) - { - m_datatype_info_received = datatype_info_received; - } - } - } - void CallErrorCallback(const std::string& message) { ErrorCallbackT error_callback = nullptr; @@ -315,13 +255,11 @@ namespace eCAL } } - std::string m_topic_name; - std::mutex m_cb_callback_mutex; - MsgReceiveCallbackT m_cb_callback; - std::mutex m_error_callback_mutex; - ErrorCallbackT m_error_callback; - DynamicDeserializer m_deserializer; - std::optional m_datatype_info_received = std::nullopt; + std::mutex m_cb_callback_mutex; + MsgReceiveCallbackT m_cb_callback; + std::mutex m_error_callback_mutex; + ErrorCallbackT m_error_callback; + DynamicDeserializer m_deserializer; }; } diff --git a/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h b/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h index aa0d236983..fca3ba4632 100644 --- a/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h +++ b/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h @@ -63,7 +63,7 @@ namespace eCAL public: std::string Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_) { - google::protobuf::util::JsonOptions options; + google::protobuf::util::JsonPrintOptions options; #if GOOGLE_PROTOBUF_VERSION >= 5026000 options.always_print_fields_with_no_presence = true; #else diff --git a/ecal/core/include/ecal/types/ecal_custom_data_types.h b/ecal/core/include/ecal/types/ecal_custom_data_types.h index 00ab7b7cbd..6907519f1f 100644 --- a/ecal/core/include/ecal/types/ecal_custom_data_types.h +++ b/ecal/core/include/ecal/types/ecal_custom_data_types.h @@ -66,43 +66,6 @@ namespace eCAL std::string m_ip_address{}; }; - /** - * @brief Template class to specify sizes with a concrete minimum, maximum and step size definition. - * - * @tparam MIN Optional minimum possible size. Default: 0 - * @tparam STEP Optional step size. Default: 1 - * @tparam MAX Optional maximum possible size. Default: std::numeric_limits::max() - * - * @param size_ Optional size value. If not set, ConstrainedInteger will return the MIN value. - * - * @throws std::invalid_argument exception. - **/ - template::max()> - class ConstrainedInteger - { - public: - ConstrainedInteger(int size_ = MIN) - { - if (size_ >= MIN && size_ <= MAX && size_ % STEP == 0 && MAX >= MIN) - { - m_size = size_; - } - else - { - throw std::invalid_argument("[ConstrainedInteger] Faulty size configuration or assignment. MIN: " + std::to_string(MIN) + " MAX: " + std::to_string(MAX) + " STEP: " + std::to_string(STEP) + " VALUE:" + std::to_string(size_)); - } - }; - - operator int() const { return m_size; }; - bool operator==(const ConstrainedInteger& other) const { return this->m_size == other; }; - bool operator==(const unsigned int value) const { return this->m_size == static_cast(value); }; - bool operator==(const int value) const { return this->m_size == value; }; - - - private: - int m_size{}; - }; - enum class UdpConfigVersion { V1 = 1, diff --git a/ecal/core/src/cimpl/ecal_registration_cimpl.cpp b/ecal/core/src/cimpl/ecal_registration_cimpl.cpp deleted file mode 100644 index b01590e934..0000000000 --- a/ecal/core/src/cimpl/ecal_registration_cimpl.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* ========================= eCAL LICENSE ================================= - * - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ========================= eCAL LICENSE ================================= -*/ - -/** - * @file ecal_registration_cimpl.cpp - * @brief eCAL registration c interface -**/ - -#include -#include - -#include "ecal_common_cimpl.h" - -extern "C" -{ - ECALC_API int eCAL_Registration_GetTopicTypeName(const char* topic_name_, void* topic_type_, int topic_type_len_) - { - if (topic_name_ == nullptr) return(0); - if (topic_type_ == nullptr) return(0); - eCAL::SDataTypeInformation topic_info; - if (eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info)) - { - return(CopyBuffer(topic_type_, topic_type_len_, topic_info.name)); - } - return(0); - } - - ECALC_API int eCAL_Registration_GetTopicEncoding(const char* topic_name_, void* topic_encoding_, int topic_encoding_len_) - { - if (topic_name_ == nullptr) return(0); - if (topic_encoding_ == nullptr) return(0); - eCAL::SDataTypeInformation topic_info; - if (eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info)) - { - return(CopyBuffer(topic_encoding_, topic_encoding_len_, topic_info.encoding)); - } - return(0); - } - - ECALC_API int eCAL_Registration_GetTopicDescription(const char* topic_name_, void* topic_desc_, int topic_desc_len_) - { - if (topic_name_ == nullptr) return(0); - if (topic_desc_ == nullptr) return(0); - eCAL::SDataTypeInformation topic_info; - if (eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info)) - { - return(CopyBuffer(topic_desc_, topic_desc_len_, topic_info.descriptor)); - } - return(0); - } - - ECALC_API int eCAL_Registration_GetServiceRequestTypeName(const char* service_name_, const char* method_name_, void* req_type_, int req_type_len_) - { - if (service_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (req_type_ == nullptr) return(0); - std::string req_type; - std::string resp_type; - if (eCAL::Registration::GetServiceTypeNames(service_name_, method_name_, req_type, resp_type)) - { - return(CopyBuffer(req_type_, req_type_len_, req_type)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetServiceResponseTypeName(const char* service_name_, const char* method_name_, void* resp_type_, int resp_type_len_) - { - if (service_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (resp_type_ == nullptr) return(0); - std::string req_type; - std::string resp_type; - if (eCAL::Registration::GetServiceTypeNames(service_name_, method_name_, req_type, resp_type)) - { - return(CopyBuffer(resp_type_, resp_type_len_, resp_type)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetServiceRequestDescription(const char* service_name_, const char* method_name_, void* req_desc_, int req_desc_len_) - { - if (service_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (req_desc_ == nullptr) return(0); - std::string req_desc; - std::string resp_desc; - if (eCAL::Registration::GetServiceDescription(service_name_, method_name_, req_desc, resp_desc)) - { - return(CopyBuffer(req_desc_, req_desc_len_, req_desc)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetServiceResponseDescription(const char* service_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_) - { - if (service_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (resp_desc_ == nullptr) return(0); - std::string req_desc; - std::string resp_desc; - if (eCAL::Registration::GetServiceDescription(service_name_, method_name_, req_desc, resp_desc)) - { - return(CopyBuffer(resp_desc_, resp_desc_len_, resp_desc)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetClientRequestTypeName(const char* client_name_, const char* method_name_, void* req_type_, int req_type_len_) - { - if (client_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (req_type_ == nullptr) return(0); - std::string req_type; - std::string resp_type; - if (eCAL::Registration::GetClientTypeNames(client_name_, method_name_, req_type, resp_type)) - { - return(CopyBuffer(req_type_, req_type_len_, req_type)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetClientResponseTypeName(const char* client_name_, const char* method_name_, void* resp_type_, int resp_type_len_) - { - if (client_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (resp_type_ == nullptr) return(0); - std::string req_type; - std::string resp_type; - if (eCAL::Registration::GetClientTypeNames(client_name_, method_name_, req_type, resp_type)) - { - return(CopyBuffer(resp_type_, resp_type_len_, resp_type)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetClientRequestDescription(const char* client_name_, const char* method_name_, void* req_desc_, int req_desc_len_) - { - if (client_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (req_desc_ == nullptr) return(0); - std::string req_desc; - std::string resp_desc; - if (eCAL::Registration::GetClientDescription(client_name_, method_name_, req_desc, resp_desc)) - { - return(CopyBuffer(req_desc_, req_desc_len_, req_desc)); - } - return 0; - } - - ECALC_API int eCAL_Registration_GetClientResponseDescription(const char* client_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_) - { - if (client_name_ == nullptr) return(0); - if (method_name_ == nullptr) return(0); - if (resp_desc_ == nullptr) return(0); - std::string req_desc; - std::string resp_desc; - if (eCAL::Registration::GetClientDescription(client_name_, method_name_, req_desc, resp_desc)) - { - return(CopyBuffer(resp_desc_, resp_desc_len_, resp_desc)); - } - return 0; - } -} diff --git a/ecal/core/src/cimpl/ecal_util_cimpl.cpp b/ecal/core/src/cimpl/ecal_util_cimpl.cpp index 59a1ce7526..16136ea3e5 100644 --- a/ecal/core/src/cimpl/ecal_util_cimpl.cpp +++ b/ecal/core/src/cimpl/ecal_util_cimpl.cpp @@ -45,10 +45,5 @@ extern "C" { eCAL::Util::ShutdownProcesses(); } - - ECALC_API void eCAL_Util_ShutdownCore() - { - eCAL::Util::ShutdownCore(); - } #endif // ECAL_CORE_MONITORING } diff --git a/ecal/core/src/config/configuration_to_yaml.cpp b/ecal/core/src/config/configuration_to_yaml.cpp index 8cf3f94e35..e49f2d85ff 100644 --- a/ecal/core/src/config/configuration_to_yaml.cpp +++ b/ecal/core/src/config/configuration_to_yaml.cpp @@ -10,14 +10,6 @@ namespace YAML member = node_[key].as(); } - // Operator overload for assigning a ConstrainedInteger to a YAML::Node - template - YAML::Node operator<<(YAML::Node node, const eCAL::Types::ConstrainedInteger& constrainedInt) - { - node = static_cast(constrainedInt); - return node; - } - eCAL_Logging_Filter ParseLogLevel(const std::vector& filter_) { // create excluding filter list @@ -250,8 +242,8 @@ namespace YAML node["mode"] = config_.mode == eCAL::Types::UDPMode::LOCAL ? "local" : "network"; node["port"] = config_.port; node["mask"] = config_.mask.Get(); - node["send_buffer"] << config_.send_buffer; - node["receive_buffer"] << config_.receive_buffer; + node["send_buffer"] = config_.send_buffer; + node["receive_buffer"] = config_.receive_buffer; node["join_all_interfaces"] = config_.join_all_interfaces; node["npcap_enabled"] = config_.npcap_enabled; node["network"] = config_.network; @@ -308,8 +300,8 @@ namespace YAML node["zero_copy_mode"] = config_.zero_copy_mode; node["acknowledge_timeout_ms"] = config_.acknowledge_timeout_ms; node["memfile_buffer_count"] = config_.memfile_buffer_count; - node["memfile_min_size_bytes"] << config_.memfile_min_size_bytes; - node["memfile_reserve_percent"] << config_.memfile_reserve_percent; + node["memfile_min_size_bytes"] = config_.memfile_min_size_bytes; + node["memfile_reserve_percent"] = config_.memfile_reserve_percent; return node; } diff --git a/ecal/core/src/ecal_descgate.cpp b/ecal/core/src/ecal_descgate.cpp index 786f28ea97..0a143f0643 100644 --- a/ecal/core/src/ecal_descgate.cpp +++ b/ecal/core/src/ecal_descgate.cpp @@ -27,26 +27,11 @@ namespace { - eCAL::Registration::DescQualityFlags GetDataTypeInfoQuality(const eCAL::SDataTypeInformation& data_type_info_, bool is_producer_) - { - eCAL::Registration::DescQualityFlags quality = eCAL::Registration::DescQualityFlags::NO_QUALITY; - if (!data_type_info_.name.empty()) - quality |= eCAL::Registration::DescQualityFlags::TYPENAME_AVAILABLE; - if (!data_type_info_.encoding.empty()) - quality |= eCAL::Registration::DescQualityFlags::ENCODING_AVAILABLE; - if (!data_type_info_.descriptor.empty()) - quality |= eCAL::Registration::DescQualityFlags::DESCRIPTION_AVAILABLE; - if(is_producer_) quality |= eCAL::Registration::DescQualityFlags::INFO_COMES_FROM_PRODUCER; - return quality; - } - eCAL::Registration::SEntityId ConvertToEntityId(const eCAL::Registration::SampleIdentifier& sample_identifier) { eCAL::Registration::SEntityId id{ sample_identifier.entity_id, sample_identifier.process_id, sample_identifier.host_name}; return id; } - - } namespace eCAL @@ -59,7 +44,7 @@ namespace eCAL return GetTopicIDs(m_publisher_info_map); } - bool CDescGate::GetPublisherInfo(const Registration::STopicId& id_, Registration::SQualityTopicInfo& topic_info_) const + bool CDescGate::GetPublisherInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const { return GetTopic(id_, m_publisher_info_map, topic_info_); } @@ -85,7 +70,7 @@ namespace eCAL return GetTopicIDs(m_subscriber_info_map); } - bool CDescGate::GetSubscriberInfo(const Registration::STopicId& id_, Registration::SQualityTopicInfo& topic_info_) const + bool CDescGate::GetSubscriberInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const { return GetTopic(id_, m_subscriber_info_map, topic_info_); } @@ -106,27 +91,27 @@ namespace eCAL m_subscriber_callback_map.map.erase(token_); } - std::set CDescGate::GetServiceIDs() const + std::set CDescGate::GetServiceIDs() const { return GetServiceIDs(m_service_info_map); } - bool CDescGate::GetServiceInfo(const Registration::SServiceId& id_, Registration::SQualityServiceInfo& service_info_) const + bool CDescGate::GetServiceInfo(const Registration::SServiceMethodId& id_, SServiceMethodInformation& service_info_) const { return GetService(id_, m_service_info_map, service_info_); } - std::set CDescGate::GetClientIDs() const + std::set CDescGate::GetClientIDs() const { return GetServiceIDs(m_client_info_map); } - bool CDescGate::GetClientInfo(const Registration::SServiceId& id_, Registration::SQualityServiceInfo& service_info_) const + bool CDescGate::GetClientInfo(const Registration::SServiceMethodId& id_, SServiceMethodInformation& service_info_) const { return GetService(id_, m_client_info_map, service_info_); } - std::set CDescGate::GetTopicIDs(const SQualityTopicIdMap& topic_info_map_) + std::set CDescGate::GetTopicIDs(const STopicIdInfoMap& topic_info_map_) { std::set topic_id_set; @@ -138,7 +123,7 @@ namespace eCAL return topic_id_set; } - bool CDescGate::GetTopic(const Registration::STopicId& id_, const SQualityTopicIdMap& topic_info_map_, Registration::SQualityTopicInfo& topic_info_) + bool CDescGate::GetTopic(const Registration::STopicId& id_, const STopicIdInfoMap& topic_info_map_, SDataTypeInformation& topic_info_) { const std::lock_guard lock(topic_info_map_.mtx); auto iter = topic_info_map_.map.find(id_); @@ -153,9 +138,9 @@ namespace eCAL } } - std::set CDescGate::GetServiceIDs(const SQualityServiceIdMap& service_method_info_map_) + std::set CDescGate::GetServiceIDs(const SServiceIdInfoMap& service_method_info_map_) { - std::set service_id_set; + std::set service_id_set; const std::lock_guard lock(service_method_info_map_.mtx); for (const auto& service_method_info_map_it : service_method_info_map_.id_map) @@ -165,7 +150,7 @@ namespace eCAL return service_id_set; } - bool CDescGate::GetService(const Registration::SServiceId& id_, const SQualityServiceIdMap& service_method_info_map_, Registration::SQualityServiceInfo& service_method_info_) + bool CDescGate::GetService(const Registration::SServiceMethodId& id_, const SServiceIdInfoMap& service_method_info_map_, SServiceMethodInformation& service_method_info_) { const std::lock_guard lock(service_method_info_map_.mtx); auto iter = service_method_info_map_.id_map.find(id_); @@ -201,7 +186,7 @@ namespace eCAL response_type.name = method.resp_type; response_type.descriptor = method.resp_desc; - ApplyServiceDescription(m_service_info_map, sample_.identifier, sample_.service.sname, method.mname, request_type, response_type, GetDataTypeInfoQuality(request_type, true), GetDataTypeInfoQuality(response_type, true)); + ApplyServiceDescription(m_service_info_map, sample_.identifier, sample_.service.sname, method.mname, request_type, response_type); } } break; @@ -219,20 +204,20 @@ namespace eCAL response_type.name = method.resp_type; response_type.descriptor = method.resp_desc; - ApplyServiceDescription(m_client_info_map, sample_.identifier, sample_.client.sname, method.mname, request_type, response_type, GetDataTypeInfoQuality(request_type, false), GetDataTypeInfoQuality(response_type, false)); + ApplyServiceDescription(m_client_info_map, sample_.identifier, sample_.client.sname, method.mname, request_type, response_type); } break; case bct_unreg_client: RemServiceDescription(m_client_info_map, sample_.identifier, sample_.client.sname); break; case bct_reg_publisher: - ApplyTopicDescription(m_publisher_info_map, m_publisher_callback_map, sample_.identifier, sample_.topic.tname, sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, true)); + ApplyTopicDescription(m_publisher_info_map, m_publisher_callback_map, sample_.identifier, sample_.topic.tname, sample_.topic.tdatatype); break; case bct_unreg_publisher: RemTopicDescription(m_publisher_info_map, m_publisher_callback_map, sample_.identifier, sample_.topic.tname); break; case bct_reg_subscriber: - ApplyTopicDescription(m_subscriber_info_map, m_subscriber_callback_map, sample_.identifier, sample_.topic.tname, sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, false)); + ApplyTopicDescription(m_subscriber_info_map, m_subscriber_callback_map, sample_.identifier, sample_.topic.tname, sample_.topic.tdatatype); break; case bct_unreg_subscriber: RemTopicDescription(m_subscriber_info_map, m_subscriber_callback_map, sample_.identifier, sample_.topic.tname); @@ -245,12 +230,11 @@ namespace eCAL } } - void CDescGate::ApplyTopicDescription(SQualityTopicIdMap& topic_info_map_, + void CDescGate::ApplyTopicDescription(STopicIdInfoMap& topic_info_map_, const STopicIdCallbackMap& topic_callback_map_, const Registration::SampleIdentifier& topic_id_, const std::string& topic_name_, - const SDataTypeInformation& topic_info_, - const Registration::DescQualityFlags topic_quality_) + const SDataTypeInformation& topic_info_) { const auto topic_info_key = Registration::STopicId{ ConvertToEntityId(topic_id_), topic_name_ }; @@ -258,16 +242,15 @@ namespace eCAL bool new_topic_info(false); { const std::unique_lock lock(topic_info_map_.mtx); - QualityTopicIdMap::iterator topic_info_quality_iter = topic_info_map_.map.find(topic_info_key); + TopicIdInfoMap::iterator topic_info_quality_iter = topic_info_map_.map.find(topic_info_key); new_topic_info = topic_info_quality_iter == topic_info_map_.map.end(); if (new_topic_info) { - std::tie(topic_info_quality_iter, std::ignore) = topic_info_map_.map.emplace(topic_info_key, Registration::SQualityTopicInfo{}); + std::tie(topic_info_quality_iter, std::ignore) = topic_info_map_.map.emplace(topic_info_key, SDataTypeInformation{}); } - topic_info_quality_iter->second.info = topic_info_; - topic_info_quality_iter->second.quality = topic_quality_; + topic_info_quality_iter->second = topic_info_; } // notify publisher / subscriber registration callbacks about new entity @@ -284,7 +267,7 @@ namespace eCAL } } - void CDescGate::RemTopicDescription(SQualityTopicIdMap& topic_info_map_, + void CDescGate::RemTopicDescription(STopicIdInfoMap& topic_info_map_, const STopicIdCallbackMap& topic_callback_map_, const Registration::SampleIdentifier& topic_id_, const std::string& topic_name_) @@ -312,32 +295,28 @@ namespace eCAL } } - void CDescGate::ApplyServiceDescription(SQualityServiceIdMap& service_method_info_map_, + void CDescGate::ApplyServiceDescription(SServiceIdInfoMap& service_method_info_map_, const Registration::SampleIdentifier& service_id_, const std::string& service_name_, const std::string& method_name_, const SDataTypeInformation& request_type_information_, - const SDataTypeInformation& response_type_information_, - const Registration::DescQualityFlags request_type_quality_, - const Registration::DescQualityFlags response_type_quality_) + const SDataTypeInformation& response_type_information_) { - const auto service_method_info_key = Registration::SServiceId{ ConvertToEntityId(service_id_), service_name_, method_name_}; + const auto service_method_info_key = Registration::SServiceMethodId{ ConvertToEntityId(service_id_), service_name_, method_name_}; - Registration::SQualityServiceInfo service_quality_info; - service_quality_info.info.request_type = request_type_information_; - service_quality_info.info.response_type = response_type_information_; - service_quality_info.request_quality = request_type_quality_; - service_quality_info.response_quality = response_type_quality_; + SServiceMethodInformation service_info; + service_info.request_type = request_type_information_; + service_info.response_type = response_type_information_; const std::lock_guard lock(service_method_info_map_.mtx); - service_method_info_map_.id_map[service_method_info_key] = service_quality_info; + service_method_info_map_.id_map[service_method_info_key] = service_info; } - void CDescGate::RemServiceDescription(SQualityServiceIdMap& service_method_info_map_, + void CDescGate::RemServiceDescription(SServiceIdInfoMap& service_method_info_map_, const Registration::SampleIdentifier& service_id_, const std::string& service_name_) { - std::list service_method_info_keys_to_remove; + std::list service_method_info_keys_to_remove; const std::lock_guard lock(service_method_info_map_.mtx); diff --git a/ecal/core/src/ecal_descgate.h b/ecal/core/src/ecal_descgate.h index 76262e45e5..94bfca8bf3 100644 --- a/ecal/core/src/ecal_descgate.h +++ b/ecal/core/src/ecal_descgate.h @@ -49,23 +49,23 @@ namespace eCAL // get publisher information std::set GetPublisherIDs() const; - bool GetPublisherInfo(const Registration::STopicId& id_, Registration::SQualityTopicInfo& topic_info_) const; + bool GetPublisherInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const; Registration::CallbackToken AddPublisherEventCallback(const Registration::TopicIDCallbackT& callback_); void RemPublisherEventCallback(Registration::CallbackToken token_); // get subscriber information std::set GetSubscriberIDs() const; - bool GetSubscriberInfo(const Registration::STopicId& id_, Registration::SQualityTopicInfo& topic_info_) const; + bool GetSubscriberInfo(const Registration::STopicId& id_, SDataTypeInformation& topic_info_) const; Registration::CallbackToken AddSubscriberEventCallback(const Registration::TopicIDCallbackT& callback_); void RemSubscriberEventCallback(Registration::CallbackToken token_); // get service information - std::set GetServiceIDs() const; - bool GetServiceInfo(const Registration::SServiceId& id_, Registration::SQualityServiceInfo& service_info_) const; + std::set GetServiceIDs() const; + bool GetServiceInfo(const Registration::SServiceMethodId& id_, SServiceMethodInformation& service_info_) const; // get client information - std::set GetClientIDs() const; - bool GetClientInfo(const Registration::SServiceId& id_, Registration::SQualityServiceInfo& service_info_) const; + std::set GetClientIDs() const; + bool GetClientInfo(const Registration::SServiceMethodId& id_, SServiceMethodInformation& service_info_) const; // delete copy constructor and copy assignment operator CDescGate(const CDescGate&) = delete; @@ -76,11 +76,11 @@ namespace eCAL CDescGate& operator=(CDescGate&&) = delete; protected: - using QualityTopicIdMap = std::map; - struct SQualityTopicIdMap + using TopicIdInfoMap = std::map; + struct STopicIdInfoMap { mutable std::mutex mtx; - QualityTopicIdMap map; + TopicIdInfoMap map; }; using TopicIdCallbackMap = std::map; @@ -90,56 +90,53 @@ namespace eCAL TopicIdCallbackMap map; }; - using QualityServiceIdMap = std::map; - struct SQualityServiceIdMap + using ServiceIdInfoMap = std::map; + struct SServiceIdInfoMap { mutable std::mutex mtx; - QualityServiceIdMap id_map; + ServiceIdInfoMap id_map; }; - static std::set GetTopicIDs(const SQualityTopicIdMap& topic_info_map_); - static bool GetTopic (const Registration::STopicId& id_, const SQualityTopicIdMap& topic_info_map_, Registration::SQualityTopicInfo& topic_info_); + static std::set GetTopicIDs(const STopicIdInfoMap& topic_info_map_); + static bool GetTopic (const Registration::STopicId& id_, const STopicIdInfoMap& topic_info_map_, SDataTypeInformation& topic_info_); - static std::set GetServiceIDs(const SQualityServiceIdMap& service_method_info_map_); - static bool GetService (const Registration::SServiceId& id_, const SQualityServiceIdMap& service_method_info_map_, Registration::SQualityServiceInfo& service_method_info_); + static std::set GetServiceIDs(const SServiceIdInfoMap& service_method_info_map_); + static bool GetService (const Registration::SServiceMethodId& id_, const SServiceIdInfoMap& service_method_info_map_, SServiceMethodInformation& service_method_info_); - static void ApplyTopicDescription(SQualityTopicIdMap& topic_info_map_, + static void ApplyTopicDescription(STopicIdInfoMap& topic_info_map_, const STopicIdCallbackMap& topic_callback_map_, const Registration::SampleIdentifier& topic_id_, const std::string& topic_name_, - const SDataTypeInformation& topic_info_, - Registration::DescQualityFlags topic_quality_); + const SDataTypeInformation& topic_info_); - static void RemTopicDescription(SQualityTopicIdMap& topic_info_map_, + static void RemTopicDescription(STopicIdInfoMap& topic_info_map_, const STopicIdCallbackMap& topic_callback_map_, const Registration::SampleIdentifier& topic_id_, const std::string& topic_name_); - static void ApplyServiceDescription(SQualityServiceIdMap& service_method_info_map_, + static void ApplyServiceDescription(SServiceIdInfoMap& service_method_info_map_, const Registration::SampleIdentifier& service_id_, const std::string& service_name_, const std::string& method_name_, const SDataTypeInformation& request_type_information_, - const SDataTypeInformation& response_type_information_, - Registration::DescQualityFlags request_type_quality_, - Registration::DescQualityFlags response_type_quality_); + const SDataTypeInformation& response_type_information_); - static void RemServiceDescription(SQualityServiceIdMap& service_method_info_map_, + static void RemServiceDescription(SServiceIdInfoMap& service_method_info_map_, const Registration::SampleIdentifier& service_id_, const std::string& service_name_); Registration::CallbackToken CreateToken(); // internal quality topic info publisher/subscriber maps - SQualityTopicIdMap m_publisher_info_map; - STopicIdCallbackMap m_publisher_callback_map; + STopicIdInfoMap m_publisher_info_map; + STopicIdCallbackMap m_publisher_callback_map; - SQualityTopicIdMap m_subscriber_info_map; - STopicIdCallbackMap m_subscriber_callback_map; + STopicIdInfoMap m_subscriber_info_map; + STopicIdCallbackMap m_subscriber_callback_map; // internal quality service info service/client maps - SQualityServiceIdMap m_service_info_map; - SQualityServiceIdMap m_client_info_map; + SServiceIdInfoMap m_service_info_map; + SServiceIdInfoMap m_client_info_map; mutable std::mutex m_callback_token_mtx; std::atomic m_callback_token{ 0 }; diff --git a/ecal/core/src/ecal_util.cpp b/ecal/core/src/ecal_util.cpp index 464390710d..050c995f0d 100644 --- a/ecal/core/src/ecal_util.cpp +++ b/ecal/core/src/ecal_util.cpp @@ -78,7 +78,7 @@ namespace eCAL EventHandleT event; if (gOpenNamedEvent(&event, event_name, true)) { - std::cout << "Shutdown local eCAL process " << process_id_ << '\n'; + //std::cout << "Shutdown local eCAL process " << process_id_ << '\n'; gSetEvent(event); gCloseEvent(event); } diff --git a/ecal/core/src/registration/ecal_registration.cpp b/ecal/core/src/registration/ecal_registration.cpp index 72713cc248..1759521660 100644 --- a/ecal/core/src/registration/ecal_registration.cpp +++ b/ecal/core/src/registration/ecal_registration.cpp @@ -30,133 +30,6 @@ #include "registration/ecal_registration_receiver.h" #include "pubsub/ecal_pubgate.h" -namespace -{ - /** - * @brief Extract a set of all SQualityTopicInfo matching the given topic name. - * - * @param topic_name_ The topic name. - * @param quality_data_type_info_multi_map_ MultiMap { TopicName -> SQualityTopicInfo }. - * - * @return Set of SQualityTopicInfo - **/ - std::set GetQualityTopicInfoSet(const std::string& topic_name_, const eCAL::Registration::QualityTopicInfoMultiMap& quality_data_type_info_multi_map_) - { - std::set quality_topic_info_set; - - const auto topic_info_range = quality_data_type_info_multi_map_.equal_range(topic_name_); - for (auto topic_info_range_it = topic_info_range.first; topic_info_range_it != topic_info_range.second; ++topic_info_range_it) - { - quality_topic_info_set.insert(topic_info_range_it->second); - } - - return quality_topic_info_set; - } - - /** - * @brief Extract a set of all SQualityServiceInfo matching the given service name/method name. - * - * @param service_name_ The service name. - * @param method_name_ The method name. - * @param quality_service_info_multi_map_ MultiMap { -> SQualityServiceInfo }. - * - * @return Set of SQualityServiceInfo - **/ - std::set GetQualityServiceInfoSet(const std::string& service_name_, const std::string& method_name_, const eCAL::Registration::QualityServiceInfoMultimap& quality_service_info_multi_map_) - { - std::set quality_service_info_set; - - eCAL::Registration::SServiceMethod key; - key.service_name = service_name_; - key.method_name = method_name_; - const auto service_info_range = quality_service_info_multi_map_.equal_range(key); - for (auto service_info_range_it = service_info_range.first; service_info_range_it != service_info_range.second; ++service_info_range_it) - { - quality_service_info_set.insert(service_info_range_it->second); - } - - return quality_service_info_set; - } - - /** - * @brief Reducing std::map<(TopicName, TopicID), SQualityTopicInfo> to - * std::map based on the quality - * - * @param source_map_ std::map<(TopicName, TopicID), SQualityTopicInfo>. - * - * @return std::map - **/ - std::map ReduceQualityTopicIdMap(const eCAL::Registration::QualityTopicInfoMultiMap& source_map_) - { - std::map target_map; - - for (const auto& source_pair : source_map_) - { - const auto& source_key = source_pair.first; - const auto& source_value = source_pair.second; - - auto target_it = target_map.find(source_key); - if (target_it != target_map.end()) - { - // key exists in target map - if (source_value.quality > target_it->second.quality) - { - // source quality is greater, overwrite - target_it->second = source_value; - } - } - else - { - // key does not exist in target map, insert source pair - target_map.insert(std::make_pair(source_key, source_value)); - } - } - - return target_map; - } - - /** - * @brief Reducing std::map<(ServiceName, ServiceId, MethodName), SQualityServiceInfo> to - * std::map, SQualityServiceInfo> based on the quality - * - * @param source_map_ std::map<(ServiceName, ServiceId, MethodName), SQualityServiceInfo>. - * - * @return std::map, SQualityServiceInfo> - **/ - std::map ReduceQualityServiceIdMap(const eCAL::Registration::QualityServiceInfoMultimap& source_map_) - { - std::map target_map; - - for (const auto& source_pair : source_map_) - { - const auto& source_key = source_pair.first; - const auto& source_value = source_pair.second; - - eCAL::Registration::SServiceMethod target_key; - target_key.service_name = source_key.service_name; - target_key.method_name = source_key.method_name; - auto target_it = target_map.find(target_key); - if (target_it != target_map.end()) - { - // key exists in target map - if ( (source_value.request_quality > target_it->second.request_quality) - || (source_value.response_quality > target_it->second.response_quality)) - { - // source quality is greater, overwrite - target_it->second = source_value; - } - } - else - { - // key does not exist in target map, insert source pair - target_map.insert(std::make_pair(target_key, source_pair.second)); - } - } - - return target_map; - } -} - namespace eCAL { namespace Registration @@ -167,7 +40,7 @@ namespace eCAL return g_descgate()->GetPublisherIDs(); } - bool GetPublisherInfo(const STopicId& id_, SQualityTopicInfo& topic_info_) + bool GetPublisherInfo(const STopicId& id_, SDataTypeInformation& topic_info_) { if (g_descgate() == nullptr) return false; return g_descgate()->GetPublisherInfo(id_, topic_info_); @@ -191,7 +64,7 @@ namespace eCAL return g_descgate()->GetSubscriberIDs(); } - bool GetSubscriberInfo(const STopicId& id_, SQualityTopicInfo& topic_info_) + bool GetSubscriberInfo(const STopicId& id_, SDataTypeInformation& topic_info_) { if (g_descgate() == nullptr) return false; return g_descgate()->GetSubscriberInfo(id_, topic_info_); @@ -209,301 +82,69 @@ namespace eCAL return g_descgate()->RemSubscriberEventCallback(token_); } - std::set GetServiceIDs() + std::set GetServiceIDs() { - if (g_descgate() == nullptr) return std::set(); + if (g_descgate() == nullptr) return std::set(); return g_descgate()->GetServiceIDs(); } - bool GetServiceInfo(const SServiceId& id_, SQualityServiceInfo& service_info_) + bool GetServiceInfo(const SServiceMethodId& id_, SServiceMethodInformation& service_info_) { if (g_descgate() == nullptr) return false; return g_descgate()->GetServiceInfo(id_, service_info_); } - std::set GetClientIDs() + std::set GetClientIDs() { - if (g_descgate() == nullptr) return std::set(); + if (g_descgate() == nullptr) return std::set(); return g_descgate()->GetClientIDs(); } - bool GetClientInfo(const SServiceId& id_, SQualityServiceInfo& service_info_) + bool GetClientInfo(const SServiceMethodId& id_, SServiceMethodInformation& service_info_) { if (g_descgate() == nullptr) return false; return g_descgate()->GetClientInfo(id_, service_info_); } - QualityTopicInfoMultiMap GetPublishers() - { - const std::set id_set = GetPublisherIDs(); - - Registration::QualityTopicInfoMultiMap multi_map; - for (const auto& id : id_set) - { - SQualityTopicInfo quality_info; - if (GetPublisherInfo(id, quality_info)) - { - multi_map.insert(std::pair(id.topic_name, quality_info)); - } - } - return multi_map; - } - - QualityTopicInfoSet GetPublishers(const std::string& topic_name_) - { - return ::GetQualityTopicInfoSet(topic_name_, GetPublishers()); - } - - QualityTopicInfoMultiMap GetSubscribers() - { - const std::set id_set = GetSubscriberIDs(); - - Registration::QualityTopicInfoMultiMap multi_map; - for (const auto& id : id_set) - { - SQualityTopicInfo quality_info; - if (GetSubscriberInfo(id, quality_info)) - { - multi_map.insert(std::pair(id.topic_name, quality_info)); - } - } - return multi_map; - } - - QualityTopicInfoSet GetSubscribers(const std::string& topic_name_) - { - return ::GetQualityTopicInfoSet(topic_name_, GetSubscribers()); - } - - SDataTypeInformation GetHighestQualityDataTypeInformation(const QualityTopicInfoSet& quality_topic_info_set_) - { - SQualityTopicInfo highest_quality_topic_info; - for (const auto& info : quality_topic_info_set_) - { - if (info.quality > highest_quality_topic_info.quality) - { - highest_quality_topic_info = info; - } - } - return highest_quality_topic_info.info; - } - - QualityServiceInfoMultimap GetServices() - { - const std::set id_set = GetServiceIDs(); - - Registration::QualityServiceInfoMultimap multi_map; - for (const auto& id : id_set) - { - SQualityServiceInfo quality_info; - if (GetServiceInfo(id, quality_info)) - { - multi_map.insert(std::pair(SServiceMethod{ id.service_name, id.method_name }, quality_info)); - } - } - return multi_map; - } - - QualityServiceInfoMultimap GetClients() - { - const std::set id_set = GetClientIDs(); - - Registration::QualityServiceInfoMultimap multi_map; - for (const auto& id : id_set) - { - SQualityServiceInfo quality_info; - if (GetClientInfo(id, quality_info)) - { - multi_map.insert(std::pair(SServiceMethod{ id.service_name, id.method_name }, quality_info)); - } - } - return multi_map; - } - - SServiceMethodInformation GetHighestQualityServiceMethodInformation(const SQualityServiceInfoSet& quality_service_info_set_) - { - SQualityServiceInfo highest_quality_service_info; - for (const auto& info : quality_service_info_set_) - { - if ( (info.request_quality > highest_quality_service_info.request_quality) - || (info.response_quality > highest_quality_service_info.response_quality)) - { - highest_quality_service_info = info; - } - } - return highest_quality_service_info.info; - } - - void GetTopics(std::map& data_type_info_map_) - { - data_type_info_map_.clear(); - - std::map quality_data_type_info_map; - GetTopics(quality_data_type_info_map); - - // transform into target map - for (const auto& quality_data_type_info : quality_data_type_info_map) - { - data_type_info_map_.insert(std::pair(quality_data_type_info.first, quality_data_type_info.second.info)); - } - } - - void GetTopics(std::map& quality_topic_info_map_) - { - quality_topic_info_map_.clear(); - - QualityTopicInfoMultiMap pub_sub_map = GetPublishers(); - QualityTopicInfoMultiMap sub_map = GetSubscribers(); - pub_sub_map.insert(sub_map.begin(), sub_map.end()); - - // transform into a map with the highest quality data type information - quality_topic_info_map_ = ReduceQualityTopicIdMap(pub_sub_map); - } - void GetTopicNames(std::set& topic_names_) { topic_names_.clear(); - // get publisher & subscriber multi maps - auto pub_multi_map = GetPublishers(); - auto sub_multi_map = GetSubscribers(); - - // filter out unique topic names into a set - for (const auto& publisher : pub_multi_map) + // get publisher & subscriber id sets and insert names into the topic_names set + const std::set pub_id_set = GetPublisherIDs(); + for (const auto& pub_id : pub_id_set) { - topic_names_.insert(publisher.first); + topic_names_.insert(pub_id.topic_name); } - for (const auto& subscriber : sub_multi_map) - { - topic_names_.insert(subscriber.first); - } - } - - bool GetTopicDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& data_type_info_) - { - auto info_set = GetPublishers(topic_name_); - const auto sub_info_set = GetSubscribers(topic_name_); - - info_set.insert(sub_info_set.begin(), sub_info_set.end()); - data_type_info_ = GetHighestQualityDataTypeInformation(info_set); - - return !info_set.empty(); - } - - void GetServices(std::map& service_method_info_map_) - { - service_method_info_map_.clear(); - - std::map quality_service_method_info_map; - GetServices(quality_service_method_info_map); - - // transform into target map - for (const auto& quality_service_method_info : quality_service_method_info_map) + const std::set sub_id_set = GetSubscriberIDs(); + for (const auto& sub_id : sub_id_set) { - service_method_info_map_.insert(std::pair(quality_service_method_info.first, quality_service_method_info.second.info)); + topic_names_.insert(sub_id.topic_name); } } - void GetServices(std::map& quality_service_info_map_) - { - quality_service_info_map_.clear(); - - // transform into a map with the highest quality service method information - quality_service_info_map_ = ReduceQualityServiceIdMap(GetServices()); - } - void GetServiceMethodNames(std::set& service_method_names_) { service_method_names_.clear(); - // get services multi map - auto multi_map = GetServices(); - - // filter out unique service names into a set - for (const auto& service : multi_map) + // get services id set and insert names into the service_method_names set + const std::set service_id_set = GetServiceIDs(); + for (const auto& service_id : service_id_set) { - service_method_names_.insert(service.first); + service_method_names_.insert({ service_id.service_name, service_id.method_name }); } } - bool GetServiceTypeNames(const std::string& service_name_, const std::string& method_name_, std::string& req_type_, std::string& resp_type_) - { - const auto service_method_info_set = GetQualityServiceInfoSet(service_name_, method_name_, GetServices()); - - const SServiceMethodInformation service_method_info = GetHighestQualityServiceMethodInformation(service_method_info_set); - req_type_ = service_method_info.request_type.name; - resp_type_ = service_method_info.response_type.name; - - return !service_method_info_set.empty(); - } - - bool GetServiceDescription(const std::string& service_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_) - { - const auto service_method_info_set = GetQualityServiceInfoSet(service_name_, method_name_, GetServices()); - - const SServiceMethodInformation service_method_info = GetHighestQualityServiceMethodInformation(service_method_info_set); - req_desc_ = service_method_info.request_type.descriptor; - resp_desc_ = service_method_info.response_type.descriptor; - - return !service_method_info_set.empty(); - } - - void GetClients(std::map& client_method_info_map_) - { - client_method_info_map_.clear(); - - std::map quality_client_method_info_map_; - GetClients(quality_client_method_info_map_); - - // transform into target map - for (const auto& quality_client_method_info : quality_client_method_info_map_) - { - client_method_info_map_.insert(std::pair(quality_client_method_info.first, quality_client_method_info.second.info)); - } - } - - void GetClients(std::map& quality_client_info_map_) - { - quality_client_info_map_.clear(); - - // transform into a map with the highest quality service method information - quality_client_info_map_ = ReduceQualityServiceIdMap(GetClients()); - } - void GetClientMethodNames(std::set& client_method_names_) { client_method_names_.clear(); - // get services multi map - auto multi_map = GetClients(); - - // filter out unique service names into a set - for (const auto& service : multi_map) + // get clients id set and insert names into the client_method_names set + const std::set client_id_set = GetClientIDs(); + for (const auto& client_id : client_id_set) { - client_method_names_.insert(service.first); + client_method_names_.insert({ client_id.service_name, client_id.method_name }); } } - - bool GetClientTypeNames(const std::string& client_name_, const std::string& method_name_, std::string& req_type_, std::string& resp_type_) - { - const auto service_method_info_set = GetQualityServiceInfoSet(client_name_, method_name_, GetClients()); - - const SServiceMethodInformation service_method_info = GetHighestQualityServiceMethodInformation(service_method_info_set); - req_type_ = service_method_info.request_type.name; - resp_type_ = service_method_info.response_type.name; - - return !service_method_info_set.empty(); - } - - bool GetClientDescription(const std::string& client_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_) - { - const auto service_method_info_set = GetQualityServiceInfoSet(client_name_, method_name_, GetClients()); - - const SServiceMethodInformation service_method_info = GetHighestQualityServiceMethodInformation(service_method_info_set); - req_desc_ = service_method_info.request_type.descriptor; - resp_desc_ = service_method_info.response_type.descriptor; - - return !service_method_info_set.empty(); - } } } diff --git a/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c b/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c index fee938efed..825b8b3497 100644 --- a/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c +++ b/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c @@ -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. @@ -54,7 +54,7 @@ int main() eCAL_Sub_Destroy(sub); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c b/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c index fa144e2c0c..6d6d6e04da 100644 --- a/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c +++ b/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c @@ -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. @@ -53,7 +53,7 @@ int main() eCAL_Sub_Destroy(sub); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c b/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c index 06e2d7dcd6..c8d9721452 100644 --- a/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c +++ b/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c @@ -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. @@ -47,7 +47,7 @@ int main() } // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c b/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c index b59d9764ec..6ee05760f8 100644 --- a/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c +++ b/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c @@ -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. @@ -71,7 +71,7 @@ int main() eCAL_Client_Destroy(hclient); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c b/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c index 68b4d26418..ae9923233e 100644 --- a/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c +++ b/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c @@ -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. @@ -71,7 +71,7 @@ int main() eCAL_Server_Destroy(hserver); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp b/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp index 4fa1aad949..61765cd85e 100644 --- a/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp +++ b/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp @@ -187,7 +187,7 @@ int main() num_pub = pub_ids.size(); for (const auto& id : pub_ids) { - eCAL::Registration::SQualityTopicInfo topic_info; + eCAL::SDataTypeInformation topic_info; eCAL::Registration::GetPublisherInfo(id, topic_info); } diff --git a/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp b/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp index 90cb5f7749..4d5ab63208 100644 --- a/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp +++ b/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp @@ -51,6 +51,8 @@ void throughput_test(int snd_size, int snd_loops, eCAL::TLayer::eTransportLayer case eCAL::TLayer::tlayer_tcp: pub_config.layer.tcp.enable = true; break; + default: + break; } // enable zero copy mode diff --git a/ecal/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp b/ecal/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp index 0d16e542da..5f619bc697 100644 --- a/ecal/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp +++ b/ecal/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp @@ -38,15 +38,17 @@ int main() { // GetServices { + std::set service_method_id_set; + std::map service_info_map; start_time = std::chrono::steady_clock::now(); for (run = 0; run < runs; ++run) { - eCAL::Registration::GetServices(service_info_map); + service_method_id_set = eCAL::Registration::GetServiceIDs(); } - auto num_services = service_info_map.size(); + auto num_services = service_method_id_set.size(); auto diff_time = std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time); std::cout << "GetServices : " << static_cast(diff_time.count()) / runs << " ms" << " (" << num_services << " services)" << std::endl; std::cout << std::endl; diff --git a/ecal/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp b/ecal/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp index 88ee970d33..eecef464e5 100644 --- a/ecal/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp +++ b/ecal/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp @@ -38,15 +38,17 @@ int main() { // GetTopics { - std::map topic_info_map; + std::set topic_id_pub_set; + std::set topic_id_sub_set; start_time = std::chrono::steady_clock::now(); for (run = 0; run < runs; ++run) { - eCAL::Registration::GetTopics(topic_info_map); + topic_id_pub_set = eCAL::Registration::GetPublisherIDs(); + topic_id_sub_set = eCAL::Registration::GetSubscriberIDs(); } - auto num_topics = topic_info_map.size(); + auto num_topics = topic_id_pub_set.size() + topic_id_sub_set.size(); auto diff_time = std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time); std::cout << "GetTopics : " << static_cast(diff_time.count()) / runs << " ms" << " (" << num_topics << " topics)" << std::endl; } diff --git a/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp b/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp index cfcf84af83..38680aea6e 100644 --- a/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp +++ b/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp @@ -40,7 +40,7 @@ int main() pb::People::Person person; eCAL::protobuf::CSubscriber sub("person"); - auto receive_lambda = [&sub](const char* /*topic_name_*/, const pb::People::Person& person_, const long long /*time_*/, const long long /*clock_*/, const long long /*id_*/){ + auto receive_lambda = [](const char* /*topic_name_*/, const pb::People::Person& person_, const long long /*time_*/, const long long /*clock_*/, const long long /*id_*/){ std::cout << "------------------------------------------" << std::endl; std::cout << " RECEIVED " << std::endl; std::cout << "------------------------------------------" << std::endl; diff --git a/ecal/samples/cpp/pubsub/protobuf/proto_dyn_json_rec/src/proto_dyn_json_rec.cpp b/ecal/samples/cpp/pubsub/protobuf/proto_dyn_json_rec/src/proto_dyn_json_rec.cpp index 36ea727f2c..676f021280 100644 --- a/ecal/samples/cpp/pubsub/protobuf/proto_dyn_json_rec/src/proto_dyn_json_rec.cpp +++ b/ecal/samples/cpp/pubsub/protobuf/proto_dyn_json_rec/src/proto_dyn_json_rec.cpp @@ -25,9 +25,9 @@ const std::string MESSAGE_NAME("person"); -void ProtoMsgCallback(const char* topic_name_, const std::string& msg_, long long /*time_*/, long long /*clock_*/, long long /*id_*/) +void ProtoMsgCallback(const eCAL::Registration::STopicId& topic_id_, const std::string& msg_) { - std::cout << topic_name_ << " : " << msg_ << std::endl; + std::cout << topic_id_.topic_name << " : " << msg_ << std::endl; std::cout << std::endl; } @@ -38,7 +38,7 @@ int main() // create dynamic subscribers for receiving and decoding messages eCAL::protobuf::CDynamicJSONSubscriber sub(MESSAGE_NAME); - sub.AddReceiveCallback(ProtoMsgCallback); + sub.AddReceiveCallback(std::bind(ProtoMsgCallback, std::placeholders::_1, std::placeholders::_2)); // enter main loop while(eCAL::Ok()) diff --git a/ecal/samples/cpp/pubsub/protobuf/proto_dyn_rec/src/proto_dyn_rec.cpp b/ecal/samples/cpp/pubsub/protobuf/proto_dyn_rec/src/proto_dyn_rec.cpp index 548e233a2b..e7f3ba4214 100644 --- a/ecal/samples/cpp/pubsub/protobuf/proto_dyn_rec/src/proto_dyn_rec.cpp +++ b/ecal/samples/cpp/pubsub/protobuf/proto_dyn_rec/src/proto_dyn_rec.cpp @@ -270,9 +270,9 @@ void ProcProtoMsg(const google::protobuf::Message& msg_, const std::string& pref } } -void ProtoMsgCallback(const char* topic_name_, const std::shared_ptr& msg_) +void ProtoMsgCallback(const eCAL::Registration::STopicId& topic_id_, const std::shared_ptr& msg_) { - ProcProtoMsg(*msg_, topic_name_); + ProcProtoMsg(*msg_, topic_id_.topic_name); std::cout << std::endl; } diff --git a/ecal/samples/cpp/services/ping_client_dyn/src/ping_client_dyn.cpp b/ecal/samples/cpp/services/ping_client_dyn/src/ping_client_dyn.cpp index cfae92b6f1..726eea0788 100644 --- a/ecal/samples/cpp/services/ping_client_dyn/src/ping_client_dyn.cpp +++ b/ecal/samples/cpp/services/ping_client_dyn/src/ping_client_dyn.cpp @@ -48,18 +48,28 @@ int main() // get service method type names std::string req_type; + std::string req_desc; std::string resp_type; - if (!eCAL::Registration::GetServiceTypeNames(service_name, method_name, req_type, resp_type)) + std::string resp_desc; + auto service_ids = eCAL::Registration::GetServiceIDs(); + bool service_info_found(false); + for (const auto& service_id : service_ids) { - throw std::runtime_error("Could not get service type names !"); + if ((service_id.service_name == service_name) && (service_id.method_name == method_name)) + { + eCAL::SServiceMethodInformation service_method_info; + eCAL::Registration::GetServiceInfo(service_id, service_method_info); + req_type = service_method_info.request_type.name; + req_desc = service_method_info.request_type.descriptor; + resp_type = service_method_info.response_type.name; + resp_desc = service_method_info.response_type.descriptor; + service_info_found = true; + break; + } } - - // get service method type descriptions - std::string req_desc; - std::string resp_desc; - if (!eCAL::Registration::GetServiceDescription(service_name, method_name, req_desc, resp_desc)) + if (!service_info_found) { - throw std::runtime_error("Could not get service type descriptions !"); + throw std::runtime_error("Could not get service type names and service type descriptions!"); } // create dynamic protobuf message decoder to create request and response message objects diff --git a/ecal/tests/cpp/config_test/src/config_test.cpp b/ecal/tests/cpp/config_test/src/config_test.cpp index 8416fdf465..ac12d4630d 100644 --- a/ecal/tests/cpp/config_test/src/config_test.cpp +++ b/ecal/tests/cpp/config_test/src/config_test.cpp @@ -155,18 +155,6 @@ TEST(core_cpp_config /*unused*/, user_config_death_test /*unused*/) ASSERT_THROW( SetValue(custom_config.transport_layer.udp.network.group, "0.00.000.0"), std::invalid_argument); - - // Test the ConstrainedInteger class with wrong values. Default are MIN = 5242880, STEP = 1024 - // Value below MIN - ASSERT_THROW( - SetValue(custom_config.transport_layer.udp.send_buffer, 42), - std::invalid_argument); - - // Wrong step. Default STEP = 1024 - ASSERT_THROW( - SetValue(custom_config.transport_layer.udp.send_buffer, (5242880 + 512)), - std::invalid_argument); - } TEST(core_cpp_config /*unused*/, config_custom_datatypes_tests /*unused*/) @@ -180,14 +168,6 @@ TEST(core_cpp_config /*unused*/, config_custom_datatypes_tests /*unused*/) ip2 = ip1; EXPECT_EQ(ip1, ip2); - eCAL::Types::ConstrainedInteger<0,1,10> s1; - eCAL::Types::ConstrainedInteger<0,1,10> s2; - EXPECT_EQ(s1, s2); - - s1 = 5; - s2 = s1; - EXPECT_EQ(s1, s2); - // test copy method for config structure eCAL::Configuration config1; eCAL::Configuration config2; @@ -239,9 +219,6 @@ TEST(core_cpp_config /*unused*/, parse_values_test /*unused*/) // Check equality of IpAddressV4 EXPECT_EQ(config.transport_layer.udp.network.group, "239.5.0.1"); - // Check constrained Integer - EXPECT_EQ(config.transport_layer.udp.port, 14010); - // Check boolean EXPECT_EQ(config.transport_layer.udp.npcap_enabled, true); diff --git a/ecal/tests/cpp/descgate_test/src/descgate_getentities.cpp b/ecal/tests/cpp/descgate_test/src/descgate_getentities.cpp index 174f1635b6..c72b33cbe4 100644 --- a/ecal/tests/cpp/descgate_test/src/descgate_getentities.cpp +++ b/ecal/tests/cpp/descgate_test/src/descgate_getentities.cpp @@ -146,15 +146,15 @@ TEST(core_cpp_descgate, PublisherQualities) { for (const auto& id : id_set) { - eCAL::Registration::SQualityTopicInfo quality_info; - bool found = desc_gate.GetPublisherInfo(id, quality_info); + eCAL::SDataTypeInformation topic_info; + bool found = desc_gate.GetPublisherInfo(id, topic_info); EXPECT_TRUE(found); if (found) { std::string tname = id.topic_name; - EXPECT_EQ(tname + "-tdatatype.name", quality_info.info.name); - EXPECT_EQ(tname + "-tdatatype.encoding", quality_info.info.encoding); - EXPECT_EQ(tname + "-tdatatype.descriptor", quality_info.info.descriptor); + EXPECT_EQ(tname + "-tdatatype.name", topic_info.name); + EXPECT_EQ(tname + "-tdatatype.encoding", topic_info.encoding); + EXPECT_EQ(tname + "-tdatatype.descriptor", topic_info.descriptor); } } } @@ -229,15 +229,15 @@ TEST(core_cpp_descgate, SubscriberQualities) { for (const auto& id : id_set) { - eCAL::Registration::SQualityTopicInfo quality_info; - bool found = desc_gate.GetSubscriberInfo(id, quality_info); + eCAL::SDataTypeInformation topic_info; + bool found = desc_gate.GetSubscriberInfo(id, topic_info); EXPECT_TRUE(found); if (found) { std::string tname = id.topic_name; - EXPECT_EQ(tname + "-tdatatype.name", quality_info.info.name); - EXPECT_EQ(tname + "-tdatatype.encoding", quality_info.info.encoding); - EXPECT_EQ(tname + "-tdatatype.descriptor", quality_info.info.descriptor); + EXPECT_EQ(tname + "-tdatatype.name", topic_info.name); + EXPECT_EQ(tname + "-tdatatype.encoding", topic_info.encoding); + EXPECT_EQ(tname + "-tdatatype.descriptor", topic_info.descriptor); } } } diff --git a/ecal/tests/cpp/pubsub_proto_test/src/proto_dyn_subscriber_test.cpp b/ecal/tests/cpp/pubsub_proto_test/src/proto_dyn_subscriber_test.cpp index 58b1b0e50b..3dbef84820 100644 --- a/ecal/tests/cpp/pubsub_proto_test/src/proto_dyn_subscriber_test.cpp +++ b/ecal/tests/cpp/pubsub_proto_test/src/proto_dyn_subscriber_test.cpp @@ -58,7 +58,7 @@ class ProtoDynSubscriberTest : public ::testing::Test { pub.Send(p); } - void OnPerson(const char* /*topic_name*/, const std::shared_ptr& /*message*/, long long /*time*/) + void OnPerson(const std::shared_ptr& /*message*/, long long /*time*/) { received_callbacks++; } @@ -95,7 +95,7 @@ TEST_F(core_cpp_pubsub_proto_dyn, ProtoDynSubscriberTest_SendReceiveCB) { // Assert that the Subscriber can be move constructed. eCAL::protobuf::CDynamicSubscriber person_dyn_rec("ProtoSubscriberTest"); - auto person_callback = std::bind(&ProtoDynSubscriberTest::OnPerson, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); + auto person_callback = std::bind(&ProtoDynSubscriberTest::OnPerson, this, std::placeholders::_2, std::placeholders::_3); person_dyn_rec.AddReceiveCallback(person_callback); ASSERT_TRUE(person_dyn_rec.IsCreated()); @@ -108,23 +108,3 @@ TEST_F(core_cpp_pubsub_proto_dyn, ProtoDynSubscriberTest_SendReceiveCB) // assert that the OnPerson callback has been called once. ASSERT_EQ(1, received_callbacks); } - -TEST_F(core_cpp_pubsub_proto_dyn, ProtoDynSubscriberTest_SendReceive) -{ - // Assert that the Subscriber can be move constructed. - eCAL::protobuf::CDynamicSubscriber person_dyn_rec("ProtoSubscriberTest"); - ASSERT_TRUE(person_dyn_rec.IsCreated()); - - eCAL::protobuf::CPublisher person_pub("ProtoSubscriberTest"); - - std::this_thread::sleep_for(std::chrono::milliseconds(2000)); - - SendPerson(person_pub); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - auto received_message = person_dyn_rec.Receive(nullptr, 500); - // assert that the OnPerson callback has been called once. - ASSERT_TRUE(received_message.has_value()) << "we should have received data that was sent"; - auto id = extract_id(*received_message.value()); - ASSERT_EQ(id, 1) << "Extracted ID needs to be 1"; -} diff --git a/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp b/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp index 35732b5953..357639ab06 100644 --- a/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp +++ b/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp @@ -71,7 +71,6 @@ TEST(core_cpp_pubsub, TestSubscriberIsPublishedTiming) std::string first_received_sample; auto subscriber_function = [&do_start_publication, &publication_finished, &publisher_seen_at_subscription_start, &first_received_sample]() { eCAL::CSubscriber sub("blob"); - bool received(false); const auto max_sub_count(10); auto sub_count(0); auto receive_lambda = [&max_sub_count, &sub_count, &publisher_seen_at_subscription_start, &first_received_sample, &sub](const char* /*topic_name_*/, const struct eCAL::SReceiveCallbackData* data_) { @@ -171,7 +170,6 @@ TEST(core_cpp_pubsub, TestPublisherIsSubscribedTiming) std::string first_received_sample; auto subscriber_function = [&publication_finished, &publisher_seen_at_subscription_start, &first_received_sample]() { eCAL::CSubscriber sub("blob"); - bool received(false); const auto max_sub_count(10); auto sub_count(0); auto receive_lambda = [&max_sub_count, &sub_count, &publisher_seen_at_subscription_start, &first_received_sample, &sub](const char* /*topic_name_*/, const struct eCAL::SReceiveCallbackData* data_) { diff --git a/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp b/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp index ee7d74d9ef..44f7b9474d 100644 --- a/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp +++ b/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp @@ -588,7 +588,7 @@ TEST(core_cpp_pubsub, SubscriberReconnection) size_t callback_received_count(0); eCAL::string::CSubscriber sub_foo("foo"); - auto receive_lambda = [&sub_foo, &callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { + auto receive_lambda = [&callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { std::cout << "Receiving in scope 1" << std::endl; callback_received_count++; }; @@ -605,7 +605,7 @@ TEST(core_cpp_pubsub, SubscriberReconnection) size_t callback_received_count(0); eCAL::string::CSubscriber sub_foo("foo"); - auto receive_lambda = [&sub_foo, &callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { + auto receive_lambda = [&callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { std::cout << "Receiving in scope 2" << std::endl; callback_received_count++; }; diff --git a/ecal/tests/cpp/registration_test_public/src/registration_getclients.cpp b/ecal/tests/cpp/registration_test_public/src/registration_getclients.cpp index bb0b1c1d11..091b8127e4 100644 --- a/ecal/tests/cpp/registration_test_public/src/registration_getclients.cpp +++ b/ecal/tests/cpp/registration_test_public/src/registration_getclients.cpp @@ -54,7 +54,7 @@ class ClientsTestFixture : public ::testing::TestWithParam }; TEST_P(ClientsTestFixture, ClientExpiration) { - std::map client_info_map; + std::set id_set; // create simple client and let it expire { @@ -70,10 +70,10 @@ TEST_P(ClientsTestFixture, ClientExpiration) eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); // get all clients - eCAL::Registration::GetClients(client_info_map); + id_set = eCAL::Registration::GetClientIDs(); // check size - EXPECT_EQ(client_info_map.size(), 1); + EXPECT_EQ(id_set.size(), 1); // check client/method names std::set client_method_names; @@ -89,10 +89,10 @@ TEST_P(ClientsTestFixture, ClientExpiration) eCAL::Process::SleepMS(CMN_MONITORING_TIMEOUT_MS); // get all clients again, client should not be expired - eCAL::Registration::GetClients(client_info_map); + id_set = eCAL::Registration::GetClientIDs(); // check size - EXPECT_EQ(client_info_map.size(), 1); + EXPECT_EQ(id_set.size(), 1); } // let's unregister @@ -100,167 +100,10 @@ TEST_P(ClientsTestFixture, ClientExpiration) // get all clients again, all clients // should be removed from the map - eCAL::Registration::GetClients(client_info_map); + id_set = eCAL::Registration::GetClientIDs(); // check size - EXPECT_EQ(client_info_map.size(), 0); -} - -TEST_P(ClientsTestFixture, ClientEqualQualities) -{ - std::map client_info_map; - - // create 2 clients with the same quality of data type information - { - // create client 1 - eCAL::SServiceMethodInformation service_method_info1; - service_method_info1.request_type.name = "foo::req_type1"; - service_method_info1.request_type.descriptor = "foo::req_desc1"; - service_method_info1.response_type.name = "foo::resp_type1"; - service_method_info1.response_type.descriptor = "foo::resp_desc1"; - eCAL::CServiceClient client1("foo::service", { {"foo::method", service_method_info1} }); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all clients - eCAL::Registration::GetClients(client_info_map); - - // check size - EXPECT_EQ(client_info_map.size(), 1); - - // check attributes - std::string req_type, resp_type; - std::string req_desc, resp_desc; - - eCAL::Registration::GetClientTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, "foo::resp_type1"); - eCAL::Registration::GetClientDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, "foo::resp_desc1"); - - // create client 2 - // this will not overwrite the attributes from client 1, because the quality is not higher - eCAL::SServiceMethodInformation service_method_info2; - service_method_info2.request_type.name = "foo::req_type2"; - service_method_info2.request_type.descriptor = "foo::req_desc2"; - service_method_info2.response_type.name = "foo::resp_type2"; - service_method_info2.response_type.descriptor = "foo::resp_desc2"; - eCAL::CServiceClient client2("foo::service", { {"foo::method", service_method_info2} }); - - // check attributes - eCAL::Registration::GetClientTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, "foo::resp_type1"); - eCAL::Registration::GetClientDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, "foo::resp_desc1"); - - // check size it's client 1 only - EXPECT_EQ(client_info_map.size(), 1); - - // let's wait a monitoring timeout long - eCAL::Process::SleepMS(CMN_MONITORING_TIMEOUT_MS); - - // get all clients again, clients should not be expired - eCAL::Registration::GetClients(client_info_map); - - // check size - EXPECT_EQ(client_info_map.size(), 1); - - // destroy client 1 - client1.Destroy(); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // check attributes, client 1 attributes should be replaced by client 2 attributes now - eCAL::Registration::GetClientTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type2"); - EXPECT_EQ(resp_type, "foo::resp_type2"); - eCAL::Registration::GetClientDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc2"); - EXPECT_EQ(resp_desc, "foo::resp_desc2"); - } - - // let's unregister - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all clients again, all clients - // should be removed from the map - eCAL::Registration::GetClients(client_info_map); - - // check size - EXPECT_EQ(client_info_map.size(), 0); -} - -TEST_P(ClientsTestFixture, ClientDifferentQualities) -{ - std::map client_info_map; - - // create 2 clients with different qualities of data type information - { - // create client 1, response type name and reponse description are missing - eCAL::SServiceMethodInformation service_method_info1; - service_method_info1.request_type.name = "foo::req_type1"; - service_method_info1.request_type.descriptor = "foo::req_desc1"; - service_method_info1.response_type.name = ""; - service_method_info1.response_type.descriptor = ""; - eCAL::CServiceClient client1("foo::service", { {"foo::method", service_method_info1} }); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all clients - eCAL::Registration::GetClients(client_info_map); - - // check size - EXPECT_EQ(client_info_map.size(), 1); - - // check attributes - std::string req_type, resp_type; - std::string req_desc, resp_desc; - - eCAL::Registration::GetClientTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, ""); - eCAL::Registration::GetClientDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, ""); - - // create client 2, with higher quality than client 1 - eCAL::SServiceMethodInformation service_method_info2; - service_method_info2.request_type.name = "foo::req_type2"; - service_method_info2.request_type.descriptor = "foo::req_desc2"; - service_method_info2.response_type.name = "foo::resp_type2"; - service_method_info2.response_type.descriptor = "foo::resp_desc2"; - eCAL::CServiceClient client2("foo::service", { {"foo::method", service_method_info2} }); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // check attributes, we expect attributes from client 2 here - eCAL::Registration::GetClientTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type2"); - EXPECT_EQ(resp_type, "foo::resp_type2"); - eCAL::Registration::GetClientDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc2"); - EXPECT_EQ(resp_desc, "foo::resp_desc2"); - - // check size it's client 2 only - EXPECT_EQ(client_info_map.size(), 1); - } - - // let's unregister - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all clients again, all clients - // should be removed from the map - eCAL::Registration::GetClients(client_info_map); - - // check size - EXPECT_EQ(client_info_map.size(), 0); + EXPECT_EQ(id_set.size(), 0); } TEST_P(ClientsTestFixture, GetClientIDs) @@ -283,11 +126,11 @@ TEST_P(ClientsTestFixture, GetClientIDs) EXPECT_EQ(1, id_set.size()); if (id_set.size() > 0) { - eCAL::Registration::SQualityServiceInfo info; + eCAL::SServiceMethodInformation info; EXPECT_TRUE(eCAL::Registration::GetClientInfo(*id_set.begin(), info)); // check service/method names - EXPECT_EQ(service_method_info, info.info); + EXPECT_EQ(service_method_info, info); } } } @@ -319,4 +162,4 @@ INSTANTIATE_TEST_SUITE_P( return config; }() } ) -); \ No newline at end of file +); diff --git a/ecal/tests/cpp/registration_test_public/src/registration_getservices.cpp b/ecal/tests/cpp/registration_test_public/src/registration_getservices.cpp index 72f9b0184b..f66b4447ca 100644 --- a/ecal/tests/cpp/registration_test_public/src/registration_getservices.cpp +++ b/ecal/tests/cpp/registration_test_public/src/registration_getservices.cpp @@ -55,7 +55,7 @@ class ServicesTestFixture : public ::testing::TestWithParam TEST_P(ServicesTestFixture, ServiceExpiration) { - std::map service_info_map; + std::set id_set; // create simple service and let it expire { @@ -67,10 +67,10 @@ TEST_P(ServicesTestFixture, ServiceExpiration) eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); // get all services - eCAL::Registration::GetServices(service_info_map); + id_set = eCAL::Registration::GetServiceIDs(); // check size - EXPECT_EQ(service_info_map.size(), 1); + EXPECT_EQ(id_set.size(), 1); // check service/method names std::set service_method_names; @@ -86,10 +86,10 @@ TEST_P(ServicesTestFixture, ServiceExpiration) eCAL::Process::SleepMS(CMN_MONITORING_TIMEOUT_MS); // get all services again, service should not be expired - eCAL::Registration::GetServices(service_info_map); + id_set = eCAL::Registration::GetServiceIDs(); // check size - EXPECT_EQ(service_info_map.size(), 1); + EXPECT_EQ(id_set.size(), 1); } // let's unregister @@ -97,151 +97,10 @@ TEST_P(ServicesTestFixture, ServiceExpiration) // get all services again, all services // should be removed from the map - eCAL::Registration::GetServices(service_info_map); + id_set = eCAL::Registration::GetServiceIDs(); // check size - EXPECT_EQ(service_info_map.size(), 0); -} - -TEST_P(ServicesTestFixture, ServiceEqualQualities) -{ - std::map service_info_map; - - // create 2 services with the same quality of data type information - { - // create service 1 - eCAL::CServiceServer service1("foo::service"); - service1.AddDescription("foo::method", "foo::req_type1", "foo::req_desc1", "foo::resp_type1", "foo::resp_desc1"); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all services - eCAL::Registration::GetServices(service_info_map); - - // check size - EXPECT_EQ(service_info_map.size(), 1); - - // check attributes - std::string req_type, resp_type; - std::string req_desc, resp_desc; - - eCAL::Registration::GetServiceTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, "foo::resp_type1"); - eCAL::Registration::GetServiceDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, "foo::resp_desc1"); - - // create service 2 - // this will not overwrite the attributes from service 1, because the quality is not higher - eCAL::CServiceServer service2("foo::service"); - service2.AddDescription("foo::method", "foo::req_type2", "foo::req_desc2", "foo::resp_type2", "foo::resp_desc2"); - - // check attributes - eCAL::Registration::GetServiceTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, "foo::resp_type1"); - eCAL::Registration::GetServiceDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, "foo::resp_desc1"); - - // check size it's service 1 only - EXPECT_EQ(service_info_map.size(), 1); - - // let's wait a monitoring timeout long - eCAL::Process::SleepMS(CMN_MONITORING_TIMEOUT_MS); - - // get all services again, services should not be expired - eCAL::Registration::GetServices(service_info_map); - - // check size - EXPECT_EQ(service_info_map.size(), 1); - - // destroy service 1 - service1.Destroy(); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // check attributes, service 1 attributes should be replaced by service 2 attributes now - eCAL::Registration::GetServiceTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type2"); - EXPECT_EQ(resp_type, "foo::resp_type2"); - eCAL::Registration::GetServiceDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc2"); - EXPECT_EQ(resp_desc, "foo::resp_desc2"); - } - - // let's unregister - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all services again, all services - // should be removed from the map - eCAL::Registration::GetServices(service_info_map); - - // check size - EXPECT_EQ(service_info_map.size(), 0); -} - -TEST_P(ServicesTestFixture, ServiceDifferentQualities) -{ - std::map service_info_map; - - // create 2 services with different qualities of data type information - { - // create service 1, response type name and response description are missing - eCAL::CServiceServer service1("foo::service"); - service1.AddDescription("foo::method", "foo::req_type1", "foo::req_desc1", "", ""); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all services - eCAL::Registration::GetServices(service_info_map); - - // check size - EXPECT_EQ(service_info_map.size(), 1); - - // check attributes - std::string req_type, resp_type; - std::string req_desc, resp_desc; - - eCAL::Registration::GetServiceTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type1"); - EXPECT_EQ(resp_type, ""); - eCAL::Registration::GetServiceDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc1"); - EXPECT_EQ(resp_desc, ""); - - // create service 2, with higher quality than service 1 - eCAL::CServiceServer service2("foo::service"); - service2.AddDescription("foo::method", "foo::req_type2", "foo::req_desc2", "foo::resp_type2", "foo::resp_desc2"); - - // let's register - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // check attributes, we expect attributes from service 2 here - eCAL::Registration::GetServiceTypeNames("foo::service", "foo::method", req_type, resp_type); - EXPECT_EQ(req_type, "foo::req_type2"); - EXPECT_EQ(resp_type, "foo::resp_type2"); - eCAL::Registration::GetServiceDescription("foo::service", "foo::method", req_desc, resp_desc); - EXPECT_EQ(req_desc, "foo::req_desc2"); - EXPECT_EQ(resp_desc, "foo::resp_desc2"); - - // check size it's service 2 only - EXPECT_EQ(service_info_map.size(), 1); - } - - // let's unregister - eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - - // get all services again, all services - // should be removed from the map - eCAL::Registration::GetServices(service_info_map); - - // check size - EXPECT_EQ(service_info_map.size(), 0); + EXPECT_EQ(id_set.size(), 0); } TEST_P(ServicesTestFixture, GetServiceIDs) @@ -272,16 +131,15 @@ TEST_P(ServicesTestFixture, GetServiceIDs) EXPECT_EQ(1, id_set.size()); if (id_set.size() > 0) { - eCAL::Registration::SQualityServiceInfo info; + eCAL::SServiceMethodInformation info; EXPECT_TRUE(eCAL::Registration::GetServiceInfo(*id_set.begin(), info)); // check service/method names - EXPECT_EQ(service_method_info, info.info); + EXPECT_EQ(service_method_info, info); } } } - INSTANTIATE_TEST_SUITE_P( core_cpp_registration_public_services, ServicesTestFixture, @@ -309,4 +167,4 @@ INSTANTIATE_TEST_SUITE_P( return config; }() } ) -); \ No newline at end of file +); diff --git a/ecal/tests/cpp/registration_test_public/src/registration_gettopics.cpp b/ecal/tests/cpp/registration_test_public/src/registration_gettopics.cpp index 75ac9c90d9..bb4d4869e7 100644 --- a/ecal/tests/cpp/registration_test_public/src/registration_gettopics.cpp +++ b/ecal/tests/cpp/registration_test_public/src/registration_gettopics.cpp @@ -39,17 +39,16 @@ TEST(core_cpp_registration_public, GetTopics) // initialize eCAL API eCAL::Initialize("core_cpp_registration_public"); - std::map topic_info_map; + std::set topic_id_pub_set; + std::set topic_id_sub_set; // create and check a few pub/sub entities { eCAL::SDataTypeInformation info_A1 { "typeA1" ,"", "descA1" }; - eCAL::SDataTypeInformation info_A1_2{ "typeA1.2","", "descA1.2" }; eCAL::SDataTypeInformation info_A2 { "typeA2" ,"", "descA2" }; eCAL::SDataTypeInformation info_A3 { "typeA3" ,"", "descA3" }; eCAL::SDataTypeInformation info_B1 { "typeB1" ,"", "descB1" }; - eCAL::SDataTypeInformation info_B1_2{ "typeB1.2","", "descB1.2" }; eCAL::SDataTypeInformation info_B2 { "typeB2" ,"", "descB2" }; // create 3 publisher @@ -57,44 +56,49 @@ TEST(core_cpp_registration_public, GetTopics) eCAL::CPublisher pub2("A2", info_A2); eCAL::CPublisher pub3("A3", info_A3); - // create a missmatching publisher - // this should trigger a warning but not increase map size - eCAL::CPublisher pub12("A1", info_A1_2); - // create 2 subscriber eCAL::CSubscriber sub1("B1", info_B1); eCAL::CSubscriber sub2("B2", info_B2); - // create a missmatching subscriber - // this should trigger a warning but not increase map size - eCAL::CSubscriber sub12("B1", info_B1_2); - // let's register eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - // get all topics - eCAL::Registration::GetTopics(topic_info_map); + // get all publisher topics and check size + topic_id_pub_set = eCAL::Registration::GetPublisherIDs(); + EXPECT_EQ(topic_id_pub_set.size(), 3); + + // check publisher types and descriptions + for (auto& topic_id_pub : topic_id_pub_set) + { + eCAL::SDataTypeInformation registration_topic_info; + eCAL::Registration::GetPublisherInfo(topic_id_pub, registration_topic_info); + eCAL::SDataTypeInformation expected_topic_info{ "type" + topic_id_pub.topic_name, "", "desc" + topic_id_pub.topic_name }; + EXPECT_EQ(registration_topic_info, expected_topic_info); + } - // check size - EXPECT_EQ(topic_info_map.size(), 5); + // get all subscriber topics and check size + topic_id_sub_set = eCAL::Registration::GetSubscriberIDs(); + EXPECT_EQ(topic_id_sub_set.size(), 2); - // check types and descriptions - for (auto& topic_info : topic_info_map) + // check subscriber types and descriptions + for (auto& topic_id_sub : topic_id_sub_set) { eCAL::SDataTypeInformation registration_topic_info; - eCAL::Registration::GetTopicDataTypeInformation(topic_info.first, registration_topic_info); - eCAL::SDataTypeInformation expected_topic_info{ "type" + topic_info.first, "", "desc" + topic_info.first }; + eCAL::Registration::GetSubscriberInfo(topic_id_sub, registration_topic_info); + eCAL::SDataTypeInformation expected_topic_info{ "type" + topic_id_sub.topic_name, "", "desc" + topic_id_sub.topic_name }; EXPECT_EQ(registration_topic_info, expected_topic_info); } // wait a monitoring timeout long, eCAL::Process::SleepMS(CMN_MONITORING_TIMEOUT_MS); - // the topics should not be expired - eCAL::Registration::GetTopics(topic_info_map); + // get all publisher topics and check size (should not be expired) + topic_id_pub_set = eCAL::Registration::GetPublisherIDs(); + EXPECT_EQ(topic_id_pub_set.size(), 3); - // check size - EXPECT_EQ(topic_info_map.size(), 5); + // get all subscriber topics and check size (should not be expired) + topic_id_sub_set = eCAL::Registration::GetSubscriberIDs(); + EXPECT_EQ(topic_id_sub_set.size(), 2); // now destroy publisher pub1 and subscriber sub1 // the entities pub12 and sub12 should replace them @@ -105,31 +109,25 @@ TEST(core_cpp_registration_public, GetTopics) // let's register eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - // size should be 5 again (because of pub12 and sub12 should have replaced pub1 and sub1 attributes now) - EXPECT_EQ(topic_info_map.size(), 5); + // get all publisher topics and check size (pub1 should be expired) + topic_id_pub_set = eCAL::Registration::GetPublisherIDs(); + EXPECT_EQ(topic_id_pub_set.size(), 2); - // check overwritten attributes - { - eCAL::SDataTypeInformation registration_topic_info; - EXPECT_EQ(true, eCAL::Registration::GetTopicDataTypeInformation("A1", registration_topic_info)); - EXPECT_EQ(registration_topic_info, info_A1_2); - } - { - eCAL::SDataTypeInformation registration_topic_info; - EXPECT_EQ(true, eCAL::Registration::GetTopicDataTypeInformation("B1", registration_topic_info)); - EXPECT_EQ(registration_topic_info, info_B1_2); - } + // get all subscriber topics and check size (sub1 should be expired) + topic_id_sub_set = eCAL::Registration::GetSubscriberIDs(); + EXPECT_EQ(topic_id_sub_set.size(), 1); } // let's unregister eCAL::Process::SleepMS(2 * CMN_REGISTRATION_REFRESH_MS); - // get all topics again, now all topics - // should be removed from the map - eCAL::Registration::GetTopics(topic_info_map); + // get all publisher topics and check size (all publisher should be expired) + topic_id_pub_set = eCAL::Registration::GetPublisherIDs(); + EXPECT_EQ(topic_id_pub_set.size(), 0); - // check size - EXPECT_EQ(topic_info_map.size(), 0); + // get all subscriber topics and check size (all subscriber should be expired) + topic_id_sub_set = eCAL::Registration::GetSubscriberIDs(); + EXPECT_EQ(topic_id_sub_set.size(), 0); // finalize eCAL API eCAL::Finalize(); @@ -169,11 +167,11 @@ TEST(core_cpp_registration_public, GetTopicsParallel) size_t max_number_publishers_seen = 0; std::set tmp_topic_names; - std::map topics; + std::set tmp_topic_ids; do { eCAL::Registration::GetTopicNames(tmp_topic_names); - eCAL::Registration::GetTopics(topics); + tmp_topic_ids = eCAL::Registration::GetPublisherIDs(); number_publishers_seen = tmp_topic_names.size(); max_number_publishers_seen = std::max(max_number_publishers_seen, number_publishers_seen); diff --git a/lang/csharp/Continental.eCAL.Core/ecal_clr.cpp b/lang/csharp/Continental.eCAL.Core/ecal_clr.cpp index ccd1eae70d..cc8f5aeb7c 100644 --- a/lang/csharp/Continental.eCAL.Core/ecal_clr.cpp +++ b/lang/csharp/Continental.eCAL.Core/ecal_clr.cpp @@ -100,11 +100,6 @@ void Util::ShutdownProcesses() ::eCAL::Util::ShutdownProcesses(); } -void Util::ShutdownCore() -{ - ::eCAL::Util::ShutdownCore(); -} - ///////////////////////////////////////////////////////////////////////////// // Logger ///////////////////////////////////////////////////////////////////////////// diff --git a/lang/csharp/Continental.eCAL.Core/ecal_clr.h b/lang/csharp/Continental.eCAL.Core/ecal_clr.h index 868b5f2f55..17f154749e 100644 --- a/lang/csharp/Continental.eCAL.Core/ecal_clr.h +++ b/lang/csharp/Continental.eCAL.Core/ecal_clr.h @@ -78,12 +78,6 @@ namespace Continental * @brief Send shutdown event to all user processes. **/ static void ShutdownProcesses(); - - /** - * @brief Send shutdown event to all core components. - * - **/ - static void ShutdownCore(); }; diff --git a/lang/python/core/ecal/core/core.py b/lang/python/core/ecal/core/core.py index a93b78ce77..08df76cb53 100644 --- a/lang/python/core/ecal/core/core.py +++ b/lang/python/core/ecal/core/core.py @@ -125,9 +125,9 @@ def shutdown_processes(): def shutdown_core(): - """ shutdown ecal core components + """ shutdown ecal core components (deprecated) """ - return _ecal.shutdown_core() + return _ecal.shutdown_processes() def log_setlevel(level): diff --git a/lang/python/core/src/ecal_clang.cpp b/lang/python/core/src/ecal_clang.cpp index 3f7886b864..200a0f3969 100644 --- a/lang/python/core/src/ecal_clang.cpp +++ b/lang/python/core/src/ecal_clang.cpp @@ -30,14 +30,39 @@ #include #include -static char* str_malloc(const std::string& buf_s_) +namespace { - void* cbuf = malloc(buf_s_.size()); - if(cbuf != nullptr) + char* str_malloc(const std::string& buf_s_) { - memcpy(cbuf, buf_s_.data(), buf_s_.size()); + void* cbuf = malloc(buf_s_.size()); + if (cbuf != nullptr) + { + memcpy(cbuf, buf_s_.data(), buf_s_.size()); + } + return(static_cast(cbuf)); + } + + bool GetTopicDataTypeInformation(const char* topic_name_, eCAL::SDataTypeInformation& topic_info_) + { + // try to find topic name in publisher set + for (const auto& pub_id : eCAL::Registration::GetPublisherIDs()) + { + if (pub_id.topic_name == topic_name_) + { + return eCAL::Registration::GetPublisherInfo(pub_id, topic_info_); + } + } + // try to find topic name in subscriber set + const auto& sub_ids = eCAL::Registration::GetSubscriberIDs(); + for (const auto& sub_id : sub_ids) + { + if (sub_id.topic_name == topic_name_) + { + return eCAL::Registration::GetSubscriberInfo(sub_id, topic_info_); + } + } + return false; } - return(static_cast(cbuf)); } /****************************************/ @@ -160,21 +185,14 @@ void ecal_shutdown_processes() eCAL::Util::ShutdownProcesses(); } -/****************************************/ -/* ecal_shutdown_core */ -/****************************************/ -void ecal_shutdown_core() -{ - eCAL::Util::ShutdownCore(); -} - /****************************************/ /* get_type_name */ /****************************************/ bool ecal_get_type_name(const char* topic_name_, const char** topic_type_, int* topic_type_len_) { eCAL::SDataTypeInformation topic_info; - bool ret = eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info); + // get the first matching topic type information for the given topic name found in either the publisher or subscriber id set ! + bool ret = GetTopicDataTypeInformation(topic_name_, topic_info); if(ret) { std::string topic_type_s = topic_info.name; @@ -202,7 +220,8 @@ bool ecal_get_type_name(const char* topic_name_, const char** topic_type_, int* bool ecal_get_type_encoding(const char* topic_name_, const char** topic_encoding_, int* topic_encoding_len_) { eCAL::SDataTypeInformation topic_info; - bool ret = eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info); + // get the first matching topic type information for the given topic name found in either the publisher or subscriber id set ! + bool ret = GetTopicDataTypeInformation(topic_name_, topic_info); if (ret) { std::string topic_encoding_s = topic_info.encoding; @@ -230,7 +249,8 @@ bool ecal_get_type_encoding(const char* topic_name_, const char** topic_encoding bool ecal_get_description(const char* topic_name_, const char** topic_desc_, int* topic_desc_len_) { eCAL::SDataTypeInformation topic_info; - bool ret = eCAL::Registration::GetTopicDataTypeInformation(topic_name_, topic_info); + // get the first matching topic type information for the given topic name found in either the publisher or subscriber id set ! + bool ret = GetTopicDataTypeInformation(topic_name_, topic_info); if(ret) { std::string topic_desc_s = topic_info.descriptor; diff --git a/lang/python/core/src/ecal_clang.h b/lang/python/core/src/ecal_clang.h index c05a753b0f..a42fd52f05 100644 --- a/lang/python/core/src/ecal_clang.h +++ b/lang/python/core/src/ecal_clang.h @@ -157,11 +157,6 @@ void ecal_shutdown_process_id(int process_id_); **/ void ecal_shutdown_processes(); -/** - * @brief Send shutdown event to all local core components. -**/ -void ecal_shutdown_core(); - /** * @brief Gets type name of the specified topic. * diff --git a/lang/python/core/src/ecal_wrap.cxx b/lang/python/core/src/ecal_wrap.cxx index 1c3d77f357..5f512f5be3 100644 --- a/lang/python/core/src/ecal_wrap.cxx +++ b/lang/python/core/src/ecal_wrap.cxx @@ -226,16 +226,6 @@ PyObject* shutdown_processes(PyObject* /*self*/, PyObject* /*args*/) Py_RETURN_NONE; } -/****************************************/ -/* shutdown_core */ -/****************************************/ -PyObject* shutdown_core(PyObject* /*self*/, PyObject* /*args*/) -{ - ecal_shutdown_core(); - - Py_RETURN_NONE; -} - /****************************************/ /* log_setlevel */ /****************************************/ @@ -1330,7 +1320,6 @@ static PyMethodDef _ecal_methods[] = {"ok", ok, METH_NOARGS, "ok()"}, {"shutdown_process_uname", shutdown_process_uname, METH_VARARGS, "shutdown_process_uname(unit_name)"}, {"shutdown_processes", shutdown_processes, METH_NOARGS, "shutdown_processes()"}, - {"shutdown_core", shutdown_core, METH_NOARGS, "shutdown_core()"}, {"log_setlevel", log_setlevel, METH_VARARGS, "log_setlevel(level)"}, {"log_message", log_message, METH_VARARGS, "log_message(message)"}, diff --git a/samples/cpp/pubsub/capnp/addressbook_rec_dynamic/src/addressbook_rec_dynamic.cpp b/samples/cpp/pubsub/capnp/addressbook_rec_dynamic/src/addressbook_rec_dynamic.cpp index a8cd007519..8546f2a130 100644 --- a/samples/cpp/pubsub/capnp/addressbook_rec_dynamic/src/addressbook_rec_dynamic.cpp +++ b/samples/cpp/pubsub/capnp/addressbook_rec_dynamic/src/addressbook_rec_dynamic.cpp @@ -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. @@ -115,7 +115,7 @@ int main(int argc, char** argv) // create a subscriber (topic name "addressbook") eCAL::capnproto::CDynamicSubscriber sub("addressbook"); - auto lambda = [](const char* /*topic_name_*/, const capnp::DynamicValue::Reader& msg_, long long /*time_*/, long long /*clock_*/, long long /*id_*/) -> void { + auto lambda = [](const eCAL::Registration::STopicId& /*topic_id_*/, const capnp::DynamicValue::Reader& msg_, long long /*time_*/, long long /*clock_*/, long long /*id_*/) -> void { dynamicPrintValue(msg_); }; sub.AddReceiveCallback(lambda);