diff --git a/app/rec/rec_client_core/include/rec_client_core/topic_info.h b/app/rec/rec_client_core/include/rec_client_core/topic_info.h index ee9e53a0f1..e598bb8c34 100644 --- a/app/rec/rec_client_core/include/rec_client_core/topic_info.h +++ b/app/rec/rec_client_core/include/rec_client_core/topic_info.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,5 +75,7 @@ namespace eCAL std::map> publishers_; }; + + using TopicInfoMap = std::map; } } \ No newline at end of file diff --git a/app/rec/rec_client_core/src/ecal_rec_impl.cpp b/app/rec/rec_client_core/src/ecal_rec_impl.cpp index 52d7c8beda..e30525a545 100644 --- a/app/rec/rec_client_core/src/ecal_rec_impl.cpp +++ b/app/rec/rec_client_core/src/ecal_rec_impl.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2024 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -695,12 +695,12 @@ namespace eCAL return subscribed_topics; } - void EcalRecImpl::EcalMessageReceived(const eCAL::Registration::STopicId& topic_id_, const eCAL::SReceiveCallbackData& data_) + void EcalRecImpl::EcalMessageReceived(const Registration::STopicId& topic_id_, const SDataTypeInformation& datatype_info_, const SReceiveCallbackData& callback_data_) { auto ecal_receive_time = eCAL::Time::ecal_clock::now(); auto system_receive_time = std::chrono::steady_clock::now(); - std::shared_ptr frame = std::make_shared(&data_, topic_id_.topic_name, ecal_receive_time, system_receive_time); + std::shared_ptr frame = std::make_shared(callback_data_, topic_id_, ecal_receive_time, system_receive_time); pre_buffer_.push_back(frame); @@ -721,7 +721,7 @@ namespace eCAL pre_buffer_.remove_old_frames(); } - void EcalRecImpl::SetTopicInfo(const std::map& topic_info_map) + void EcalRecImpl::SetTopicInfo(const TopicInfoMap& topic_info_map) { // Create subscribers for new topics if necessary { @@ -762,7 +762,7 @@ namespace eCAL RemoveOldSubscribers_NoLock(filtered_topic_set); } - std::set EcalRecImpl::FilterAvailableTopics_NoLock(const std::map& topic_info_map) const + std::set EcalRecImpl::FilterAvailableTopics_NoLock(const TopicInfoMap& topic_info_map) const { std::set topic_set; @@ -776,13 +776,13 @@ namespace eCAL // Evaluate the record mode (All / Blacklist / Whitelist) if ((record_mode_ == RecordMode::Blacklist) - && (listed_topics_.find(topic_info.first) != listed_topics_.end())) + && (listed_topics_.find(topic_info.first.topic_name) != listed_topics_.end())) { // The topic is blacklisted continue; } else if ((record_mode_ == RecordMode::Whitelist) - && (listed_topics_.find(topic_info.first) == listed_topics_.end())) + && (listed_topics_.find(topic_info.first.topic_name) == listed_topics_.end())) { // The topic is not whitelisted continue; @@ -808,7 +808,7 @@ namespace eCAL } // Add the topic to the filtered set if we haven't found any reason not to do that :) - topic_set.emplace(topic_info.first); + topic_set.emplace(topic_info.first.topic_name); } return topic_set; @@ -828,7 +828,7 @@ namespace eCAL info_ = { false, "Error creating eCAL subsribers" }; continue; } - if (!subscriber->SetReceiveCallback(std::bind(&EcalRecImpl::EcalMessageReceived, this, std::placeholders::_1, std::placeholders::_3))) + if (!subscriber->SetReceiveCallback(std::bind(&EcalRecImpl::EcalMessageReceived, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))) { EcalRecLogger::Instance()->error("Error adding callback for subscriber on topic " + topic); info_ = { false, "Error creating eCAL subsribers" }; diff --git a/app/rec/rec_client_core/src/ecal_rec_impl.h b/app/rec/rec_client_core/src/ecal_rec_impl.h index 1c1e42ff15..7ff536b434 100644 --- a/app/rec/rec_client_core/src/ecal_rec_impl.h +++ b/app/rec/rec_client_core/src/ecal_rec_impl.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2024 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,14 +115,14 @@ namespace eCAL std::set GetSubscribedTopics() const; - void EcalMessageReceived(const eCAL::Registration::STopicId& topic_id_, const eCAL::SReceiveCallbackData& data_); + void EcalMessageReceived(const Registration::STopicId& topic_id_, const SDataTypeInformation& datatype_info_, const SReceiveCallbackData& callback_data_); ////////////////////////////////////// //// API for external threads //// ////////////////////////////////////// void GarbageCollect(); - void SetTopicInfo(const std::map& topic_info_map); + void SetTopicInfo(const TopicInfoMap& topic_info_map); ////////////////////////////////////////////////////////////////////////////// //// Private functions //// @@ -130,7 +130,7 @@ namespace eCAL private: void UpdateAndCleanSubscribers(); - std::set FilterAvailableTopics_NoLock(const std::map& topic_info_map) const; + std::set FilterAvailableTopics_NoLock(const TopicInfoMap& topic_info_map) const; void CreateNewSubscribers_NoLock(const std::set& topic_set); void RemoveOldSubscribers_NoLock(const std::set& topic_set); diff --git a/app/rec/rec_client_core/src/frame.h b/app/rec/rec_client_core/src/frame.h index d65d1f2326..1014fa7e69 100644 --- a/app/rec/rec_client_core/src/frame.h +++ b/app/rec/rec_client_core/src/frame.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. @@ -32,16 +32,16 @@ namespace eCAL class Frame { public: - Frame(const eCAL::SReceiveCallbackData* const callback_data, const std::string& topic_name, const eCAL::Time::ecal_clock::time_point receive_time, std::chrono::steady_clock::time_point system_receive_time) - : ecal_publish_time_(std::chrono::duration_cast(std::chrono::microseconds(callback_data->time))) + Frame(const eCAL::SReceiveCallbackData& callback_data, const Registration::STopicId& topic, const eCAL::Time::ecal_clock::time_point receive_time, std::chrono::steady_clock::time_point system_receive_time) + : ecal_publish_time_(std::chrono::duration_cast(std::chrono::microseconds(callback_data.time))) , ecal_receive_time_(receive_time) , system_receive_time_(system_receive_time) - , topic_name_(topic_name) - , clock_(callback_data->clock) - , id_(callback_data->id) + , topic_(topic) + , clock_(callback_data.clock) + , id_(callback_data.id) { - data_.reserve(callback_data->size); - data_.assign((char*)callback_data->buf, (char*)callback_data->buf + callback_data->size); + data_.reserve(callback_data.size); + data_.assign((char*)callback_data.buf, (char*)callback_data.buf + callback_data.size); } Frame() @@ -57,7 +57,7 @@ namespace eCAL eCAL::Time::ecal_clock::time_point ecal_publish_time_; eCAL::Time::ecal_clock::time_point ecal_receive_time_; std::chrono::steady_clock::time_point system_receive_time_; - std::string topic_name_; + Registration::STopicId topic_; long long clock_; long long id_; }; diff --git a/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp b/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp index 10065714cb..86119501da 100644 --- a/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp +++ b/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2024 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ namespace eCAL // Constructor & Destructor /////////////////////////////// - Hdf5WriterThread::Hdf5WriterThread(const JobConfig& job_config, const std::map& initial_topic_info_map, const std::deque>& initial_frame_buffer) + Hdf5WriterThread::Hdf5WriterThread(const JobConfig& job_config, const TopicInfoMap& initial_topic_info_map, const std::deque>& initial_frame_buffer) : InterruptibleThread () , job_config_ (job_config) , frame_buffer_ (initial_frame_buffer) @@ -41,7 +41,7 @@ namespace eCAL , new_topic_info_map_available_(true) , flushing_ (false) { - hdf5_writer_ = std::make_unique(); + hdf5_writer_ = std::make_unique(); } Hdf5WriterThread::~Hdf5WriterThread() @@ -82,7 +82,7 @@ namespace eCAL } } - void Hdf5WriterThread::SetTopicInfo(std::map topic_info_map) + void Hdf5WriterThread::SetTopicInfo(TopicInfoMap topic_info_map) { std::unique_lock input_lock(input_mutex_); @@ -128,7 +128,7 @@ namespace eCAL // Topic info to write to the HDF5 file bool set_topic_info_map = false; - std::map topic_info_map_to_set; + TopicInfoMap topic_info_map_to_set; { // Lock the input mutex @@ -168,8 +168,10 @@ namespace eCAL for (const auto& topic : topic_info_map_to_set) { + // convert from eCAL core types to eCAL measurement types before writing to the measurement. + eh5::SChannel channel{ topic.first.topic_name, topic.first.topic_id.entity_id }; eCAL::experimental::measurement::base::DataTypeInformation const topic_info{ topic.second.tinfo_.name, topic.second.tinfo_.encoding, topic.second.tinfo_.descriptor }; - hdf5_writer_->SetChannelDataTypeInformation(topic.first, topic_info); + hdf5_writer_->SetChannelDataTypeInformation(channel, topic_info); } } else if (frame) @@ -180,14 +182,18 @@ namespace eCAL break; // Write Frame element to HDF5 + eh5::SWriteEntry entry; + // in hdf5, ids are integers, however SEntityIds are not, so we need to convert. + entry.channel = eh5::SChannel(frame->topic_.topic_name, frame->topic_.topic_id.entity_id); + entry.data = frame->data_.data(); + entry.size = frame->data_.size(); + entry.snd_timestamp = std::chrono::duration_cast(frame->ecal_publish_time_.time_since_epoch()).count(); + entry.rcv_timestamp = std::chrono::duration_cast(frame->ecal_receive_time_.time_since_epoch()).count(); + entry.sender_id = frame->id_; + entry.clock = frame->clock_; + if (!hdf5_writer_->AddEntryToFile( - frame->data_.data(), - frame->data_.size(), - std::chrono::duration_cast(frame->ecal_publish_time_.time_since_epoch()).count(), - std::chrono::duration_cast(frame->ecal_receive_time_.time_since_epoch()).count(), - frame->topic_name_, - frame->id_, - frame->clock_ + entry )) { last_status_.info_ = { false, "Error adding frame to measurement" }; @@ -264,7 +270,7 @@ namespace eCAL #endif // NDEBUG std::unique_lock hdf5_writer_lock(hdf5_writer_mutex_); - if (hdf5_writer_->Open(hdf5_dir, eCAL::eh5::v2::eAccessType::CREATE)) + if (hdf5_writer_->Open(hdf5_dir, eCAL::eh5::eAccessType::CREATE)) { #ifndef NDEBUG EcalRecLogger::Instance()->debug("Hdf5WriterThread::Open(): Successfully opened HDF5-Writer with path \"" + hdf5_dir + "\""); diff --git a/app/rec/rec_client_core/src/job/hdf5_writer_thread.h b/app/rec/rec_client_core/src/job/hdf5_writer_thread.h index 91e3982c42..6bc36f732a 100644 --- a/app/rec/rec_client_core/src/job/hdf5_writer_thread.h +++ b/app/rec/rec_client_core/src/job/hdf5_writer_thread.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2024 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ namespace eCAL // Constructor & Destructor /////////////////////////////// public: - Hdf5WriterThread(const JobConfig& job_config, const std::map& initial_topic_info_map = {}, const std::deque>& initial_frame_buffer = {}); + Hdf5WriterThread(const JobConfig& job_config, const TopicInfoMap& initial_topic_info_map = {}, const std::deque>& initial_frame_buffer = {}); ~Hdf5WriterThread(); @@ -53,7 +53,7 @@ namespace eCAL bool AddFrame(const std::shared_ptr& frame); - void SetTopicInfo(std::map topic_info_map); // CALL BY VALUE (-> copy) IS INTENDED! + void SetTopicInfo(TopicInfoMap topic_info_map); // CALL BY VALUE (-> copy) IS INTENDED! void Flush(); @@ -89,12 +89,12 @@ namespace eCAL size_t written_frames_; std::chrono::steady_clock::time_point first_written_frame_timestamp_; std::chrono::steady_clock::time_point last_written_frame_timestamp_; - std::map new_topic_info_map_; /**< The new topic info map that shall be set to the HDF5 writer */ + TopicInfoMap new_topic_info_map_; /**< The new topic info map that shall be set to the HDF5 writer */ bool new_topic_info_map_available_; /**< Telling that a new topic info map has been set from the outside. */ mutable RecHdf5JobStatus last_status_; - mutable std::mutex hdf5_writer_mutex_; - std::unique_ptr hdf5_writer_; + mutable std::mutex hdf5_writer_mutex_; + std::unique_ptr hdf5_writer_; std::atomic flushing_; diff --git a/app/rec/rec_client_core/src/job/record_job.cpp b/app/rec/rec_client_core/src/job/record_job.cpp index 4016c70f08..0b7712cd5f 100644 --- a/app/rec/rec_client_core/src/job/record_job.cpp +++ b/app/rec/rec_client_core/src/job/record_job.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -283,7 +283,7 @@ namespace eCAL return true; } - bool RecordJob::StartRecording(const std::map& initial_topic_info_map, const std::deque>& initial_frame_buffer) + bool RecordJob::StartRecording(const TopicInfoMap& initial_topic_info_map, const std::deque>& initial_frame_buffer) { std::unique_lock lock(job_mutex_); @@ -317,7 +317,7 @@ namespace eCAL } - bool RecordJob::SaveBuffer(const std::map& topic_info_map, const std::deque>& frame_buffer) + bool RecordJob::SaveBuffer(const TopicInfoMap& topic_info_map, const std::deque>& frame_buffer) { std::unique_lock lock(job_mutex_); @@ -344,7 +344,7 @@ namespace eCAL return hdf5_writer_thread_->AddFrame(frame); } - void RecordJob::SetTopicInfo(const std::map& topic_info_map) + void RecordJob::SetTopicInfo(const TopicInfoMap& topic_info_map) { std::shared_lock lock(job_mutex_); if ((main_recorder_state_ != JobState::Recording) || !hdf5_writer_thread_) diff --git a/app/rec/rec_client_core/src/job/record_job.h b/app/rec/rec_client_core/src/job/record_job.h index 70d1175fa8..5d7bc3396b 100644 --- a/app/rec/rec_client_core/src/job/record_job.h +++ b/app/rec/rec_client_core/src/job/record_job.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,12 +64,12 @@ namespace eCAL /////////////////////////////////////////////// public: bool InitializeMeasurementDirectory(); - bool StartRecording(const std::map& initial_topic_info_map, const std::deque>& initial_frame_buffer); + bool StartRecording(const TopicInfoMap& initial_topic_info_map, const std::deque>& initial_frame_buffer); bool StopRecording (); - bool SaveBuffer (const std::map& topic_info_map, const std::deque>& frame_buffer); + bool SaveBuffer (const TopicInfoMap& topic_info_map, const std::deque>& frame_buffer); bool AddFrame(const std::shared_ptr& frame); - void SetTopicInfo(const std::map& topic_info_map); + void SetTopicInfo(const TopicInfoMap& topic_info_map); eCAL::rec::Error Upload(const UploadConfig& upload_config); diff --git a/app/rec/rec_client_core/src/monitoring_thread.cpp b/app/rec/rec_client_core/src/monitoring_thread.cpp index fc39479a4a..bc53ea113c 100644 --- a/app/rec/rec_client_core/src/monitoring_thread.cpp +++ b/app/rec/rec_client_core/src/monitoring_thread.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,16 +23,6 @@ #include -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4100 4127 4146 4505 4800 4189 4592) // disable proto warnings -#endif -#include -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif - #include "rec_client_core/ecal_rec_logger.h" #include "ecal_rec_impl.h" @@ -50,156 +40,25 @@ namespace eCAL void MonitoringThread::Loop() { - std::string monitoring_string; - eCAL::pb::Monitoring monitoring_pb; + TopicInfoMap topic_info_snapshot; + auto publisher_ids = eCAL::Registration::GetPublisherIDs(); - if (eCAL::Monitoring::GetMonitoring(monitoring_string)) + for (const auto& publisher_id : publisher_ids) { - monitoring_pb.Clear(); - monitoring_pb.ParseFromString(monitoring_string); - - - { - std::lock_guard monitoring_lock(monitoring_mutex_); - - // Clear publisher lists of all topics - for (auto& topic_info : topic_info_map_) - { - topic_info.second.publishers_.clear(); - } - - // Collect all descriptors - std::map>> channel_descriptor_map; // ChannelName -> {Type, Descriptor} - std::map> type_descriptor_map; // Type -> Descriptor (used for topics that we know the type of, but have no other information available) - - static const int DESCRIPTION_AVAILABLE_QUALITYBIT = 0x1 << 3; // Having a descriptor at all is the most important thing - static const int INFO_COMES_FROM_CORRECT_TOPIC_QUALITYBIT = 0x1 << 2; // The information comes from the current topic (and has not been borrowed from another topic) - static const int INFO_COMES_FROM_PUBLISHER_QUALITYBIT = 0x1 << 1; // A descriptor coming from the publisher is better than one from a subsriber, as we assume that the publisher knows best what he is publishing - static const int TYPE_AVAILABLE_QUALITYBIT = 0x1 << 0; // Having information about the type's name available is nice but not that important to us. - - for (const auto& topic : monitoring_pb.topics()) - { - // Lookup the topic map entry - auto topic_info_map_it = topic_info_map_.find(topic.tname()); - if (topic_info_map_it == topic_info_map_.end()) - { - // Create a new topic entry - topic_info_map_.emplace(topic.tname(), eCAL::rec::TopicInfo("", "", "")); - topic_info_map_it = topic_info_map_.find(topic.tname()); - } - - // Create combined encoding:type type (to be fully compatible to old behavior) - std::string combined_enc_type = eCAL::Util::CombinedTopicEncodingAndType(topic.tdatatype().encoding(), topic.tdatatype().name()); - - // Evaluate the quality of the current descriptor information - int this_topic_info_quality = 0; - - if (!topic.tdatatype().desc().empty()) - { - this_topic_info_quality |= DESCRIPTION_AVAILABLE_QUALITYBIT; - } - - this_topic_info_quality |= INFO_COMES_FROM_CORRECT_TOPIC_QUALITYBIT; - - if (EcalUtils::String::Icompare(topic.direction(), "publisher")) - { - this_topic_info_quality |= INFO_COMES_FROM_PUBLISHER_QUALITYBIT; - - // Also update the publisher list - auto existing_publisher_it = topic_info_map_it->second.publishers_.find(topic.hname()); - if (existing_publisher_it != topic_info_map_it->second.publishers_.end()) - { - existing_publisher_it->second.emplace(topic.uname()); - } - else - { - topic_info_map_it->second.publishers_.emplace(topic.hname(), std::set{topic.uname()}); - } - } - - if (!combined_enc_type.empty()) - { - this_topic_info_quality |= TYPE_AVAILABLE_QUALITYBIT; - } - - // Update the channel_descriptor_map - { - auto channel_descriptor_map_it = channel_descriptor_map.find(topic.tname()); - if (channel_descriptor_map_it == channel_descriptor_map.end()) - { - // Save the new descriptor - channel_descriptor_map.emplace(topic.tname(), std::make_pair(this_topic_info_quality, std::make_pair(combined_enc_type, topic.tdatatype().desc()))); - } - else - { - if(channel_descriptor_map_it->second.first < this_topic_info_quality) - { - // If the old descriptor has a lower quality than the current descriptor, we may overwrite it! - channel_descriptor_map_it->second = std::make_pair(this_topic_info_quality, std::make_pair(combined_enc_type, topic.tdatatype().desc())); - } - } - } - - // Update the type_descriptor_map (can of course only work if we have the type information available) - if (!combined_enc_type.empty()) - { - int quality_for_other_channels = (this_topic_info_quality & ~INFO_COMES_FROM_CORRECT_TOPIC_QUALITYBIT); - - auto type_descriptor_map_it = type_descriptor_map.find(combined_enc_type); - if (type_descriptor_map_it == type_descriptor_map.end()) - { - // Save the new descriptor - type_descriptor_map.emplace(combined_enc_type, std::make_pair(quality_for_other_channels, topic.tdatatype().desc())); - } - else - { - if(type_descriptor_map_it->second.first < quality_for_other_channels) - { - // If the old descriptor has a lower quality than the current descriptor, we may overwrite it! - type_descriptor_map_it->second = std::make_pair(quality_for_other_channels, topic.tdatatype().desc()); - } - } - } - } - - // Update the type/descriptor information of the topic_info_map_ - for (auto& topic_info_map_entry : topic_info_map_) - { - auto channel_descriptor_entry_it = channel_descriptor_map.find(topic_info_map_entry.first); - if ((channel_descriptor_entry_it != channel_descriptor_map.end()) - && (channel_descriptor_entry_it->second.first >= topic_info_map_entry.second.description_quality_)) - { - topic_info_map_entry.second.SetLegacyType(channel_descriptor_entry_it->second.second.first); - topic_info_map_entry.second.tinfo_.descriptor = channel_descriptor_entry_it->second.second.second; - topic_info_map_entry.second.description_quality_ = channel_descriptor_entry_it->second.first; - } - - if (!topic_info_map_entry.second.GetLegacyType().empty()) - { - auto type_descriptor_entry_it = type_descriptor_map.find(topic_info_map_entry.second.GetLegacyType()); - if ((type_descriptor_entry_it != type_descriptor_map.end()) - && (type_descriptor_entry_it->second.first >= topic_info_map_entry.second.description_quality_)) - { - topic_info_map_entry.second.tinfo_.descriptor = type_descriptor_entry_it->second.second; - topic_info_map_entry.second.description_quality_ = type_descriptor_entry_it->second.first; - } - } - } - } - - recorder_.SetTopicInfo(topic_info_map_); - } - else - { - EcalRecLogger::Instance()->debug("eCAL::Monitoring::GetMonitoring - failure"); + SDataTypeInformation datatype_info; + eCAL::Registration::GetPublisherInfo(publisher_id, datatype_info); + topic_info_snapshot.insert({ publisher_id , std::move(datatype_info) }); } + + std::lock_guard monitoring_lock(monitoring_mutex_); + topic_info_map_ = std::move(topic_info_snapshot); } - TopicInfo MonitoringThread::GetTopicInfo(const std::string& topic_name) const + TopicInfo MonitoringThread::GetTopicInfo(const Registration::STopicId& topic) const { std::lock_guard monitoring_lock(monitoring_mutex_); - auto topic_info_map_it = topic_info_map_.find(topic_name); + auto topic_info_map_it = topic_info_map_.find(topic); if (topic_info_map_it != topic_info_map_.end()) { return topic_info_map_it->second; @@ -210,7 +69,7 @@ namespace eCAL } } - std::map MonitoringThread::GetTopicInfoMap() const + TopicInfoMap MonitoringThread::GetTopicInfoMap() const { std::lock_guard monitoring_lock(monitoring_mutex_); return topic_info_map_; diff --git a/app/rec/rec_client_core/src/monitoring_thread.h b/app/rec/rec_client_core/src/monitoring_thread.h index 8d5bd83d88..adc1db0953 100644 --- a/app/rec/rec_client_core/src/monitoring_thread.h +++ b/app/rec/rec_client_core/src/monitoring_thread.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,18 +37,18 @@ namespace eCAL MonitoringThread(EcalRecImpl& recorder); ~MonitoringThread(); - TopicInfo GetTopicInfo(const std::string& topic_name) const; + TopicInfo GetTopicInfo(const Registration::STopicId& topic) const; - std::map GetTopicInfoMap() const; + TopicInfoMap GetTopicInfoMap() const; protected: void Loop() override; private: - EcalRecImpl& recorder_; + EcalRecImpl& recorder_; mutable std::mutex monitoring_mutex_; - std::map topic_info_map_; + TopicInfoMap topic_info_map_; }; } } \ No newline at end of file