1 #ifndef fhiclcpp_ParameterSetRegistry_h 2 #define fhiclcpp_ParameterSetRegistry_h 25 #include <unordered_map> 29 class ParameterSetRegistry;
32 class HashParameterSetID;
56 unordered_map<ParameterSetID, ParameterSet, detail::HashParameterSetID>;
57 using key_type =
typename collection_type::key_type;
60 using size_type =
typename collection_type::size_type;
64 static void importFrom(
sqlite3* db);
65 static void exportTo(
sqlite3* db);
66 static void stageIn();
76 template <
class FwdIt>
77 static std::enable_if_t<
78 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
83 template <
class FwdIt>
84 static std::enable_if_t<
85 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
112 std::lock_guard sentry{mutex_};
113 return instance_().registry_.empty();
119 std::lock_guard sentry{mutex_};
120 return instance_().registry_.size();
128 std::lock_guard sentry{mutex_};
129 return instance_().registry_.emplace(
ps.id(),
ps).first->first;
133 template <
class FwdIt>
136 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
mapped_type>>
139 for (;
b !=
e; ++
b) {
145 template <
class FwdIt>
149 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
152 std::lock_guard sentry{mutex_};
153 instance_().registry_.insert(
b,
e);
161 put(c.cbegin(), c.cend());
167 std::lock_guard sentry{mutex_};
168 return instance_().registry_;
175 std::lock_guard sentry{mutex_};
176 auto it = instance_().find_(
id);
177 if (it == instance_().registry_.cend()) {
179 <<
"with ID " <<
id.to_string() <<
" in the registry.";
187 std::lock_guard sentry{mutex_};
189 auto it = instance_().find_(
id);
190 if (it != instance_().registry_.cend()) {
200 std::lock_guard sentry{mutex_};
201 auto const&
reg = instance_().registry_;
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
typename collection_type::size_type size_type
static ParameterSetID const & put(ParameterSet const &ps)
void msg(const char *fmt,...)
static collection_type const & get() noexcept
struct sqlite3_stmt sqlite3_stmt
std::hash< std::string > hash_
std::string to_string(Protection p)
typename collection_type::mapped_type mapped_type
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
static const_iterator cend()
size_t operator()(ParameterSetID const &id) const
static constexpr double ps
static bool has(ParameterSetID const &id)
static std::recursive_mutex mutex_
typename collection_type::const_iterator const_iterator
void throwOnSQLiteFailure(int rc, char *msg=nullptr)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
typename collection_type::value_type value_type
cet::coded_exception< error, detail::translate > exception
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
typename collection_type::key_type key_type
static ParameterSetRegistry & instance_()
std::unordered_map< ParameterSetID, ParameterSet, detail::HashParameterSetID > collection_type