From df4710f3731c716b41bf2f168773c16c943ff416 Mon Sep 17 00:00:00 2001 From: Michael Orlov Date: Fri, 9 Aug 2024 16:21:34 -0700 Subject: [PATCH] Address merge conflicts Signed-off-by: Michael Orlov --- rosbag2_py/test/test_convert.py | 9 --- .../sqlite_storage.cpp | 63 +++++-------------- 2 files changed, 15 insertions(+), 57 deletions(-) diff --git a/rosbag2_py/test/test_convert.py b/rosbag2_py/test/test_convert.py index 93409f2e83..b72abd7d5f 100644 --- a/rosbag2_py/test/test_convert.py +++ b/rosbag2_py/test/test_convert.py @@ -15,19 +15,10 @@ import os from pathlib import Path -<<<<<<< HEAD import pytest from rosbag2_py import bag_rewrite, StorageOptions from rosbag2_test_common import TESTED_STORAGE_IDS -======= -import common # noqa -from rosbag2_py import ( - bag_rewrite, - get_default_storage_id, - StorageOptions, -) # noqa: E402 ->>>>>>> 5da1796 ([Humble] Add topics with zero message counts to the SQLiteStorage::get_metadata(). (#1722)) RESOURCES_PATH = Path(os.environ['ROSBAG2_PY_TEST_RESOURCES_DIR']) diff --git a/rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp b/rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp index b96a2c12ad..c3a34fe3ad 100644 --- a/rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp +++ b/rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp @@ -583,7 +583,6 @@ void SqliteStorage::prepare_for_reading() void SqliteStorage::fill_topics_and_types() { if (database_->field_exists("topics", "offered_qos_profiles")) { -<<<<<<< HEAD:rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp if (database_->field_exists("topics", "type_description_hash")) { auto statement = database_->prepare_statement( "SELECT name, type, serialization_format, offered_qos_profiles, type_description_hash" @@ -610,16 +609,6 @@ void SqliteStorage::fill_topics_and_types() all_topics_and_types_.push_back( {std::get<0>(result), std::get<1>(result), std::get<2>(result), std::get<3>(result), ""}); } -======= - auto statement = database_->prepare_statement( - "SELECT name, type, serialization_format, offered_qos_profiles FROM topics ORDER BY id;"); - auto query_results = - statement->execute_query(); - - for (auto result : query_results) { - all_topics_and_types_.push_back( - {std::get<0>(result), std::get<1>(result), std::get<2>(result), std::get<3>(result)}); ->>>>>>> 5da1796 ([Humble] Add topics with zero message counts to the SQLiteStorage::get_metadata(). (#1722)):rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp } } else { auto statement = database_->prepare_statement( @@ -628,11 +617,7 @@ void SqliteStorage::fill_topics_and_types() for (auto result : query_results) { all_topics_and_types_.push_back( -<<<<<<< HEAD:rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp {std::get<0>(result), std::get<1>(result), std::get<2>(result), "", ""}); -======= - {std::get<0>(result), std::get<1>(result), std::get<2>(result), ""}); ->>>>>>> 5da1796 ([Humble] Add topics with zero message counts to the SQLiteStorage::get_metadata(). (#1722)):rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp } } } @@ -703,32 +688,22 @@ void SqliteStorage::read_metadata() std::string, std::string, std::string, int, rcutils_time_point_value_t, rcutils_time_point_value_t, std::string, std::string>(); -<<<<<<< HEAD:rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp for (auto result : query_results) { - metadata_.topics_with_message_count.push_back( - { - {std::get<0>(result), std::get<1>(result), std::get<2>(result), std::get<6>( - result), std::get<7>(result)}, - static_cast(std::get<3>(result)) + const rosbag2_storage::TopicMetadata topic_metadata{std::get<0>(result), + std::get<1>(result), std::get<2>(result), std::get<6>(result), std::get<7>(result)}; + auto & topics_list = metadata.topics_with_message_count; + auto it = std::find_if( + topics_list.begin(), topics_list.end(), + [&topic_metadata = topic_metadata](const rosbag2_storage::TopicInformation & topic_info) { + return topic_info.topic_metadata == topic_metadata; }); -======= - for (auto result : query_results) { - const rosbag2_storage::TopicMetadata topic_metadata{std::get<0>(result), - std::get<1>(result), std::get<2>(result), std::get<6>(result)}; - auto & topics_list = metadata.topics_with_message_count; - auto it = std::find_if( - topics_list.begin(), topics_list.end(), - [&topic_metadata = topic_metadata](const rosbag2_storage::TopicInformation & topic_info) { - return topic_info.topic_metadata == topic_metadata; - }); - if (it != topics_list.end()) { - it->message_count = static_cast(std::get<3>(result)); - } else { - metadata.topics_with_message_count.push_back( - {topic_metadata, static_cast(std::get<3>(result))} - ); - } ->>>>>>> 5da1796 ([Humble] Add topics with zero message counts to the SQLiteStorage::get_metadata(). (#1722)):rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp + if (it != topics_list.end()) { + it->message_count = static_cast(std::get<3>(result)); + } else { + metadata.topics_with_message_count.push_back( + {topic_metadata, static_cast(std::get<3>(result))} + ); + } metadata_.message_count += std::get<3>(result); min_time = std::get<4>(result) < min_time ? std::get<4>(result) : min_time; @@ -771,21 +746,13 @@ void SqliteStorage::read_metadata() rcutils_time_point_value_t>(); for (auto result : query_results) { -<<<<<<< HEAD:rosbag2_storage_sqlite3/src/rosbag2_storage_sqlite3/sqlite_storage.cpp - metadata_.topics_with_message_count.push_back( - { - {std::get<0>(result), std::get<1>(result), std::get<2>( - result), "", ""}, - static_cast(std::get<3>(result)) -======= const rosbag2_storage::TopicMetadata topic_metadata{std::get<0>(result), - std::get<1>(result), std::get<2>(result), ""}; + std::get<1>(result), std::get<2>(result), "", ""}; auto & topics_list = metadata.topics_with_message_count; auto it = std::find_if( topics_list.begin(), topics_list.end(), [&topic_metadata = topic_metadata](const rosbag2_storage::TopicInformation & topic_info) { return topic_info.topic_metadata == topic_metadata; ->>>>>>> 5da1796 ([Humble] Add topics with zero message counts to the SQLiteStorage::get_metadata(). (#1722)):rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_storage.cpp }); if (it != topics_list.end()) { it->message_count = static_cast(std::get<3>(result));