#include "ParameterSetRegistry.h"
|
static std::recursive_mutex | mutex_ {} |
|
Definition at line 37 of file ParameterSetRegistry.h.
fhicl::ParameterSetRegistry::ParameterSetRegistry |
( |
ParameterSet const & |
| ) |
|
|
delete |
fhicl::ParameterSetRegistry::ParameterSetRegistry |
( |
ParameterSet && |
| ) |
|
|
delete |
fhicl::ParameterSetRegistry::~ParameterSetRegistry |
( |
| ) |
|
fhicl::ParameterSetRegistry::ParameterSetRegistry |
( |
| ) |
|
|
private |
bool fhicl::ParameterSetRegistry::empty |
( |
void |
| ) |
|
|
inlinestatic |
Definition at line 101 of file ParameterSetRegistry.h.
103 std::lock_guard<decltype(mutex_)> lock{
mutex_};
collection_type registry_
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
void fhicl::ParameterSetRegistry::exportTo |
( |
sqlite3 * |
db | ) |
|
|
static |
Definition at line 116 of file ParameterSetRegistry.cc.
References fhicl::detail::throwOnSQLiteFailure().
Referenced by fhicl::parse_file_and_fill_db(), and art::RootOutputFile::writeParameterSetRegistry().
119 std::lock_guard<decltype(mutex_)> lock{
mutex_};
121 cet::sqlite::Transaction txn{db};
122 cet::sqlite::exec(db,
123 "DROP TABLE IF EXISTS ParameterSets;" 124 "CREATE TABLE ParameterSets(ID PRIMARY KEY, PSetBlob);");
127 sqlite3_stmt* oStmt =
nullptr;
130 "INSERT OR IGNORE INTO ParameterSets(ID, PSetBlob) VALUES(?, ?);",
136 std::string id(p.first.to_string());
137 std::string psBlob(p.second.to_compact_string());
138 sqlite3_bind_text(oStmt, 1,
id.c_str(),
id.
size() + 1, SQLITE_STATIC);
141 oStmt, 2, psBlob.c_str(), psBlob.size() + 1, SQLITE_STATIC);
143 switch (sqlite3_step(oStmt)) {
145 sqlite3_reset(oStmt);
155 query_result<std::string, std::string> regPSes;
156 regPSes << select(
"*").from(primaryDB,
"ParameterSets");
158 for (
auto const& row : regPSes) {
159 std::string idString;
161 std::tie(idString, psBlob) = row;
163 oStmt, 1, idString.c_str(), idString.size() + 1, SQLITE_STATIC);
166 oStmt, 2, psBlob.c_str(), psBlob.size() + 1, SQLITE_STATIC);
168 switch (sqlite3_step(oStmt)) {
170 sqlite3_reset(oStmt);
177 sqlite3_finalize(oStmt);
collection_type registry_
static std::recursive_mutex mutex_
void throwOnSQLiteFailure(sqlite3 *db, char *msg=nullptr)
static ParameterSetRegistry & instance_()
Definition at line 211 of file ParameterSetRegistry.cc.
References fhicl::make_ParameterSet(), primaryDB_, registry_, stmt_, and fhicl::detail::throwOnSQLiteFailure().
217 if (
stmt_ ==
nullptr) {
219 "SELECT PSetBlob FROM ParameterSets WHERE ID = ?;",
225 auto idString =
id.to_string();
226 auto result = sqlite3_bind_text(
227 stmt_, 1, idString.c_str(), idString.size() + 1, SQLITE_STATIC);
229 result = sqlite3_step(
stmt_);
235 reinterpret_cast<char const*>(sqlite3_column_text(
stmt_, 0)), pset);
244 sqlite3_reset(
stmt_);
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
collection_type registry_
void throwOnSQLiteFailure(sqlite3 *db, char *msg=nullptr)
auto fhicl::ParameterSetRegistry::get |
( |
| ) |
|
|
inlinestaticnoexcept |
Definition at line 164 of file ParameterSetRegistry.h.
References fhicl::cant_find.
167 std::lock_guard<decltype(mutex_)> lock{
mutex_};
171 <<
"with ID " <<
id.to_string() <<
" in the registry.";
collection_type registry_
static std::recursive_mutex mutex_
const_iterator find_(ParameterSetID const &id)
cet::coded_exception< error, detail::translate > exception
static ParameterSetRegistry & instance_()
Definition at line 177 of file ParameterSetRegistry.h.
179 std::lock_guard<decltype(mutex_)> lock{
mutex_};
collection_type registry_
static std::recursive_mutex mutex_
const_iterator find_(ParameterSetID const &id)
static ParameterSetRegistry & instance_()
Definition at line 190 of file ParameterSetRegistry.h.
192 std::lock_guard<decltype(mutex_)> lock{
mutex_};
194 return reg.find(
id) != reg.cend();
collection_type registry_
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
void fhicl::ParameterSetRegistry::importFrom |
( |
sqlite3 * |
db | ) |
|
|
static |
Definition at line 68 of file ParameterSetRegistry.cc.
References fhicl::detail::throwOnSQLiteFailure().
Referenced by read_all_parameter_sets().
71 std::lock_guard<decltype(mutex_)> lock{
mutex_};
75 sqlite3_stmt* oStmt =
nullptr;
81 "INSERT OR IGNORE INTO ParameterSets(ID, PSetBlob) VALUES(?, ?);",
88 query_result<std::string, std::string> inputPSes;
89 inputPSes << select(
"*").from(db,
"ParameterSets");
91 for (
auto const& row : inputPSes) {
94 std::tie(idString, psBlob) = row;
97 oStmt, 1, idString.c_str(), idString.size() + 1, SQLITE_STATIC);
100 oStmt, 2, psBlob.c_str(), psBlob.size() + 1, SQLITE_STATIC);
102 switch (sqlite3_step(oStmt)) {
108 sqlite3_reset(oStmt);
111 sqlite3_finalize(oStmt);
static std::recursive_mutex mutex_
void throwOnSQLiteFailure(sqlite3 *db, char *msg=nullptr)
static ParameterSetRegistry & instance_()
auto fhicl::ParameterSetRegistry::instance_ |
( |
| ) |
|
|
inlinestaticprivate |
auto fhicl::ParameterSetRegistry::put |
( |
ParameterSet const & |
ps | ) |
|
|
inlinestatic |
template<class FwdIt >
static std::enable_if_t< std::is_same<typename std::iterator_traits<FwdIt>::value_type, mapped_type>::value> fhicl::ParameterSetRegistry::put |
( |
FwdIt |
begin, |
|
|
FwdIt |
end |
|
) |
| |
|
static |
template<class FwdIt >
static std::enable_if_t< std::is_same<typename std::iterator_traits<FwdIt>::value_type, value_type>::value> fhicl::ParameterSetRegistry::put |
( |
FwdIt |
begin, |
|
|
FwdIt |
end |
|
) |
| |
|
static |
Definition at line 150 of file ParameterSetRegistry.h.
153 put(c.cbegin(), c.cend());
static ParameterSetID const & put(ParameterSet const &ps)
template<class FwdIt >
auto fhicl::ParameterSetRegistry::put |
( |
FwdIt |
b, |
|
|
FwdIt const |
e |
|
) |
| -> std::enable_if_t<
std::is_same<typename std::iterator_traits<FwdIt>::value_type,
mapped_type>::value>
|
|
inline |
auto fhicl::ParameterSetRegistry::size |
( |
void |
| ) |
|
|
inlinestatic |
Definition at line 108 of file ParameterSetRegistry.h.
110 std::lock_guard<decltype(mutex_)> lock{
mutex_};
collection_type registry_
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
void fhicl::ParameterSetRegistry::stageIn |
( |
| ) |
|
|
static |
Definition at line 182 of file ParameterSetRegistry.cc.
References evd::details::begin(), and fhicl::make_ParameterSet().
Referenced by read_all_parameter_sets().
184 std::lock_guard<decltype(mutex_)> lock{
mutex_};
189 query_result<std::string, std::string> entriesToStageIn;
190 entriesToStageIn << select(
"*").from(primaryDB,
"ParameterSets");
192 cet::transform_all(entriesToStageIn,
193 std::inserter(registry,
std::begin(registry)),
194 [](
auto const& row) {
195 std::string idString;
197 std::tie(idString, psBlob) = row;
200 return std::make_pair(ParameterSetID{idString}, pset);
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
collection_type registry_
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
std::recursive_mutex fhicl::ParameterSetRegistry::mutex_ {} |
|
staticprivate |
sqlite3* fhicl::ParameterSetRegistry::primaryDB_ |
|
private |
sqlite3_stmt* fhicl::ParameterSetRegistry::stmt_ {nullptr} |
|
private |
The documentation for this class was generated from the following files: