Skip to content

Commit

Permalink
Fix windows compilation
Browse files Browse the repository at this point in the history
Signed-off-by: Eugenio Collado <[email protected]>
  • Loading branch information
EugenioCollado committed Jan 13, 2025
1 parent c285f07 commit fc38df2
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ddsrecorder/test/blackbox/FileCreationTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <thread>
#include <vector>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>

#include <fastdds/dds/core/policy/QosPolicies.hpp>
Expand All @@ -42,7 +43,6 @@
#include <fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp>
#include <fastdds/dds/xtypes/utils.hpp>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/ros2_mangling.hpp>

#include <ddsrecorder_participants/recorder/output/FileTracker.hpp>
Expand Down
3 changes: 2 additions & 1 deletion ddsrecorder/test/blackbox/mcap/McapFileCreationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <string>

#include <mcap/reader.hpp>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>

#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
Expand All @@ -30,7 +32,6 @@
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>

#include <cpp_utils/ros2_mangling.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>

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

Expand Down
2 changes: 1 addition & 1 deletion ddsrecorder/test/blackbox/mcap/McapLogErrorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

#include <memory>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>
#include <mcap/writer.hpp>

#include <cpp_utils/Log.hpp>
#include <cpp_utils/exception/InitializationException.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/efficiency/payload/PayloadPool.hpp>
Expand Down
2 changes: 1 addition & 1 deletion ddsrecorder/test/blackbox/sql/SqlFileCreationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

#include <sqlite/sqlite3.h>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>

#include <cpp_utils/exception/InitializationException.hpp>
#include <cpp_utils/Formatter.hpp>
#include <cpp_utils/ros2_mangling.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>

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

Expand Down
2 changes: 1 addition & 1 deletion ddsrecorder/test/blackbox/sql/SqlLogErrorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

#include <memory>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>

#include <cpp_utils/Log.hpp>
#include <cpp_utils/exception/InconsistencyException.hpp>
#include <cpp_utils/exception/InitializationException.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/efficiency/payload/PayloadPool.hpp>
Expand Down
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
6 changes: 3 additions & 3 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 @@ -62,8 +62,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::nanoseconds(nanoseconds));

return time_point;
}
Expand Down

0 comments on commit fc38df2

Please sign in to comment.