Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-30 04:13:29

0001 #include "DataFormats/Provenance/interface/ParentageRegistry.h"
0002 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0003 
0004 namespace edm {
0005   ParentageRegistry* ParentageRegistry::instance() {
0006     CMS_THREAD_SAFE static ParentageRegistry s_reg;
0007     return &s_reg;
0008   }
0009 
0010   bool ParentageRegistry::getMapped(key_type const& k, value_type& result) const {
0011     auto it = m_map.find(k);
0012     bool found = it != m_map.end();
0013     if (found) {
0014       result = it->second;
0015     }
0016     return found;
0017   }
0018 
0019   ParentageRegistry::value_type const* ParentageRegistry::getMapped(key_type const& k) const {
0020     auto it = m_map.find(k);
0021     bool found = it != m_map.end();
0022     return found ? &(it->second) : static_cast<value_type const*>(nullptr);
0023   }
0024 
0025   bool ParentageRegistry::insertMapped(value_type const& v) { return m_map.insert(std::make_pair(v.id(), v)).second; }
0026 
0027   bool ParentageRegistry::insertMapped(value_type&& v) { return m_map.emplace(v.id(), std::move(v)).second; }
0028 
0029   void ParentageRegistry::clear() { m_map.clear(); }
0030 }  // namespace edm