From 057bb4aa270db48947b6708c2a3e12c5f2f3f5d3 Mon Sep 17 00:00:00 2001 From: Eugenio Collado Date: Tue, 7 Jan 2025 14:43:38 +0100 Subject: [PATCH] Fix windows compilation Signed-off-by: Eugenio Collado --- .../common/serialize/Serializer.hpp | 18 ++++++++++++++++++ .../src/cpp/common/serialize/Serializer.cpp | 7 ++++--- .../src/cpp/common/time_utils.cpp | 5 +++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ddsrecorder_participants/include/ddsrecorder_participants/common/serialize/Serializer.hpp b/ddsrecorder_participants/include/ddsrecorder_participants/common/serialize/Serializer.hpp index 40b9c8e81..cf5b81416 100644 --- a/ddsrecorder_participants/include/ddsrecorder_participants/common/serialize/Serializer.hpp +++ b/ddsrecorder_participants/include/ddsrecorder_participants/common/serialize/Serializer.hpp @@ -22,6 +22,10 @@ #include +#include +#include + + namespace eprosima { namespace ddsrecorder { namespace participants { @@ -75,6 +79,20 @@ class DDSRECORDER_PARTICIPANTS_DllAPI Serializer const std::string& type_str); }; +// Explicitly declare the specializations +template <> +DDSRECORDER_PARTICIPANTS_DllAPI ddspipe::core::types::TopicQoS Serializer::deserialize(const std::string& topic_qos_str); + +template <> +DDSRECORDER_PARTICIPANTS_DllAPI fastdds::dds::xtypes::TypeIdentifier Serializer::deserialize(const std::string& serialized_str); + +template <> +DDSRECORDER_PARTICIPANTS_DllAPI fastdds::dds::xtypes::TypeObject Serializer::deserialize(const std::string& serialized_str); + +template <> +DDSRECORDER_PARTICIPANTS_DllAPI DynamicTypesCollection Serializer::deserialize(const std::string& raw_data_str); + + } /* namespace participants */ } /* namespace ddsrecorder */ } /* namespace eprosima */ diff --git a/ddsrecorder_participants/src/cpp/common/serialize/Serializer.cpp b/ddsrecorder_participants/src/cpp/common/serialize/Serializer.cpp index 70cccf437..e4edef00f 100644 --- a/ddsrecorder_participants/src/cpp/common/serialize/Serializer.cpp +++ b/ddsrecorder_participants/src/cpp/common/serialize/Serializer.cpp @@ -22,10 +22,7 @@ #include #include -#include - #include -#include #include #include @@ -79,6 +76,7 @@ std::string Serializer::serialize( } template <> +DDSRECORDER_PARTICIPANTS_DllAPI ddspipe::core::types::TopicQoS Serializer::deserialize( const std::string& topic_qos_str) { @@ -129,6 +127,7 @@ ddspipe::core::types::TopicQoS Serializer::deserialize( } template <> +DDSRECORDER_PARTICIPANTS_DllAPI fastdds::dds::xtypes::TypeIdentifier Serializer::deserialize( const std::string& type_identifier_str) { @@ -136,6 +135,7 @@ fastdds::dds::xtypes::TypeIdentifier Serializer::deserialize( } template <> +DDSRECORDER_PARTICIPANTS_DllAPI fastdds::dds::xtypes::TypeObject Serializer::deserialize( const std::string& type_object_str) { @@ -143,6 +143,7 @@ fastdds::dds::xtypes::TypeObject Serializer::deserialize( } template <> +DDSRECORDER_PARTICIPANTS_DllAPI DynamicTypesCollection Serializer::deserialize( const std::string& raw_data_str) { diff --git a/ddsrecorder_participants/src/cpp/common/time_utils.cpp b/ddsrecorder_participants/src/cpp/common/time_utils.cpp index 3042a630f..64f2e3851 100644 --- a/ddsrecorder_participants/src/cpp/common/time_utils.cpp +++ b/ddsrecorder_participants/src/cpp/common/time_utils.cpp @@ -52,7 +52,7 @@ utils::Timestamp to_std_timestamp( throw std::runtime_error("No dot found in the timestamp"); } - auto time_point = utils::string_to_timestamp(time.substr(0, dot_pos), SQL_TIMESTAMP_FORMAT); + std::chrono::time_point time_point = utils::string_to_timestamp(time.substr(0, dot_pos), SQL_TIMESTAMP_FORMAT); const auto decimals = time.substr(dot_pos + 1); std::uint32_t nanoseconds; @@ -63,7 +63,8 @@ utils::Timestamp to_std_timestamp( throw std::runtime_error("Failed to parse fractional part as an integer"); } - time_point += std::chrono::nanoseconds(nanoseconds); + //time_point = std::chrono::time_point_cast(time_point + std::chrono::duration_cast(std::chrono::nanoseconds(nanoseconds))); + time_point = std::chrono::time_point_cast(time_point + std::chrono::nanoseconds(nanoseconds)); return time_point; }