CMS 3D CMS Logo

Registry.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_Registry_h
2 #define FWCore_ParameterSet_Registry_h
3 
4 // ----------------------------------------------------------------------
5 // Declaration for pset::Registry. This is an implementation detail of
6 // the ParameterSet library.
7 //
8 // A Registry is used to keep track of the persistent form of all
9 // ParameterSets used a given program, so that they may be retrieved by
10 // ParameterSetID, and so they may be written to persistent storage.
11 // Note that this registry is *not* directly persistable. The contents
12 // are persisted, but not the container.
13 // ----------------------------------------------------------------------
14 
15 #include <iosfwd>
16 #include <map>
17 #include "tbb/concurrent_unordered_map.h"
18 
22 
23 namespace edm {
24  namespace pset {
25 
26  class Registry {
27  public:
30 
31  static Registry* instance();
32 
38  bool getMapped(key_type const& k, value_type& result) const;
39 
43  value_type const* getMapped(key_type const& k) const;
44 
52  bool insertMapped(value_type const& v, bool forceUpdate = false);
53 
55  void clear();
56 
57  struct key_hash {
58  std::size_t operator()(key_type const& iKey) const { return iKey.smallHash(); }
59  };
60  typedef tbb::concurrent_unordered_map<key_type, value_type, key_hash> map_type;
61  typedef map_type::const_iterator const_iterator;
62 
63  const_iterator begin() const { return m_map.begin(); }
64 
65  const_iterator end() const { return m_map.end(); }
66 
67  bool empty() const { return m_map.empty(); }
68 
69  size_t size() const { return m_map.size(); }
70 
73  typedef std::map<ParameterSetID, ParameterSetBlob> regmap_type;
74  void fillMap(regmap_type& fillme) const;
75 
76  void print(std::ostream& os) const;
77 
78  private:
80  };
81 
82  } // namespace pset
83 } // namespace edm
84 
85 #endif
edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
edm
HLT enums.
Definition: AlignableModifier.h:19
ParameterSetBlob.h
edm::pset::Registry::regmap_type
std::map< ParameterSetID, ParameterSetBlob > regmap_type
Definition: Registry.h:73
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Hash::smallHash
size_t smallHash() const
returns a short hash which can be used with hashing containers
Definition: Hash.h:191
edm::pset::Registry::clear
void clear()
Not thread safe.
Definition: Registry.cc:40
edm::pset::Registry::end
const_iterator end() const
Definition: Registry.h:65
edm::Hash< ParameterSetType >
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::pset::Registry::fillMap
void fillMap(regmap_type &fillme) const
Definition: Registry.cc:42
edm::pset::Registry::key_hash::operator()
std::size_t operator()(key_type const &iKey) const
Definition: Registry.h:58
edm::pset::Registry::empty
bool empty() const
Definition: Registry.h:67
edm::ParameterSet
Definition: ParameterSet.h:47
edm::pset::Registry::key_hash
Definition: Registry.h:57
edm::pset::Registry::print
void print(std::ostream &os) const
Definition: Registry.cc:50
edm::pset::Registry::key_type
edm::ParameterSetID key_type
Definition: Registry.h:28
edm::pset::Registry::value_type
edm::ParameterSet value_type
Definition: Registry.h:29
edm::pset::Registry::insertMapped
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
edm::pset::Registry::size
size_t size() const
Definition: Registry.h:69
ParameterSetID.h
edm::pset::Registry::map_type
tbb::concurrent_unordered_map< key_type, value_type, key_hash > map_type
Definition: Registry.h:60
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
edm::pset::Registry::begin
const_iterator begin() const
Definition: Registry.h:63
edm::pset::Registry::const_iterator
map_type::const_iterator const_iterator
Definition: Registry.h:61
edm::pset::Registry::m_map
map_type m_map
Definition: Registry.h:79
edm::pset::Registry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
edm::pset::Registry
Definition: Registry.h:26
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27