From 9ad717766025701d0bd23aa2dcb08a4561984e25 Mon Sep 17 00:00:00 2001 From: Kerstin Keller Date: Tue, 30 Jan 2024 15:41:56 +0100 Subject: [PATCH] GetChannelDataTypeInformation and SetChannelDataTypeInformation in all of eh5. --- contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h | 22 +++++- contrib/ecalhdf5/include/ecalhdf5/eh5_types.h | 2 + contrib/ecalhdf5/src/eh5_meas.cpp | 29 ++------ contrib/ecalhdf5/src/eh5_meas_dir.cpp | 39 +++------- contrib/ecalhdf5/src/eh5_meas_dir.h | 49 ++++-------- contrib/ecalhdf5/src/eh5_meas_file_v1.cpp | 24 ++---- contrib/ecalhdf5/src/eh5_meas_file_v1.h | 41 ++++------ contrib/ecalhdf5/src/eh5_meas_file_v2.cpp | 28 ++----- contrib/ecalhdf5/src/eh5_meas_file_v2.h | 41 ++++------ .../ecalhdf5/src/eh5_meas_file_writer_v5.cpp | 20 ++--- .../ecalhdf5/src/eh5_meas_file_writer_v5.h | 41 ++++------ contrib/ecalhdf5/src/eh5_meas_impl.h | 74 ++++++++++++------- contrib/measurement/hdf5/src/reader.cpp | 29 +------- contrib/measurement/hdf5/src/writer.cpp | 19 +---- 14 files changed, 159 insertions(+), 299 deletions(-) diff --git a/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h b/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h index 44c45cbedd..4b3c64df96 100644 --- a/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h +++ b/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h @@ -187,6 +187,7 @@ namespace eCAL * * @return channel description **/ + [[deprecated("Please use GetChannelDataTypeInformation instead")]] std::string GetChannelDescription(const std::string& channel_name) const; /** @@ -195,6 +196,7 @@ namespace eCAL * @param channel_name channel name * @param description description of the channel **/ + [[deprecated("Please use SetChannelDataTypeInformation instead")]] void SetChannelDescription(const std::string& channel_name, const std::string& description); /** @@ -204,6 +206,7 @@ namespace eCAL * * @return channel type **/ + [[deprecated("Please use GetChannelDataTypeInformation instead")]] std::string GetChannelType(const std::string& channel_name) const; /** @@ -212,10 +215,27 @@ namespace eCAL * @param channel_name channel name * @param type type of the channel **/ + [[deprecated("Please use SetChannelDataTypeInformation instead")]] void SetChannelType(const std::string& channel_name, const std::string& type); + /** + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type + **/ + DataTypeInformation GetChannelDataTypeInformation(const std::string& channel_name) const; - + /** + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type + **/ + void SetChannelDataTypeInformation(const std::string& channel_name, const DataTypeInformation& info); /** * @brief Gets minimum timestamp for specified channel diff --git a/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h b/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h index 18332bb5fb..91351e56b5 100644 --- a/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h +++ b/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h @@ -49,6 +49,8 @@ namespace eCAL using eAccessType = eCAL::experimental::measurement::base::AccessType; using eCAL::experimental::measurement::base::RDONLY; using eCAL::experimental::measurement::base::CREATE; + + using eCAL::experimental::measurement::base::DataTypeInformation; //!< @endcond } // namespace eh5 } // namespace eCAL diff --git a/contrib/ecalhdf5/src/eh5_meas.cpp b/contrib/ecalhdf5/src/eh5_meas.cpp index ce70758905..84376f29aa 100644 --- a/contrib/ecalhdf5/src/eh5_meas.cpp +++ b/contrib/ecalhdf5/src/eh5_meas.cpp @@ -233,41 +233,22 @@ bool eCAL::eh5::HDF5Meas::HasChannel(const std::string& channel_name) const return ret_val; } -std::string eCAL::eh5::HDF5Meas::GetChannelDescription(const std::string& channel_name) const +eCAL::eh5::DataTypeInformation eCAL::eh5::HDF5Meas::GetChannelDataTypeInformation(const std::string& channel_name) const { - std::string ret_val; - if (hdf_meas_impl_) - { - ret_val = hdf_meas_impl_->GetChannelDescription(GetEscapedTopicname(channel_name)); - } - - return ret_val; -} - -void eCAL::eh5::HDF5Meas::SetChannelDescription(const std::string& channel_name, const std::string& description) -{ - if (hdf_meas_impl_) - { - hdf_meas_impl_->SetChannelDescription(GetEscapedTopicname(channel_name), description); - } -} - -std::string eCAL::eh5::HDF5Meas::GetChannelType(const std::string& channel_name) const -{ - std::string ret_val; + eCAL::eh5::DataTypeInformation ret_val; if (hdf_meas_impl_) { - ret_val = hdf_meas_impl_->GetChannelType(GetEscapedTopicname(channel_name)); + ret_val = hdf_meas_impl_->GetChannelDataTypeInformation(GetEscapedTopicname(channel_name)); } return ret_val; } -void eCAL::eh5::HDF5Meas::SetChannelType(const std::string& channel_name, const std::string& type) +void eCAL::eh5::HDF5Meas::SetChannelDataTypeInformation(const std::string& channel_name, const eCAL::eh5::DataTypeInformation& info) { if (hdf_meas_impl_) { - hdf_meas_impl_->SetChannelType(GetEscapedTopicname(channel_name), type); + hdf_meas_impl_->SetChannelDataTypeInformation(GetEscapedTopicname(channel_name), info); } } diff --git a/contrib/ecalhdf5/src/eh5_meas_dir.cpp b/contrib/ecalhdf5/src/eh5_meas_dir.cpp index d2750d3184..150f395a4f 100644 --- a/contrib/ecalhdf5/src/eh5_meas_dir.cpp +++ b/contrib/ecalhdf5/src/eh5_meas_dir.cpp @@ -196,44 +196,24 @@ bool eCAL::eh5::HDF5MeasDir::HasChannel(const std::string& channel_name) const return channels_info_.count(channel_name) != 0; } -std::string eCAL::eh5::HDF5MeasDir::GetChannelDescription(const std::string& channel_name) const +eCAL::eh5::DataTypeInformation eCAL::eh5::HDF5MeasDir::GetChannelDataTypeInformation(const std::string& channel_name) const { - std::string ret_val; + eCAL::eh5::DataTypeInformation ret_val; const auto& found = channels_info_.find(channel_name); if (found != channels_info_.end()) { - ret_val = found->second.description; + ret_val = found->second.info; } return ret_val; } -void eCAL::eh5::HDF5MeasDir::SetChannelDescription(const std::string& channel_name, const std::string& description) +void eCAL::eh5::HDF5MeasDir::SetChannelDataTypeInformation(const std::string& channel_name, const eCAL::eh5::DataTypeInformation& info) { // Get an existing writer or create a new one auto file_writer_it = GetWriter(channel_name); - file_writer_it->second->SetChannelDescription(channel_name, description); -} - -std::string eCAL::eh5::HDF5MeasDir::GetChannelType(const std::string& channel_name) const -{ - std::string ret_val; - - const auto& found = channels_info_.find(channel_name); - - if (found != channels_info_.end()) - { - ret_val = found->second.type; - } - return ret_val; -} - -void eCAL::eh5::HDF5MeasDir::SetChannelType(const std::string& channel_name, const std::string& type) -{ - // Get an existing writer or create a new one - auto file_writer_it = GetWriter(channel_name); - file_writer_it->second->SetChannelType(channel_name, type); + file_writer_it->second->SetChannelDataTypeInformation(channel_name, info); } long long eCAL::eh5::HDF5MeasDir::GetMinTimestamp(const std::string& channel_name) const @@ -457,17 +437,18 @@ bool eCAL::eh5::HDF5MeasDir::OpenRX(const std::string& path, eAccessType access for (const auto& channel : channels) { auto escaped_name = GetEscapedTopicname(channel); - auto description = reader->GetChannelDescription(channel); + auto info = reader->GetChannelDataTypeInformation(channel); + // What exactly does that do? what are we overwriting? if (channels_info_.find(escaped_name) == channels_info_.end()) { - channels_info_[escaped_name] = ChannelInfo(reader->GetChannelType(channel), description); + channels_info_[escaped_name] = ChannelInfo(info); } else { - if (!description.empty()) + if (!info.descriptor.empty()) { - channels_info_[escaped_name].description = description; + channels_info_[escaped_name].info.descriptor = info.descriptor; } } diff --git a/contrib/ecalhdf5/src/eh5_meas_dir.h b/contrib/ecalhdf5/src/eh5_meas_dir.h index 30d2308970..f6287b3e9c 100644 --- a/contrib/ecalhdf5/src/eh5_meas_dir.h +++ b/contrib/ecalhdf5/src/eh5_meas_dir.h @@ -143,38 +143,23 @@ namespace eCAL bool HasChannel(const std::string& channel_name) const override; /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - std::string GetChannelDescription(const std::string& channel_name) const override; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type **/ - void SetChannelDescription(const std::string& channel_name, const std::string& description) override; + DataTypeInformation GetChannelDataTypeInformation(const std::string& channel_name) const override; /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - std::string GetChannelType(const std::string& channel_name) const override; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type **/ - void SetChannelType(const std::string& channel_name, const std::string& type) override; + void SetChannelDataTypeInformation(const std::string& channel_name, const DataTypeInformation& info) override; /** * @brief Gets minimum timestamp for specified channel @@ -280,14 +265,12 @@ namespace eCAL protected: struct ChannelInfo { - std::string type; - std::string description; + DataTypeInformation info; std::list files; ChannelInfo() = default; - ChannelInfo(const std::string& type_, const std::string& description_) - : type(type_) - , description(description_) + ChannelInfo(const DataTypeInformation& info_) + : info(info_) {} }; diff --git a/contrib/ecalhdf5/src/eh5_meas_file_v1.cpp b/contrib/ecalhdf5/src/eh5_meas_file_v1.cpp index 02fed6dbec..20d1381f1d 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_v1.cpp +++ b/contrib/ecalhdf5/src/eh5_meas_file_v1.cpp @@ -164,32 +164,22 @@ bool eCAL::eh5::HDF5MeasFileV1::HasChannel(const std::string& channel_name) cons return std::find(channels.cbegin(), channels.cend(), channel_name) != channels.end(); } -std::string eCAL::eh5::HDF5MeasFileV1::GetChannelDescription(const std::string& channel_name) const +eCAL::eh5::DataTypeInformation eCAL::eh5::HDF5MeasFileV1::GetChannelDataTypeInformation(const std::string& channel_name) const { - std::string description; + std::string type; if (EcalUtils::String::Icompare(channel_name, channel_name_)) - GetAttributeValue(file_id_, kChnDescAttrTitle, description); - - return description; -} - -void eCAL::eh5::HDF5MeasFileV1::SetChannelDescription(const std::string& /*channel_name*/, const std::string& /*description*/) -{ - ReportUnsupportedAction(); -} + GetAttributeValue(file_id_, kChnTypeAttrTitle, type); -std::string eCAL::eh5::HDF5MeasFileV1::GetChannelType(const std::string& channel_name) const -{ - std::string type; + std::string description; if (EcalUtils::String::Icompare(channel_name, channel_name_)) - GetAttributeValue(file_id_, kChnTypeAttrTitle, type); + GetAttributeValue(file_id_, kChnDescAttrTitle, description); - return type; + return CreateInfo(type, description); } -void eCAL::eh5::HDF5MeasFileV1::SetChannelType(const std::string& /*channel_name*/, const std::string& /*type*/) +void eCAL::eh5::HDF5MeasFileV1::SetChannelDataTypeInformation(const std::string& /*channel_name*/, const eCAL::eh5::DataTypeInformation& /*info*/) { ReportUnsupportedAction(); } diff --git a/contrib/ecalhdf5/src/eh5_meas_file_v1.h b/contrib/ecalhdf5/src/eh5_meas_file_v1.h index 38cf339eb7..317733c80d 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_v1.h +++ b/contrib/ecalhdf5/src/eh5_meas_file_v1.h @@ -135,38 +135,23 @@ namespace eCAL bool HasChannel(const std::string& channel_name) const override; /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - std::string GetChannelDescription(const std::string& channel_name) const override; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type **/ - void SetChannelDescription(const std::string& channel_name, const std::string& description) override; + DataTypeInformation GetChannelDataTypeInformation(const std::string& channel_name) const override; /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - std::string GetChannelType(const std::string& channel_name) const override; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type **/ - void SetChannelType(const std::string& channel_name, const std::string& type) override; + void SetChannelDataTypeInformation(const std::string& channel_name, const DataTypeInformation& info) override; /** * @brief Gets minimum timestamp for specified channel diff --git a/contrib/ecalhdf5/src/eh5_meas_file_v2.cpp b/contrib/ecalhdf5/src/eh5_meas_file_v2.cpp index 008623edc3..a84b15c4ba 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_v2.cpp +++ b/contrib/ecalhdf5/src/eh5_meas_file_v2.cpp @@ -144,8 +144,9 @@ bool eCAL::eh5::HDF5MeasFileV2::HasChannel(const std::string& channel_name) cons return std::find(channels.cbegin(), channels.cend(), channel_name) != channels.end(); } -std::string eCAL::eh5::HDF5MeasFileV2::GetChannelDescription(const std::string& channel_name) const +eCAL::eh5::DataTypeInformation eCAL::eh5::HDF5MeasFileV2::GetChannelDataTypeInformation(const std::string& channel_name) const { + std::string type; std::string description; if (this->IsOk()) @@ -153,38 +154,19 @@ std::string eCAL::eh5::HDF5MeasFileV2::GetChannelDescription(const std::string& auto dataset_id = H5Dopen(file_id_, channel_name.c_str(), H5P_DEFAULT); if (dataset_id >= 0) { + GetAttributeValue(dataset_id, kChnTypeAttrTitle, type); GetAttributeValue(dataset_id, kChnDescAttrTitle, description); H5Dclose(dataset_id); } } - return description; + return CreateInfo(type, description); } -void eCAL::eh5::HDF5MeasFileV2::SetChannelDescription(const std::string& /*channel_name*/, const std::string& /*description*/) +void eCAL::eh5::HDF5MeasFileV2::SetChannelDataTypeInformation(const std::string& /*channel_name*/, const eCAL::eh5::DataTypeInformation& /*info*/) { } -std::string eCAL::eh5::HDF5MeasFileV2::GetChannelType(const std::string& channel_name) const -{ - std::string type; - - if (this->IsOk()) - { - auto dataset_id = H5Dopen(file_id_, channel_name.c_str(), H5P_DEFAULT); - if (dataset_id >= 0) - { - GetAttributeValue(dataset_id, kChnTypeAttrTitle, type); - H5Dclose(dataset_id); - } - } - - return type; -} - -void eCAL::eh5::HDF5MeasFileV2::SetChannelType(const std::string& /*channel_name*/, const std::string& /*type*/) -{ -} long long eCAL::eh5::HDF5MeasFileV2::GetMinTimestamp(const std::string& channel_name) const { diff --git a/contrib/ecalhdf5/src/eh5_meas_file_v2.h b/contrib/ecalhdf5/src/eh5_meas_file_v2.h index 6385f4f9fc..63934f88cb 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_v2.h +++ b/contrib/ecalhdf5/src/eh5_meas_file_v2.h @@ -135,38 +135,23 @@ namespace eCAL bool HasChannel(const std::string& channel_name) const override; /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - std::string GetChannelDescription(const std::string& channel_name) const override; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type **/ - void SetChannelDescription(const std::string& channel_name, const std::string& description) override; + DataTypeInformation GetChannelDataTypeInformation(const std::string& channel_name) const override; /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - std::string GetChannelType(const std::string& channel_name) const override; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type **/ - void SetChannelType(const std::string& channel_name, const std::string& type) override; + void SetChannelDataTypeInformation(const std::string& channel_name, const DataTypeInformation& info) override; /** * @brief Gets minimum timestamp for specified channel diff --git a/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.cpp b/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.cpp index b96d8396b9..f1aa1584cf 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.cpp +++ b/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.cpp @@ -138,26 +138,18 @@ bool eCAL::eh5::HDF5MeasFileWriterV5::HasChannel(const std::string& /*channel_na return false; } -std::string eCAL::eh5::HDF5MeasFileWriterV5::GetChannelDescription(const std::string& /*channel_name*/) const -{ - // UNSUPPORTED FUNCTION - return ""; -} -void eCAL::eh5::HDF5MeasFileWriterV5::SetChannelDescription(const std::string& channel_name, const std::string& description) -{ - channels_[channel_name].Description = description; -} - -std::string eCAL::eh5::HDF5MeasFileWriterV5::GetChannelType(const std::string& /*channel_name*/) const +eCAL::eh5::DataTypeInformation eCAL::eh5::HDF5MeasFileWriterV5::GetChannelDataTypeInformation(const std::string& channel_name) const { // UNSUPPORTED FUNCTION - return ""; + return eCAL::eh5::DataTypeInformation{}; } -void eCAL::eh5::HDF5MeasFileWriterV5::SetChannelType(const std::string& channel_name, const std::string& type) +void eCAL::eh5::HDF5MeasFileWriterV5::SetChannelDataTypeInformation(const std::string& channel_name, const eCAL::eh5::DataTypeInformation& info) { - channels_[channel_name].Type = type; + auto type_descriptor = FromInfo(info); + channels_[channel_name].Type = type_descriptor.first; + channels_[channel_name].Description = type_descriptor.second; } long long eCAL::eh5::HDF5MeasFileWriterV5::GetMinTimestamp(const std::string& /*channel_name*/) const diff --git a/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.h b/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.h index 0b10238c41..579951cf70 100644 --- a/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.h +++ b/contrib/ecalhdf5/src/eh5_meas_file_writer_v5.h @@ -141,38 +141,23 @@ namespace eCAL bool HasChannel(const std::string& channel_name) const override; /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - std::string GetChannelDescription(const std::string& channel_name) const override; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type **/ - void SetChannelDescription(const std::string& channel_name, const std::string& description) override; + DataTypeInformation GetChannelDataTypeInformation(const std::string & channel_name) const override; /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - std::string GetChannelType(const std::string& channel_name) const override; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type **/ - void SetChannelType(const std::string& channel_name, const std::string& type) override; + void SetChannelDataTypeInformation(const std::string & channel_name, const DataTypeInformation & info) override; /** * @brief Gets minimum timestamp for specified channel diff --git a/contrib/ecalhdf5/src/eh5_meas_impl.h b/contrib/ecalhdf5/src/eh5_meas_impl.h index e1825b5103..cee99fac60 100644 --- a/contrib/ecalhdf5/src/eh5_meas_impl.h +++ b/contrib/ecalhdf5/src/eh5_meas_impl.h @@ -29,6 +29,39 @@ #include "ecalhdf5/eh5_types.h" +inline eCAL::eh5::DataTypeInformation CreateInfo(const std::string& combined_topic_type_, const std::string& descriptor_) +{ + eCAL::eh5::DataTypeInformation info; + auto pos = combined_topic_type_.find(':'); + if (pos == std::string::npos) + { + info.name = combined_topic_type_; + info.encoding = ""; + } + else + { + info.name = combined_topic_type_.substr(pos + 1); + info.encoding = combined_topic_type_.substr(0, pos); + } + info.descriptor = descriptor_; + return info; +} + +inline std::pair FromInfo(const eCAL::eh5::DataTypeInformation& datatype_info_) +{ + std::string combined_topic_type; + if (datatype_info_.encoding.empty()) + { + combined_topic_type = datatype_info_.name; + } + else + { + combined_topic_type = datatype_info_.encoding + ":" + datatype_info_.name; + } + + return std::make_pair(combined_topic_type, datatype_info_.descriptor); +} + namespace eCAL { namespace eh5 @@ -126,38 +159,23 @@ namespace eCAL virtual bool HasChannel(const std::string& channel_name) const = 0; /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - virtual std::string GetChannelDescription(const std::string& channel_name) const = 0; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel + * @brief Get data type information of the given channel + * + * @param channel_name channel name + * + * @return channel type **/ - virtual void SetChannelDescription(const std::string& channel_name, const std::string& description) = 0; + virtual DataTypeInformation GetChannelDataTypeInformation(const std::string& channel_name) const = 0; /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - virtual std::string GetChannelType(const std::string& channel_name) const = 0; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel + * @brief Set data type information of the given channel + * + * @param channel_name channel name + * @param info datatype info of the channel + * + * @return channel type **/ - virtual void SetChannelType(const std::string& channel_name, const std::string& type) = 0; + virtual void SetChannelDataTypeInformation(const std::string& channel_name, const DataTypeInformation& info) = 0; /** * @brief Gets minimum timestamp for specified channel diff --git a/contrib/measurement/hdf5/src/reader.cpp b/contrib/measurement/hdf5/src/reader.cpp index 67481e41a9..2f9f3fd18b 100644 --- a/contrib/measurement/hdf5/src/reader.cpp +++ b/contrib/measurement/hdf5/src/reader.cpp @@ -5,27 +5,6 @@ using namespace eCAL::experimental::measurement::hdf5; using namespace eCAL::experimental::measurement; -namespace -{ - // To be removed soon-ish! - std::pair SplitCombinedTopicType(const std::string& combined_topic_type_) - { - auto pos = combined_topic_type_.find(':'); - if (pos == std::string::npos) - { - std::string encoding; - std::string type{ combined_topic_type_ }; - return std::make_pair(encoding, type); - } - else - { - std::string encoding = combined_topic_type_.substr(0, pos); - std::string type = combined_topic_type_.substr(pos + 1); - return std::make_pair(encoding, type); - } - } -} - Reader::Reader() : measurement(std::make_unique()) {} @@ -72,13 +51,7 @@ bool Reader::HasChannel(const std::string& channel_name) const base::DataTypeInformation Reader::GetChannelDataTypeInformation(const std::string& channel_name) const { - base::DataTypeInformation info; - auto type = measurement->GetChannelType(channel_name); - auto split_types = SplitCombinedTopicType(type); - info.encoding = split_types.first; - info.name = split_types.second; - info.descriptor = measurement->GetChannelDescription(channel_name); - return info; + return measurement->GetChannelDataTypeInformation(channel_name); } long long Reader::GetMinTimestamp(const std::string& channel_name) const diff --git a/contrib/measurement/hdf5/src/writer.cpp b/contrib/measurement/hdf5/src/writer.cpp index d28eb0666d..34fd56717e 100644 --- a/contrib/measurement/hdf5/src/writer.cpp +++ b/contrib/measurement/hdf5/src/writer.cpp @@ -4,21 +4,6 @@ using namespace eCAL::experimental::measurement::hdf5; using namespace eCAL::experimental::measurement; -namespace { - //To be removed soon - ish - std::string CombinedTopicEncodingAndType(const std::string & topic_encoding_, const std::string & topic_type_) - { - if (topic_encoding_.empty()) - { - return topic_type_; - } - else - { - return topic_encoding_ + ":" + topic_type_; - } - } -} - Writer::Writer() : measurement(std::make_unique()) {} @@ -70,9 +55,7 @@ void Writer::SetOneFilePerChannelEnabled(bool enabled) void Writer::SetChannelDataTypeInformation(const std::string& channel_name, const base::DataTypeInformation& info) { - - measurement->SetChannelType(channel_name, CombinedTopicEncodingAndType(info.encoding, info.name)); - measurement->SetChannelDescription(channel_name, info.descriptor); + measurement->SetChannelDataTypeInformation(channel_name, info); } void Writer::SetFileBaseName(const std::string& base_name)