From e9686a3c194df39d0688792879d00286cdc62a96 Mon Sep 17 00:00:00 2001 From: Geoffrey Biggs Date: Wed, 24 Nov 2021 04:55:07 +0900 Subject: [PATCH] Expose the QoS object wrapper (#910) * Expose the Rosbag2QoS class for use Signed-off-by: Geoffrey Biggs Co-authored-by: Emerson Knapp --- rosbag2_transport/CMakeLists.txt | 8 ++------ .../{src => include}/rosbag2_transport/qos.hpp | 9 ++++++--- rosbag2_transport/src/rosbag2_transport/player.cpp | 2 +- rosbag2_transport/src/rosbag2_transport/qos.cpp | 2 +- rosbag2_transport/src/rosbag2_transport/recorder.cpp | 2 +- rosbag2_transport/test/rosbag2_transport/test_play.cpp | 2 +- rosbag2_transport/test/rosbag2_transport/test_qos.cpp | 2 +- rosbag2_transport/test/rosbag2_transport/test_record.cpp | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) rename rosbag2_transport/{src => include}/rosbag2_transport/qos.hpp (93%) diff --git a/rosbag2_transport/CMakeLists.txt b/rosbag2_transport/CMakeLists.txt index 77fcfe8cf9..435f7b221a 100644 --- a/rosbag2_transport/CMakeLists.txt +++ b/rosbag2_transport/CMakeLists.txt @@ -93,9 +93,7 @@ function(create_tests_for_rmw_implementation) endif() rosbag2_transport_add_gmock(test_play - src/rosbag2_transport/qos.cpp test/rosbag2_transport/test_play.cpp - INCLUDE_DIRS $ LINK_LIBS rosbag2_transport AMENT_DEPS test_msgs rosbag2_test_common ${SKIP_TEST}) @@ -140,11 +138,9 @@ function(create_tests_for_rmw_implementation) AMENT_DEPS test_msgs rosbag2_test_common) rosbag2_transport_add_gmock(test_qos - src/rosbag2_transport/qos.cpp test/rosbag2_transport/test_qos.cpp - INCLUDE_DIRS - $ - $ + INCLUDE_DIRS $ + LINK_LIBS rosbag2_transport AMENT_DEPS rosbag2_test_common yaml_cpp_vendor) rosbag2_transport_add_gmock(test_record diff --git a/rosbag2_transport/src/rosbag2_transport/qos.hpp b/rosbag2_transport/include/rosbag2_transport/qos.hpp similarity index 93% rename from rosbag2_transport/src/rosbag2_transport/qos.hpp rename to rosbag2_transport/include/rosbag2_transport/qos.hpp index 7425976d60..5d89d5ac9d 100644 --- a/rosbag2_transport/src/rosbag2_transport/qos.hpp +++ b/rosbag2_transport/include/rosbag2_transport/qos.hpp @@ -21,6 +21,8 @@ #include "rclcpp/node_interfaces/node_graph_interface.hpp" #include "rclcpp/qos.hpp" +#include "rosbag2_transport/visibility_control.hpp" + #ifdef _WIN32 // This is necessary because of a bug in yaml-cpp's cmake #define YAML_CPP_DLL @@ -37,11 +39,12 @@ namespace rosbag2_transport { /// Simple wrapper around rclcpp::QoS to provide a default constructor for YAML deserialization. -class Rosbag2QoS : public rclcpp::QoS +class ROSBAG2_TRANSPORT_PUBLIC Rosbag2QoS : public rclcpp::QoS { public: Rosbag2QoS() : rclcpp::QoS(rmw_qos_profile_default.depth) {} + explicit Rosbag2QoS(const rclcpp::QoS & value) : rclcpp::QoS(value) {} @@ -80,14 +83,14 @@ class Rosbag2QoS : public rclcpp::QoS namespace YAML { template<> -struct convert +struct ROSBAG2_TRANSPORT_PUBLIC convert { static Node encode(const rmw_time_t & time); static bool decode(const Node & node, rmw_time_t & time); }; template<> -struct convert +struct ROSBAG2_TRANSPORT_PUBLIC convert { static Node encode(const rosbag2_transport::Rosbag2QoS & qos); static bool decode(const Node & node, rosbag2_transport::Rosbag2QoS & qos); diff --git a/rosbag2_transport/src/rosbag2_transport/player.cpp b/rosbag2_transport/src/rosbag2_transport/player.cpp index b9d6d82846..d080f74904 100644 --- a/rosbag2_transport/src/rosbag2_transport/player.cpp +++ b/rosbag2_transport/src/rosbag2_transport/player.cpp @@ -35,7 +35,7 @@ #include "rosbag2_storage/storage_filter.hpp" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" namespace { diff --git a/rosbag2_transport/src/rosbag2_transport/qos.cpp b/rosbag2_transport/src/rosbag2_transport/qos.cpp index 4be8b518dc..470fe883bd 100644 --- a/rosbag2_transport/src/rosbag2_transport/qos.cpp +++ b/rosbag2_transport/src/rosbag2_transport/qos.cpp @@ -17,7 +17,7 @@ #include "rclcpp/logging.hpp" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" namespace { diff --git a/rosbag2_transport/src/rosbag2_transport/recorder.cpp b/rosbag2_transport/src/rosbag2_transport/recorder.cpp index 58165606d3..7d19b71937 100644 --- a/rosbag2_transport/src/rosbag2_transport/recorder.cpp +++ b/rosbag2_transport/src/rosbag2_transport/recorder.cpp @@ -31,7 +31,7 @@ #include "rosbag2_interfaces/srv/snapshot.hpp" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" #include "topic_filter.hpp" #ifdef _WIN32 diff --git a/rosbag2_transport/test/rosbag2_transport/test_play.cpp b/rosbag2_transport/test/rosbag2_transport/test_play.cpp index 3b45b31ce1..4e3235fedc 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_play.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_play.cpp @@ -32,7 +32,7 @@ #include "test_msgs/msg/basic_types.hpp" #include "test_msgs/message_fixtures.hpp" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" #include "rosbag2_play_test_fixture.hpp" #include "rosbag2_transport_test_fixture.hpp" diff --git a/rosbag2_transport/test/rosbag2_transport/test_qos.cpp b/rosbag2_transport/test/rosbag2_transport/test_qos.cpp index ab9125083b..22cf55ac71 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_qos.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_qos.cpp @@ -19,7 +19,7 @@ #include "rmw/types.h" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" TEST(TestQoS, serialization) { diff --git a/rosbag2_transport/test/rosbag2_transport/test_record.cpp b/rosbag2_transport/test/rosbag2_transport/test_record.cpp index b8ea973576..c39e2ce333 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_record.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_record.cpp @@ -30,7 +30,7 @@ #include "test_msgs/msg/arrays.hpp" #include "test_msgs/message_fixtures.hpp" -#include "qos.hpp" +#include "rosbag2_transport/qos.hpp" #include "record_integration_fixture.hpp" TEST_F(RecordIntegrationTestFixture, published_messages_from_multiple_topics_are_recorded)