CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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);
53 
55  void clear();
56 
57  struct key_hash {
58  std::size_t operator()(key_type const& iKey) const{
59  return iKey.smallHash();
60  }
61  };
62  typedef tbb::concurrent_unordered_map<key_type,value_type,key_hash> map_type;
63  typedef map_type::const_iterator const_iterator;
64 
66  return m_map.begin();
67  }
68 
69  const_iterator end() const {
70  return m_map.end();
71  }
72 
73  bool empty() const {
74  return m_map.empty();
75  }
76 
77  size_t size() const {
78  return m_map.size();
79  }
80 
83  typedef std::map<ParameterSetID, ParameterSetBlob> regmap_type;
84  void fillMap(regmap_type& fillme) const;
85 
86  void print(std::ostream& os) const;
87 
88  private:
90  };
91 
93 
96 
101  } // namespace pset
102 
104 
105 } // namespace edm
106 
107 #endif
size_t size() const
Definition: Registry.h:77
map_type::const_iterator const_iterator
Definition: Registry.h:63
const_iterator end() const
Definition: Registry.h:69
std::map< ParameterSetID, ParameterSetBlob > regmap_type
Definition: Registry.h:83
bool empty() const
Definition: Registry.h:73
std::size_t operator()(key_type const &iKey) const
Definition: Registry.h:58
tuple result
Definition: query.py:137
edm::ParameterSet value_type
Definition: Registry.h:29
void clear()
Not thread safe.
Definition: Registry.cc:42
const_iterator begin() const
Definition: Registry.h:65
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:20
void setProcessParameterSetID(ParameterSetID const &id)
Associated free functions.
Definition: Registry.cc:76
int k[5][pyjets_maxn]
tbb::concurrent_unordered_map< key_type, value_type, key_hash > map_type
Definition: Registry.h:62
edm::ParameterSetID key_type
Definition: Registry.h:28
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:82
size_t smallHash() const
returns a short hash which can be used with hashing containers
Definition: Hash.h:220
void print(std::ostream &os) const
Definition: Registry.cc:56
map_type m_map
Definition: Registry.h:89
bool insertMapped(value_type const &v)
Definition: Registry.cc:37
ParameterSetID const & getProcessParameterSetID()
Definition: Registry.cc:64
void fillMap(regmap_type &fillme) const
Definition: Registry.cc:47
static Registry * instance()
Definition: Registry.cc:14