From 2a869c2df09345b5561771a2df6984b51861786e Mon Sep 17 00:00:00 2001 From: Vakhtang Tsulaia <vakhtang.tsulaia@cern.ch> Date: Mon, 1 Aug 2022 16:28:09 +0200 Subject: [PATCH] Merge branch '64bit-prep.StoreGate-20220729' into 'master' StoreGate: Prepare for migration to 64-bit sgkey_t. See merge request atlas/athena!55550 (cherry picked from commit d295dfc29a82cb19a15fc3c2eb6379e26a7fb327) fcd4970b StoreGate: Prepare for migration to 64-bit sgkey_t. --- Control/StoreGate/src/SGImplSvc.cxx | 10 +--------- Control/StoreGate/test/VarHandleKey_test.cxx | 9 +++++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Control/StoreGate/src/SGImplSvc.cxx b/Control/StoreGate/src/SGImplSvc.cxx index f43899eff542..9dcc15a44ca5 100644 --- a/Control/StoreGate/src/SGImplSvc.cxx +++ b/Control/StoreGate/src/SGImplSvc.cxx @@ -70,19 +70,11 @@ namespace SG { { typedef IStringPool::sgkey_t sgkey_t; - // Hash function for the key. - // Just cast the low bits to a size_t. - struct keyhash - { - std::size_t operator() (sgkey_t key) const - { return static_cast<std::size_t> (key); } - }; - struct remap_t { sgkey_t target; off_t index_offset; }; - typedef std::unordered_map<sgkey_t, remap_t, keyhash> remap_map_t; + typedef SGKeyMap<remap_t> remap_map_t; remap_map_t m_remaps; }; diff --git a/Control/StoreGate/test/VarHandleKey_test.cxx b/Control/StoreGate/test/VarHandleKey_test.cxx index 6fc043eb279f..95c7c390eb34 100644 --- a/Control/StoreGate/test/VarHandleKey_test.cxx +++ b/Control/StoreGate/test/VarHandleKey_test.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ - -// $Id$ /** * @file StoreGate/test/VarHandleKey_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -14,6 +12,7 @@ #undef NDEBUG #include "StoreGate/VarHandleKey.h" #include "StoreGate/exceptions.h" +#include "SGTools/StringPool.h" #include "AthenaKernel/errorcheck.h" #include "TestTools/initGaudi.h" #include "TestTools/expect_exception.h" @@ -34,6 +33,8 @@ void test1() { std::cout << "test1\n"; + SG::StringPool pool; + SG::VarHandleKey k1 (1234, "aaa", Gaudi::DataHandle::Reader); assert (k1.clid() == 1234); assert (k1.key() == "aaa"); @@ -46,7 +47,7 @@ void test1() assert (k1.start().isSuccess()); assert (!k1.isCondition()); assert (!k1.empty()); - assert (k1.hashedKey() == 752331202); + assert (k1.hashedKey() == pool.stringToKey ("aaa", 1234)); k1 = "aab"; assert (k1.clid() == 1234); -- GitLab