test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Registry.cc
Go to the documentation of this file.
1 // ----------------------------------------------------------------------
2 // ----------------------------------------------------------------------
3 
4 #include <ostream>
5 
7 
8 namespace edm {
9  namespace pset {
10 
11  Registry*
13  [[cms::thread_safe]] static Registry s_reg;
14  return &s_reg;
15  }
16 
17  bool
19  auto it = m_map.find(k);
20  bool found = it != m_map.end();
21  if(found) {
22  result = it->second;
23  }
24  return found;
25  }
26 
28  Registry::getMapped(key_type const& k) const {
29  auto it = m_map.find(k);
30  bool found = it != m_map.end();
31  return found? &(it->second) : static_cast<value_type const*>(nullptr);
32  }
33 
34  bool
36  return m_map.insert(std::make_pair(v.id(),v)).second;
37  }
38 
39  void
41  m_map.clear();
42  }
43 
44  void
45  Registry::fillMap(regmap_type& fillme) const {
46  fillme.clear();
47  // Note: The tracked part is in the registry.
48  for (auto const& item : m_map) {
49  fillme[item.first].pset() = item.second.toString();
50  }
51  }
52 
53  void
54  Registry::print(std::ostream& os) const {
55  os << "Registry with " << size() << " entries\n";
56  for(auto const& item : *this) {
57  os << item.first << " " << item.second << '\n';
58  }
59  }
60  } // namespace pset
61 } // namespace edm
size_t size() const
Definition: Registry.h:77
ParameterSetID id() const
std::map< ParameterSetID, ParameterSetBlob > regmap_type
Definition: Registry.h:83
tuple result
Definition: mps_fire.py:83
void clear()
Not thread safe.
Definition: Registry.cc:40
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:18
void print(std::ostream &os) const
Definition: Registry.cc:54
map_type m_map
Definition: Registry.h:89
bool insertMapped(value_type const &v)
Definition: Registry.cc:35
void fillMap(regmap_type &fillme) const
Definition: Registry.cc:45
static Registry * instance()
Definition: Registry.cc:12