File indexing completed on 2023-03-17 10:51:06
0001 #ifndef DataFormats_Provenance_ParentageRegistry_h
0002 #define DataFormats_Provenance_ParentageRegistry_h
0003
0004 #include "oneapi/tbb/concurrent_unordered_map.h"
0005
0006 #include "DataFormats/Provenance/interface/Parentage.h"
0007 #include "DataFormats/Provenance/interface/ParentageID.h"
0008
0009
0010
0011 namespace edm {
0012 class ParentageRegistry {
0013 public:
0014 typedef edm::ParentageID key_type;
0015 typedef edm::Parentage value_type;
0016
0017 static ParentageRegistry* instance();
0018
0019
0020
0021
0022
0023
0024 bool getMapped(key_type const& k, value_type& result) const;
0025
0026
0027
0028
0029 value_type const* getMapped(key_type const& k) const;
0030
0031
0032
0033
0034
0035
0036
0037
0038 bool insertMapped(value_type const& v);
0039 bool insertMapped(value_type&& v);
0040
0041
0042 void clear();
0043
0044 struct key_hash {
0045 std::size_t operator()(key_type const& iKey) const { return iKey.smallHash(); }
0046 };
0047
0048 private:
0049 oneapi::tbb::concurrent_unordered_map<key_type, value_type, key_hash> m_map;
0050 };
0051
0052 }
0053
0054 #endif