CMS 3D CMS Logo

RecordDependencyRegister.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : RecordDependencyRegister
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: root
10 // Created: Thu, 26 Apr 2018 16:03:47 GMT
11 //
12 
13 // system include files
14 #include "tbb/concurrent_unordered_map.h"
15 
16 // user include files
18 
19 namespace edm {
20  namespace eventsetup {
21  namespace {
22  struct KeyHash {
23  std::size_t operator()(EventSetupRecordKey const& iKey) const { return iKey.type().value().hash_code(); }
24  };
25 
26  tbb::concurrent_unordered_map<EventSetupRecordKey, DepFunction, KeyHash>& getMap() {
27  static tbb::concurrent_unordered_map<EventSetupRecordKey, DepFunction, KeyHash> s_map;
28  return s_map;
29  }
30  } // namespace
31 
32  std::set<EventSetupRecordKey> dependencies(EventSetupRecordKey const& iKey) {
33  auto& map = getMap();
34  auto itFind = map.find(iKey);
35  if (itFind != map.end()) {
36  return itFind->second();
37  }
38  return std::set<EventSetupRecordKey>();
39  }
40 
41  void addDependencyFunction(EventSetupRecordKey iKey, DepFunction iFunction) { getMap().emplace(iKey, iFunction); }
42 
43  } // namespace eventsetup
44 } // namespace edm
std::set< EventSetupRecordKey >(*)( DepFunction)
std::set< EventSetupRecordKey > dependencies(EventSetupRecordKey const &)
void addDependencyFunction(EventSetupRecordKey iKey, DepFunction iFunction)
HLT enums.