File indexing completed on 2024-04-06 12:12:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "oneapi/tbb/concurrent_unordered_map.h"
0015
0016
0017 #include "FWCore/Framework/interface/RecordDependencyRegister.h"
0018
0019 namespace edm {
0020 namespace eventsetup {
0021 namespace {
0022 struct KeyHash {
0023 std::size_t operator()(EventSetupRecordKey const& iKey) const { return iKey.type().value().hash_code(); }
0024 };
0025
0026 oneapi::tbb::concurrent_unordered_map<EventSetupRecordKey, DepFunction, KeyHash>& getMap() {
0027 static oneapi::tbb::concurrent_unordered_map<EventSetupRecordKey, DepFunction, KeyHash> s_map;
0028 return s_map;
0029 }
0030
0031 oneapi::tbb::concurrent_unordered_map<EventSetupRecordKey, bool, KeyHash>& getAllowMap() {
0032 static oneapi::tbb::concurrent_unordered_map<EventSetupRecordKey, bool, KeyHash> s_allow_map;
0033 return s_allow_map;
0034 }
0035 }
0036
0037 std::set<EventSetupRecordKey> dependencies(EventSetupRecordKey const& iKey) {
0038 auto& map = getMap();
0039 auto itFind = map.find(iKey);
0040 if (itFind != map.end()) {
0041 return itFind->second();
0042 }
0043 return std::set<EventSetupRecordKey>();
0044 }
0045
0046 bool allowConcurrentIOVs(EventSetupRecordKey const& iKey) {
0047 auto& map = getAllowMap();
0048 auto itFind = map.find(iKey);
0049 if (itFind != map.end()) {
0050 return itFind->second;
0051 }
0052 return false;
0053 }
0054
0055 void addDependencyFunction(EventSetupRecordKey iKey, DepFunction iFunction, bool allowConcurrentIOVs) {
0056 getMap().emplace(iKey, iFunction);
0057 getAllowMap().emplace(iKey, allowConcurrentIOVs);
0058 }
0059
0060 }
0061 }