From 7aa1106c175baf2a9b19dda5f0cbd24a08d334b0 Mon Sep 17 00:00:00 2001 From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch> Date: Fri, 7 Jun 2024 17:40:18 +0200 Subject: [PATCH] Move string to string_view when suitable --- .../GeoModelDBManager/GeoModelDBManager/GMDBManager.h | 6 +++--- GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index a0c06efb6..5019e0629 100644 --- a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h +++ b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h @@ -309,9 +309,9 @@ class GMDBManager { std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypes(); std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDs(); - std::vector<std::vector<std::string>> getTableRecords(std::string tableName) const; - DBRowEntry getTableRecords_VecData(std::string tableName) const; - DBRowsList getTableRecords_VecVecData(std::string tableName) const; + std::vector<std::vector<std::string>> getTableRecords(const std::string_view tableName) const; + DBRowEntry getTableRecords_VecData(const std::string_view tableName) const; + DBRowsList getTableRecords_VecVecData(const std::string_view tableName) const; //! Test if a given table exists //! This requires the *full* table name (i.e. prefix_suffix) diff --git a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp index 542f99a8d..508010935 100644 --- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp @@ -296,7 +296,7 @@ std::vector<std::vector<std::string>> GMDBManager::getTableRecords_String( // New version with variant DBRowsList GMDBManager::getTableRecords_VecVecData( - std::string tableName) const + const std::string_view tableName) const { // container to be returned @@ -411,7 +411,7 @@ DBRowsList GMDBManager::getTableRecords_VecVecData( } // New version with variant DBRowEntry GMDBManager::getTableRecords_VecData( - std::string tableName) const + const std::string_view tableName) const { if (!checkTableFromCache(tableName)) { THROW_EXCEPTION("ERROR!!! Table name '" + std::string(tableName) + "' does not exist in cache! (It has not been loaded from the DB)"); -- GitLab