diff --git a/Trigger/TrigDataAccess/TrigDataAccessMonitoring/CMakeLists.txt b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/CMakeLists.txt index 1e9fe16d4f4f67520c054f1121d7e01c1100e2ce..c4855c04c70f52d80cf28a6cdfc40a3247d28567 100644 --- a/Trigger/TrigDataAccess/TrigDataAccessMonitoring/CMakeLists.txt +++ b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/CMakeLists.txt @@ -19,3 +19,9 @@ atlas_add_test( Methods_test test/Methods_test.cxx LINK_LIBRARIES TrigDataAccessMonitoringLib POST_EXEC_SCRIPT nopost.sh ) + +atlas_add_test( Type_traits_test + SOURCES + test/ROBDataMonitor_type_traits_tests.cxx + LINK_LIBRARIES TrigDataAccessMonitoringLib + POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigDataAccess/TrigDataAccessMonitoring/TrigDataAccessMonitoring/ROBDataMonitor.h b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/TrigDataAccessMonitoring/ROBDataMonitor.h index aac0b43c9aa438a430fd0d51c08cdd7e8aa9d702..8d6a167f5d30d7a1935071c7fe95dafd6189472a 100644 --- a/Trigger/TrigDataAccess/TrigDataAccessMonitoring/TrigDataAccessMonitoring/ROBDataMonitor.h +++ b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/TrigDataAccessMonitoring/ROBDataMonitor.h @@ -48,6 +48,14 @@ namespace robmonitor { */ ROBDataStruct(const uint32_t); + ROBDataStruct(const ROBDataStruct&) = default; + + ROBDataStruct(ROBDataStruct&&) noexcept = default; + + ROBDataStruct& operator=(const ROBDataStruct&) = default; + + ROBDataStruct& operator=(ROBDataStruct&&) noexcept = default; + // data variables uint32_t rob_id; // rob source id uint32_t rob_size; // size of rob in words diff --git a/Trigger/TrigDataAccess/TrigDataAccessMonitoring/test/ROBDataMonitor_type_traits_tests.cxx b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/test/ROBDataMonitor_type_traits_tests.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7cdd8376b5f3f303f00bf5cd11a21aa72b6312ec --- /dev/null +++ b/Trigger/TrigDataAccess/TrigDataAccessMonitoring/test/ROBDataMonitor_type_traits_tests.cxx @@ -0,0 +1,15 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <type_traits> + +#include "TrigDataAccessMonitoring/ROBDataMonitor.h" + +int main() { + + static_assert(std::is_nothrow_move_constructible<robmonitor::ROBDataStruct>::value); + + return 0; +} \ No newline at end of file diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.h b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.h index 426b57b1cb7e20e93aaaf720eaf9a0e358686448..c408fb9f77225647436966d20b944f644ce53033 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.h +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.h @@ -59,7 +59,7 @@ class TrigCostDataStore { * @returns Success unless and class is not initialized, then Failure */ template<typename ENTRY> - StatusCode push_back(const AlgorithmIdentifier& ai, const ENTRY& entry); + StatusCode push_back(const AlgorithmIdentifier& ai, ENTRY&& entry); /** * @brief Retrieve a payload from the map given an AlgorithmIdentifier diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc index d3b77b522ff388bceb8c03b83e56d0bbff877a7e..d422d33474852edf4514fd25961a1f9767c3c622 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc @@ -34,7 +34,7 @@ StatusCode TrigCostDataStore<PAYLOAD>::insert(const AlgorithmIdentifier& ai, con template<typename PAYLOAD> template<typename ENTRY> -StatusCode TrigCostDataStore<PAYLOAD>::push_back(const AlgorithmIdentifier& ai, const ENTRY& entry) { +StatusCode TrigCostDataStore<PAYLOAD>::push_back(const AlgorithmIdentifier& ai, ENTRY&& entry) { MsgStream& msg = *(ai.m_msg); ATH_CHECK( checkSlot(ai.m_slotToSaveInto, msg) ); tbb::concurrent_hash_map<AlgorithmIdentifier, std::vector<ENTRY>, AlgorithmIdentifierHashCompare>& mapReference = m_store.at( ai.m_slotToSaveInto ); @@ -44,7 +44,7 @@ StatusCode TrigCostDataStore<PAYLOAD>::push_back(const AlgorithmIdentifier& ai, // and duplicate will not be added. Otherwise new payload will be created // Also obtains write lock on the key value 'name' until 'acc' goes out of scope mapReference.insert(acc, ai); - acc->second.push_back(entry); + acc->second.push_back(std::move(entry)); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx index 9dbebe8f7ec055ee9d6f5e9c89c1361239a5e65d..c0be8979c6946da739e5c30112814097b626fbff 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx @@ -187,7 +187,7 @@ StatusCode TrigCostMTSvc::monitorROS(const EventContext& /*context*/, robmonitor // Record data in TrigCostDataStore ATH_MSG_DEBUG( "Adding " << payload.rob_id << " to " << theAlg.m_hash ); - ATH_CHECK( m_rosData.push_back(theAlg, payload) ); + ATH_CHECK( m_rosData.push_back(theAlg, std::move(payload)) ); return StatusCode::SUCCESS; }