diff --git a/Control/AthContainers/AthContainers/tools/AuxTypeVector.h b/Control/AthContainers/AthContainers/tools/AuxTypeVector.h index b5d33c38e9992029d50a36a1b9a1526e07719a80..d13f85b5ceb5b49b344f0a9e25a8d19fc071c5cf 100644 --- a/Control/AthContainers/AthContainers/tools/AuxTypeVector.h +++ b/Control/AthContainers/AthContainers/tools/AuxTypeVector.h @@ -218,6 +218,7 @@ public: * @param pos The starting index of the insertion. * @param beg Start of the range of elements to insert. * @param end End of the range of elements to insert. + * @param srcStore The source store. * * @c beg and @c end define a range of container elements, with length * @c len defined by the difference of the pointers divided by the @@ -233,7 +234,8 @@ public: * Returns true if it is known that the vector's memory did not move, * false otherwise. */ - virtual bool insertMove (size_t pos, void* beg, void* end) override; + virtual bool insertMove (size_t pos, void* beg, void* end, + IAuxStore& srcStore) override; /** diff --git a/Control/AthContainers/AthContainers/tools/AuxTypeVector.icc b/Control/AthContainers/AthContainers/tools/AuxTypeVector.icc index 58d5e816613658ddd451e8cab50e5336d07e25f2..6f750ed31837c1a34b26f749a54e8c63fd595bd4 100644 --- a/Control/AthContainers/AthContainers/tools/AuxTypeVector.icc +++ b/Control/AthContainers/AthContainers/tools/AuxTypeVector.icc @@ -392,6 +392,7 @@ void AuxTypeVectorHolder<T, CONT>::insertMove1 * @param pos The starting index of the insertion. * @param beg Start of the range of elements to insert. * @param end End of the range of elements to insert. + * @param srcStore The source store. * * @c beg and @c end define a range of container elements, with length * @c len defined by the difference of the pointers divided by the @@ -408,7 +409,8 @@ void AuxTypeVectorHolder<T, CONT>::insertMove1 * false otherwise. */ template <class T, class CONT> -bool AuxTypeVectorHolder<T, CONT>::insertMove (size_t pos, void* beg, void* end) +bool AuxTypeVectorHolder<T, CONT>::insertMove (size_t pos, void* beg, void* end, + IAuxStore& /*srcStore*/) { const void* orig = m_vecPtr->data(); insertMove1 (m_vecPtr->begin() + pos*SCALE, diff --git a/Control/AthContainers/Root/AuxStoreInternal.cxx b/Control/AthContainers/Root/AuxStoreInternal.cxx index 24b37f888f6714e0a78d483f432d4c2a89173a00..5880115d9c5ff6b168d2e8c6c67785d59dbc733d 100644 --- a/Control/AthContainers/Root/AuxStoreInternal.cxx +++ b/Control/AthContainers/Root/AuxStoreInternal.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/src/AuxStoreInternal.cxx @@ -322,7 +322,8 @@ bool AuxStoreInternal::insertMove (size_t pos, if (other.getData (id)) { void* src_ptr = other.getData (id, other_size, other_size); if (src_ptr) { - if (!v_dst->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id))) + if (!v_dst->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other)) nomove = false; } } @@ -346,7 +347,8 @@ bool AuxStoreInternal::insertMove (size_t pos, if (sz < other_size) sz = other_size + pos; (void)getDataInternal_noLock (id, sz, sz, false); m_vecs[id]->resize (sz - other_size); - m_vecs[id]->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id)); + m_vecs[id]->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other); nomove = false; } } diff --git a/Control/AthContainers/test/AuxTypeVector_test.cxx b/Control/AthContainers/test/AuxTypeVector_test.cxx index 467d7a35e3cf2c6c266fcbbc848d504f7f9690d6..46a4f78a914abc2ac0f8008215480136f29173ab 100644 --- a/Control/AthContainers/test/AuxTypeVector_test.cxx +++ b/Control/AthContainers/test/AuxTypeVector_test.cxx @@ -13,6 +13,7 @@ #include "AthContainers/tools/AuxTypeVector.h" +#include "AthContainers/AuxStoreInternal.h" #include "TestTools/TestAlloc.h" #include "CxxUtils/checker_macros.h" #include <vector> @@ -241,6 +242,8 @@ void test_vector3() template <class T, template<typename> class ALLOC = std::allocator> void test_vector4 (bool isPOD) { + SG::AuxStoreInternal store; + SG::AuxTypeVector<T, ALLOC<T> > v1 (1, 10, 20); T* ptr1 = reinterpret_cast<T*> (v1.toPtr()); for (int i=0; i<10; i++) @@ -251,7 +254,7 @@ void test_vector4 (bool isPOD) for (int i=0; i<5; i++) ptr2[i] = makeT<T>(i+10); - assert (v1.insertMove (3, ptr2, ptr2+5)); + assert (v1.insertMove (3, ptr2, ptr2+5, store)); assert (v1.size() == 15); for (int i=0; i<3; i++) assert (ptr1[i] == makeT<T>(i)); @@ -268,7 +271,7 @@ void test_vector4 (bool isPOD) for (int i=0; i<5; i++) assert (isPOD || !wasMoved (ptr2[i])); - assert (v1.insertMove (15, ptr2, ptr2+5)); + assert (v1.insertMove (15, ptr2, ptr2+5, store)); assert (v1.size() == 20); for (int i=0; i<3; i++) assert (ptr1[i] == makeT<T>(i)); @@ -284,7 +287,7 @@ void test_vector4 (bool isPOD) SG::AuxTypeVector<T, ALLOC<T> > v3 (1, 1000, 1000); T* ptr3 = reinterpret_cast<T*> (v3.toPtr()); - assert ( ! v1.insertMove (20, ptr3, ptr3 + v3.size()) ); + assert ( ! v1.insertMove (20, ptr3, ptr3 + v3.size(), store) ); } diff --git a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h index 0c69befeb06ada8e7c08a849e1eb9cc60fb7a47a..bd1ab145f38e5b8ef66eab185b8440310b102271 100644 --- a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h +++ b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxTypeVector.h @@ -1,6 +1,6 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainersInterfaces/IAuxTypeVector.h @@ -15,6 +15,7 @@ #include "AthContainersInterfaces/AuxTypes.h" +#include "AthContainersInterfaces/IAuxStore.h" #include <cstddef> #include <memory> #include <typeinfo> @@ -125,6 +126,7 @@ public: * @param pos The starting index of the insertion. * @param beg Start of the range of elements to insert. * @param end End of the range of elements to insert. + * @param srcStore The source store. * * @c beg and @c end define a range of container elements, with length * @c len defined by the difference of the pointers divided by the @@ -140,7 +142,8 @@ public: * Returns true if it is known that the vector's memory did not move, * false otherwise. */ - virtual bool insertMove (size_t pos, void* beg, void* end) = 0; + virtual bool insertMove (size_t pos, void* beg, void* end, + IAuxStore& srcStore) = 0; /** diff --git a/Control/AthContainersRoot/AthContainersRoot/RootAuxVectorFactory.h b/Control/AthContainersRoot/AthContainersRoot/RootAuxVectorFactory.h index 20261b425a660a3f01c38822e72fd092cd4772bc..05a6fd256b65c9304ba39e156296c23fae04d767 100644 --- a/Control/AthContainersRoot/AthContainersRoot/RootAuxVectorFactory.h +++ b/Control/AthContainersRoot/AthContainersRoot/RootAuxVectorFactory.h @@ -184,6 +184,7 @@ public: * @param pos The starting index of the insertion. * @param beg Start of the range of elements to insert. * @param end End of the range of elements to insert. + * @param srcStore The source store. * * @c beg and @c end define a range of container elements, with length * @c len defined by the difference of the pointers divided by the @@ -199,7 +200,8 @@ public: * Returns true if it is known that the vector's memory did not move, * false otherwise. */ - virtual bool insertMove (size_t pos, void* beg, void* end) override; + virtual bool insertMove (size_t pos, void* beg, void* end, + SG::IAuxStore& srcStore) override; /** diff --git a/Control/AthContainersRoot/src/RootAuxVectorFactory.cxx b/Control/AthContainersRoot/src/RootAuxVectorFactory.cxx index 7ebc68aab457cfded8def2e2807e323e5ef0a9f0..cbea7bc67c5a753ab9cce555f0a73e0b7c5d4e8f 100644 --- a/Control/AthContainersRoot/src/RootAuxVectorFactory.cxx +++ b/Control/AthContainersRoot/src/RootAuxVectorFactory.cxx @@ -279,6 +279,7 @@ void RootAuxVector::shift (size_t pos, ptrdiff_t offs) * @param pos The starting index of the insertion. * @param beg Start of the range of elements to insert. * @param end End of the range of elements to insert. + * @param srcStore The source store. * * @c beg and @c end define a range of container elements, with length * @c len defined by the difference of the pointers divided by the @@ -294,7 +295,8 @@ void RootAuxVector::shift (size_t pos, ptrdiff_t offs) * Returns true if it is known that the vector's memory did not move, * false otherwise. */ -bool RootAuxVector::insertMove (size_t pos, void* beg, void* end) +bool RootAuxVector::insertMove (size_t pos, void* beg, void* end, + SG::IAuxStore& /*srcStore*/) { size_t eltsz = m_proxy->GetIncrement(); const void* orig = this->toPtr(); diff --git a/Control/AthContainersRoot/test/RootAuxVectorFactory_test.cxx b/Control/AthContainersRoot/test/RootAuxVectorFactory_test.cxx index bf494898fe2fb620b6291e3d45407375fdbd3c42..7b6bd83e82222e48ae2b80e12cf0bc2c33cb11f3 100644 --- a/Control/AthContainersRoot/test/RootAuxVectorFactory_test.cxx +++ b/Control/AthContainersRoot/test/RootAuxVectorFactory_test.cxx @@ -62,6 +62,7 @@ std::string str (int x) void test1() { std::cout << "test1\n"; + SG::AuxStoreInternal store; TClass* cl = TClass::GetClass ("vector<int>"); SG::RootAuxVectorFactory fac (cl); SG::IAuxTypeVector* vec = new SG::RootAuxVector (&fac, 1, 10, 20); @@ -125,7 +126,7 @@ void test1() assert (ptr2[8] == 10); std::vector<int> vec3 { 20, 21, 22, 23, 24 }; - assert (vec->insertMove (3, vec3.data(), vec3.data() + 5)); + assert (vec->insertMove (3, vec3.data(), vec3.data() + 5, store)); assert (vec->size() == 14); assert (ptr[0] == 1); assert (ptr[1] == 2); @@ -143,7 +144,7 @@ void test1() assert (ptr[13] == 10); std::vector<int> vec4 { 30, 31, 32, 33, 34 }; - assert (vec->insertMove (14, vec4.data(), vec4.data() + 5)); + assert (vec->insertMove (14, vec4.data(), vec4.data() + 5, store)); assert (vec->size() == 19); assert (ptr[0] == 1); assert (ptr[1] == 2); @@ -175,6 +176,7 @@ void test1() void test2() { std::cout << "test2\n"; + SG::AuxStoreInternal store; TClass* cl = TClass::GetClass ("vector<std::string>"); SG::RootAuxVectorFactory fac (cl); SG::IAuxTypeVector* vec = new SG::RootAuxVector (&fac, 1, 10, 10); @@ -223,7 +225,7 @@ void test2() assert (ptr[8] == str(10)); std::vector<std::string> vec3 { str(20), str(21), str(22), str(23), str(24) }; - assert (vec->insertMove (3, vec3.data(), vec3.data() + 5)); + assert (vec->insertMove (3, vec3.data(), vec3.data() + 5, store)); assert (vec->size() == 14); assert (ptr[0] == str(1)); assert (ptr[1] == str(2)); @@ -241,7 +243,7 @@ void test2() assert (ptr[13] == str(10)); std::vector<std::string> vec4 { str(30), str(31), str(32), str(33), str(34) }; - assert (vec->insertMove (14, vec4.data(), vec4.data() + 5)); + assert (vec->insertMove (14, vec4.data(), vec4.data() + 5, store)); assert (vec->size() == 19); assert (ptr[0] == str(1)); assert (ptr[1] == str(2)); diff --git a/Control/xAODRootAccess/Root/TAuxStore.cxx b/Control/xAODRootAccess/Root/TAuxStore.cxx index 2345e1b1fcf663908d8f049f23c72006fde780f3..0fa227c7dd5c97ca27040c961090426a7b6ba9e4 100644 --- a/Control/xAODRootAccess/Root/TAuxStore.cxx +++ b/Control/xAODRootAccess/Root/TAuxStore.cxx @@ -680,7 +680,8 @@ namespace xAOD { void* src_ptr = other.getData (id, other_size, other_size); if (src_ptr) { if (!v_dst->insertMove (pos, src_ptr, - reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id))) + reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other)) nomove = false; } } diff --git a/Control/xAODRootAccess/Root/TAuxVector.cxx b/Control/xAODRootAccess/Root/TAuxVector.cxx index 3d77dca76b19a56554978271e52558b005b453ca..ebd5999acc1cf0b274061c33a619cba4f3cbdb26 100644 --- a/Control/xAODRootAccess/Root/TAuxVector.cxx +++ b/Control/xAODRootAccess/Root/TAuxVector.cxx @@ -197,7 +197,8 @@ namespace xAOD { return; } - bool TAuxVector::insertMove (size_t pos, void* beg, void* end) + bool TAuxVector::insertMove (size_t pos, void* beg, void* end, + SG::IAuxStore& /*srcStore*/) { size_t eltsz = m_proxy->GetIncrement(); const void* orig = this->toPtr(); diff --git a/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxvector_test.cxx b/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxvector_test.cxx index ea1fa894e5261b4bd723b186dc6ab703c478bd42..3cb52d52af60ffa8b6fe991026565469af20fc9e 100644 --- a/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxvector_test.cxx +++ b/Control/xAODRootAccess/test/ut_xaodrootaccess_tauxvector_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file xAODRootAccess/test/ut_xaodrootaccess_tauxvector_test.cxx @@ -12,6 +12,7 @@ #undef NDEBUG #include "xAODRootAccess/tools/TAuxVector.h" #include "xAODRootAccess/tools/TAuxVectorFactory.h" +#include "AthContainers/AuxStoreInternal.h" #include "CxxUtils/StrFormat.h" #include "TClass.h" #include <iostream> @@ -30,6 +31,7 @@ void test1() { std::cout << "test1\n"; + SG::AuxStoreInternal store; TClass* cl_int = TClass::GetClass ("vector<int>"); xAOD::TAuxVectorFactory fac_int (cl_int); xAOD::TAuxVector vec_int = xAOD::TAuxVector (&fac_int, 1, cl_int, 5, 5); @@ -40,7 +42,7 @@ void test1() ptr_int[i] = i; std::vector<int> v2_int { 10, 11, 12, 13, 14 }; - vec_int.insertMove (3, v2_int.data(), v2_int.data() + 5); + vec_int.insertMove (3, v2_int.data(), v2_int.data() + 5, store); assert (vec_int.size() == 10); ptr_int = reinterpret_cast<int*> (vec_int.toPtr()); for (int i=0; i < 3; i++) @@ -51,7 +53,7 @@ void test1() assert (ptr_int[5+i] == i); std::vector<int> v3_int { 20, 21, 22, 23, 24 }; - vec_int.insertMove (10, v3_int.data(), v3_int.data() + 5); + vec_int.insertMove (10, v3_int.data(), v3_int.data() + 5, store); assert (vec_int.size() == 15); ptr_int = reinterpret_cast<int*> (vec_int.toPtr()); for (int i=0; i < 3; i++) @@ -75,7 +77,7 @@ void test1() ptr_str[i] = str(i); std::vector<std::string> v2_str { str(10), str(11), str(12), str(13), str(14) }; - vec_str.insertMove (3, v2_str.data(), v2_str.data() + 5); + vec_str.insertMove (3, v2_str.data(), v2_str.data() + 5, store); assert (vec_str.size() == 10); ptr_str = reinterpret_cast<std::string*> (vec_str.toPtr()); for (int i=0; i < 3; i++) @@ -86,7 +88,7 @@ void test1() assert (ptr_str[5+i] == str(i)); std::vector<std::string> v3_str { str(20), str(21), str(22), str(23), str(24) }; - vec_str.insertMove (10, v3_str.data(), v3_str.data() + 5); + vec_str.insertMove (10, v3_str.data(), v3_str.data() + 5, store); assert (vec_str.size() == 15); ptr_str = reinterpret_cast<std::string*> (vec_str.toPtr()); for (int i=0; i < 3; i++) diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVector.h b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVector.h index f5c568f87a0910b4dce156b0b3bff3c756edc105..353e89d6afedcf66ecf965b4eab7419b57d2019a 100644 --- a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVector.h +++ b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVector.h @@ -66,7 +66,8 @@ namespace xAOD { /// Shift the elements of the vector virtual void shift( size_t pos, ptrdiff_t offs ) override; /// Insert a range of elements via move. - virtual bool insertMove (size_t pos, void* beg, void* end) override; + virtual bool insertMove (size_t pos, void* beg, void* end, + SG::IAuxStore& srcStore) override; /// @} diff --git a/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx b/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx index 3f4d156df4bce85b48819ddde417776808b32097..0908ed60c29e316222e333f3f489b6069affc50b 100644 --- a/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx +++ b/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx @@ -502,7 +502,8 @@ namespace xAOD { void* src_ptr = other.getData (id, other_size, other_size); if (src_ptr) { if (!v_dst->insertMove (pos, src_ptr, - reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id))) + reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other)) nomove = false; } } diff --git a/Event/xAOD/xAODCore/xAODCore/tools/AuxPersInfo.h b/Event/xAOD/xAODCore/xAODCore/tools/AuxPersInfo.h index fb5915e55b5b5deaf53f4ee45dfde67a1d96f78c..54fdbdcefc3f48d6f4e30b1a0c3162b9a490e191 100644 --- a/Event/xAOD/xAODCore/xAODCore/tools/AuxPersInfo.h +++ b/Event/xAOD/xAODCore/xAODCore/tools/AuxPersInfo.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // $Id: AuxPersInfo.h 793737 2017-01-24 20:11:10Z ssnyder $ @@ -75,7 +75,8 @@ namespace xAOD { throw std::runtime_error( "Calling shift on a non-vector" ); } - virtual bool insertMove (size_t /*pos*/, void* /*beg*/, void* /*end*/) override + virtual bool insertMove (size_t /*pos*/, void* /*beg*/, void* /*end*/, + SG::IAuxStore& /*srcStore*/) override { throw std::runtime_error( "Calling insertMove on a non-vector" ); } diff --git a/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx b/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx index 4e81b207ce876d5c2c926e87ea4d11a3e4bc8f83..94bef181b70be58833a452cc96fad3abba3eb0af 100644 --- a/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/ByteStreamAuxContainer_v1.cxx @@ -362,7 +362,8 @@ namespace xAOD { void* src_ptr = other.getData (id, other_size, other_size); if (src_ptr) { if (!v_dst->insertMove (pos, src_ptr, - reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id))) + reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other)) nomove = false; } } @@ -386,7 +387,8 @@ namespace xAOD { size_t sz = size_noLock(); getData1 (id, sz, sz, true, false); m_dynamicVecs[id]->resize (sz - other_size); - m_dynamicVecs[id]->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id)); + m_dynamicVecs[id]->insertMove (pos, src_ptr, reinterpret_cast<char*>(src_ptr) + other_size*r.getEltSize(id), + other); nomove = false; } }