diff --git a/Event/EventContainers/EventContainers/IdentifiableValueContainer.h b/Event/EventContainers/EventContainers/IdentifiableValueContainer.h index 2b8c1b3f782bc89b1f13dcdfde536323d9266e51..8e20549f04607a13d4a07a62bb53adaeed280198 100644 --- a/Event/EventContainers/EventContainers/IdentifiableValueContainer.h +++ b/Event/EventContainers/EventContainers/IdentifiableValueContainer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EVENTCONTAINERS_IDENTIFIABLEVALUECONTAINER_H @@ -25,6 +25,7 @@ public: //Prevent accidental copying IdentifiableValueContainer(const IdentifiableValueContainer<T>&) = delete; + IdentifiableValueContainer& operator=(const IdentifiableValueContainer&) = delete; ~IdentifiableValueContainer() { if(m_own) delete m_cache; } diff --git a/Event/EventContainers/src/IdentifiableContainerBase.cxx b/Event/EventContainers/src/IdentifiableContainerBase.cxx index 7ed316fa3350416a173c3ed27606ededa51a11f5..a37c589ca642fff93c014e1ccf2893b3a3a2c9b4 100644 --- a/Event/EventContainers/src/IdentifiableContainerBase.cxx +++ b/Event/EventContainers/src/IdentifiableContainerBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "EventContainers/IdentifiableContainerBase.h" #include <algorithm> @@ -18,9 +18,10 @@ using namespace EventContainers; m_OnlineMode = true; } - IdentifiableContainerBase::IdentifiableContainerBase(size_t max){ - m_OnlineMode = false; - m_link = std::make_unique<EventContainers::InternalOffline>(max); + IdentifiableContainerBase::IdentifiableContainerBase(size_t max) + : m_OnlineMode (false), + m_link (std::make_unique<EventContainers::InternalOffline>(max)) + { } diff --git a/Event/EventContainers/test/IDC_Benchmark.cxx b/Event/EventContainers/test/IDC_Benchmark.cxx index 85c66d3dc51fcdf00d1de43f8f49bd95dbfe916b..e31be9f85f8dd13d01f115439fa65b5c98bfda2b 100644 --- a/Event/EventContainers/test/IDC_Benchmark.cxx +++ b/Event/EventContainers/test/IDC_Benchmark.cxx @@ -9,7 +9,7 @@ using namespace EventContainers; template<typename T> -void timedelete(std::string name, T* ptr){ +void timedelete(const std::string& name, T* ptr){ auto start1 = std::chrono::steady_clock::now(); delete ptr; auto end1 = std::chrono::steady_clock::now(); @@ -17,7 +17,7 @@ void timedelete(std::string name, T* ptr){ std::cout << name << " delete time " << time.count() << std::endl; } -void timebackwardsfill(std::string name, IdentifiableContainerMT<long unsigned int> *ptr){ +void timebackwardsfill(const std::string& name, IdentifiableContainerMT<long unsigned int> *ptr){ auto start1 = std::chrono::steady_clock::now(); for(size_t i =50000-2;i>=3;i-=3){ ptr->addCollection(new long unsigned int(i) ,i).ignore(); @@ -28,7 +28,7 @@ void timebackwardsfill(std::string name, IdentifiableContainerMT<long unsigned i } -void accessTime(std::string name, IdentifiableContainerMT<long unsigned int>& container){ +void accessTime(const std::string& name, IdentifiableContainerMT<long unsigned int>& container){ auto startwait = std::chrono::steady_clock::now(); container.prepareItr(); diff --git a/Event/EventContainers/test/IDC_Realistic_Test.cxx b/Event/EventContainers/test/IDC_Realistic_Test.cxx index 4d314ac2062dd7760e34256204b8cdd704c72a22..e991dc9ac2de7a430c9f27d67ffe56bc8edf12c3 100644 --- a/Event/EventContainers/test/IDC_Realistic_Test.cxx +++ b/Event/EventContainers/test/IDC_Realistic_Test.cxx @@ -69,9 +69,9 @@ public: MyCollection( ) :m_id(0) { return; } - MyCollection(const MyID& id ) { - m_id=id; - return; + MyCollection(const MyID& id ) + : m_id(id) + { } ~MyCollection() { std::vector<DIGIT*>::const_iterator it = m_vector.begin(); diff --git a/Event/EventContainers/test/IDMT_ContainerTest.cxx b/Event/EventContainers/test/IDMT_ContainerTest.cxx index a9a5fc1ff69656561f68066fdd6aaa1906095a19..32df3de434545bd84b94c907dcb96f771aec6147 100644 --- a/Event/EventContainers/test/IDMT_ContainerTest.cxx +++ b/Event/EventContainers/test/IDMT_ContainerTest.cxx @@ -4,6 +4,7 @@ // This is a test cxx file for IdentifiableContainerMT. // +#undef NDEBUG #include "EventContainers/IdentifiableContainerMT.h" #include "EventContainers/SelectAllObject.h" #include "EventContainers/IdentifiableContTemp.h" @@ -53,7 +54,7 @@ namespace IDC_TEST typedef std::vector<DIGIT*>::const_iterator const_iterator; MyCollection( ) :m_id(0) { return; } - MyCollection(const MyID& id ){ m_id=id; return; } + MyCollection(const MyID& id ) : m_id(id) { } ~MyCollection() { std::vector<DIGIT*>::const_iterator it = m_vector.begin(); std::vector<DIGIT*>::const_iterator it_end = m_vector.end(); @@ -344,11 +345,8 @@ int ID_ContainerTest::execute(EventContainers::Mode mode){ } {//Repeat with post incrementor operator SELECTOR select(m_container); - digit_const_iterator it1 = select.begin(); - digit_const_iterator it2 = select.end(); - nd = 0 ; - for(; it1!=it2; it1++){ - const MyDigit* digit = *it1; + nd = 0 ; + for (const MyDigit* digit : select) { volatile float t = digit->val(); t = t + 1.; ++nd; @@ -517,11 +515,8 @@ int ID_ContainerTest::execute(EventContainers::Mode mode){ } SELECTOR select(container2); - digit_const_iterator it1 = select.begin(); - digit_const_iterator it2 = select.end(); - nd = 0 ; - for(; it1!=it2; it1++){ - const MyDigit* digit = *it1; + nd = 0 ; + for (const MyDigit* digit : select) { volatile float t = digit->val(); t = t + 1.; ++nd; @@ -560,7 +555,8 @@ int ID_ContainerTest::execute(EventContainers::Mode mode){ // std::cout << "error:addCollection->" << p->identifyHash() << std::endl; std::vector<IdentifierHash> cacheshouldcontain = { IdentifierHash(0), IdentifierHash(3), IdentifierHash(10) }; std::vector<IdentifierHash> IDCshouldContain = { IdentifierHash(0), IdentifierHash(10) }; - assert(cache->ids().size() == 3); + size_t sz = cache->ids().size(); + assert(sz == 3); if(cache->ids() != cacheshouldcontain){ std::cout << __FILE__ << " cache does not contain correct elements" << std::endl; std::abort(); diff --git a/Event/EventContainers/test/ID_ContainerTest.cxx b/Event/EventContainers/test/ID_ContainerTest.cxx index 86204e92b04ee651ebd4025ed320b16d1eaa0ee2..f9452f52eaf1c9c96093b9e0f1dc0ac24610adfb 100644 --- a/Event/EventContainers/test/ID_ContainerTest.cxx +++ b/Event/EventContainers/test/ID_ContainerTest.cxx @@ -46,7 +46,7 @@ namespace IDC_TEST typedef std::vector<DIGIT*>::const_iterator const_iterator; MyCollection( ) :m_id(0) { return; } - MyCollection(MyID& id ){ m_id=id; return; } + MyCollection(MyID& id ) : m_id(id) { } ~MyCollection() { std::vector<DIGIT*>::const_iterator it = m_vector.begin(); std::vector<DIGIT*>::const_iterator it_end = m_vector.end();