Skip to content

Commit

Permalink
Fix windows compilation
Browse files Browse the repository at this point in the history
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
  • Loading branch information
EugenioCollado committed Jan 7, 2025
1 parent c285f07 commit 057bb4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

#include <ddsrecorder_participants/library/library_dll.h>

#include <ddspipe_core/types/dds/TopicQoS.hpp>
#include <ddsrecorder_participants/common/types/dynamic_types_collection/DynamicTypesCollection.hpp>


namespace eprosima {
namespace ddsrecorder {
namespace participants {
Expand Down Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
#include <fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp>
#include <fastdds/rtps/common/SerializedPayload.hpp>

#include <ddspipe_core/types/dds/TopicQoS.hpp>

#include <ddsrecorder_participants/common/serialize/Serializer.hpp>
#include <ddsrecorder_participants/common/types/dynamic_types_collection/DynamicTypesCollection.hpp>
#include <ddsrecorder_participants/common/types/dynamic_types_collection/DynamicTypesCollectionPubSubTypes.hpp>
#include <ddsrecorder_participants/constants.hpp>

Expand Down Expand Up @@ -79,6 +76,7 @@ std::string Serializer::serialize(
}

template <>
DDSRECORDER_PARTICIPANTS_DllAPI
ddspipe::core::types::TopicQoS Serializer::deserialize(
const std::string& topic_qos_str)
{
Expand Down Expand Up @@ -129,20 +127,23 @@ ddspipe::core::types::TopicQoS Serializer::deserialize(
}

template <>
DDSRECORDER_PARTICIPANTS_DllAPI
fastdds::dds::xtypes::TypeIdentifier Serializer::deserialize(
const std::string& type_identifier_str)
{
return type_str_to_type_data_<fastdds::dds::xtypes::TypeIdentifier>(type_identifier_str);
}

template <>
DDSRECORDER_PARTICIPANTS_DllAPI
fastdds::dds::xtypes::TypeObject Serializer::deserialize(
const std::string& type_object_str)
{
return type_str_to_type_data_<fastdds::dds::xtypes::TypeObject>(type_object_str);
}

template <>
DDSRECORDER_PARTICIPANTS_DllAPI
DynamicTypesCollection Serializer::deserialize(
const std::string& raw_data_str)
{
Expand Down
5 changes: 3 additions & 2 deletions ddsrecorder_participants/src/cpp/common/time_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::chrono::system_clock> 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;
Expand All @@ -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<utils::Timestamp::duration>(time_point + std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::nanoseconds(nanoseconds)));
time_point = std::chrono::time_point_cast<utils::Timestamp::duration>(time_point + std::chrono::nanoseconds(nanoseconds));

return time_point;
}
Expand Down

0 comments on commit 057bb4a

Please sign in to comment.