File indexing completed on 2023-03-17 11:03:21
0001 #ifndef FWCore_ParameterSet_Registry_h
0002 #define FWCore_ParameterSet_Registry_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <iosfwd>
0016 #include <map>
0017 #include "oneapi/tbb/concurrent_unordered_map.h"
0018
0019 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0020 #include "DataFormats/Provenance/interface/ParameterSetBlob.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022
0023 namespace edm {
0024 namespace pset {
0025
0026 class Registry {
0027 public:
0028 typedef edm::ParameterSetID key_type;
0029 typedef edm::ParameterSet value_type;
0030
0031 static Registry* instance();
0032
0033
0034
0035
0036
0037
0038 bool getMapped(key_type const& k, value_type& result) const;
0039
0040
0041
0042
0043 value_type const* getMapped(key_type const& k) const;
0044
0045
0046
0047
0048
0049
0050
0051
0052 bool insertMapped(value_type const& v, bool forceUpdate = false);
0053
0054
0055 void clear();
0056
0057 struct key_hash {
0058 std::size_t operator()(key_type const& iKey) const { return iKey.smallHash(); }
0059 };
0060 typedef oneapi::tbb::concurrent_unordered_map<key_type, value_type, key_hash> map_type;
0061 typedef map_type::const_iterator const_iterator;
0062
0063 const_iterator begin() const { return m_map.begin(); }
0064
0065 const_iterator end() const { return m_map.end(); }
0066
0067 bool empty() const { return m_map.empty(); }
0068
0069 size_t size() const { return m_map.size(); }
0070
0071
0072
0073 typedef std::map<ParameterSetID, ParameterSetBlob> regmap_type;
0074 void fillMap(regmap_type& fillme) const;
0075
0076 void print(std::ostream& os) const;
0077
0078 private:
0079 map_type m_map;
0080 };
0081
0082 }
0083 }
0084
0085 #endif