Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
fhicl::ParameterSetRegistry Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/fhiclcpp/v4_06_10/source/fhiclcpp/ParameterSetRegistry.h"

Public Types

using collection_type = std::unordered_map< ParameterSetID, ParameterSet, detail::HashParameterSetID >
 
using key_type = typename collection_type::key_type
 
using mapped_type = typename collection_type::mapped_type
 
using value_type = typename collection_type::value_type
 
using size_type = typename collection_type::size_type
 
using const_iterator = typename collection_type::const_iterator
 

Public Member Functions

 ParameterSetRegistry (ParameterSet const &)=delete
 
 ParameterSetRegistry (ParameterSet &&)=delete
 
ParameterSetRegistryoperator= (ParameterSet const &)=delete
 
ParameterSetRegistryoperator= (ParameterSet &&)=delete
 
 ~ParameterSetRegistry ()
 
template<class FwdIt >
auto put (FwdIt b, FwdIt const e) -> std::enable_if_t< std::is_same< typename std::iterator_traits< FwdIt >::value_type, mapped_type >::value >
 

Static Public Member Functions

static void importFrom (sqlite3 *db)
 
static void exportTo (sqlite3 *db)
 
static void stageIn ()
 
static bool empty ()
 
static size_type size ()
 
static ParameterSetID const & put (ParameterSet const &ps)
 
template<class FwdIt >
static std::enable_if_t< std::is_same< typename std::iterator_traits< FwdIt >::value_type, mapped_type >::valueput (FwdIt begin, FwdIt end)
 
template<class FwdIt >
static std::enable_if_t< std::is_same< typename std::iterator_traits< FwdIt >::value_type, value_type >::valueput (FwdIt begin, FwdIt end)
 
static void put (collection_type const &c)
 
static collection_type const & get () noexcept
 
static ParameterSet const & get (ParameterSetID const &id)
 
static bool get (ParameterSetID const &id, ParameterSet &ps)
 
static bool has (ParameterSetID const &id)
 

Private Member Functions

 ParameterSetRegistry ()
 
const_iterator find_ (ParameterSetID const &id)
 

Static Private Member Functions

static ParameterSetRegistryinstance_ ()
 

Private Attributes

sqlite3 * primaryDB_
 
sqlite3_stmt * stmt_ {nullptr}
 
collection_type registry_ {}
 

Static Private Attributes

static std::recursive_mutex mutex_
 

Detailed Description

Definition at line 38 of file ParameterSetRegistry.h.

Member Typedef Documentation

Definition at line 48 of file ParameterSetRegistry.h.

using fhicl::ParameterSetRegistry::const_iterator = typename collection_type::const_iterator

Definition at line 53 of file ParameterSetRegistry.h.

using fhicl::ParameterSetRegistry::key_type = typename collection_type::key_type

Definition at line 49 of file ParameterSetRegistry.h.

using fhicl::ParameterSetRegistry::mapped_type = typename collection_type::mapped_type

Definition at line 50 of file ParameterSetRegistry.h.

using fhicl::ParameterSetRegistry::size_type = typename collection_type::size_type

Definition at line 52 of file ParameterSetRegistry.h.

using fhicl::ParameterSetRegistry::value_type = typename collection_type::value_type

Definition at line 51 of file ParameterSetRegistry.h.

Constructor & Destructor Documentation

fhicl::ParameterSetRegistry::ParameterSetRegistry ( ParameterSet const &  )
delete
fhicl::ParameterSetRegistry::ParameterSetRegistry ( ParameterSet &&  )
delete
fhicl::ParameterSetRegistry::~ParameterSetRegistry ( )
fhicl::ParameterSetRegistry::ParameterSetRegistry ( )
private

Member Function Documentation

bool fhicl::ParameterSetRegistry::empty ( )
inlinestatic

Definition at line 102 of file ParameterSetRegistry.h.

103 {
104  std::lock_guard<decltype(mutex_)> lock{mutex_};
105  return instance_().registry_.empty();
106 }
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
static void fhicl::ParameterSetRegistry::exportTo ( sqlite3 *  db)
static
const_iterator fhicl::ParameterSetRegistry::find_ ( ParameterSetID const &  id)
private
auto fhicl::ParameterSetRegistry::get ( )
inlinestaticnoexcept

Definition at line 158 of file ParameterSetRegistry.h.

Referenced by art::ResultsProducer::doBeginJob().

159 {
160  std::lock_guard<decltype(mutex_)> lock{mutex_};
161  return instance_().registry_;
162 }
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
auto fhicl::ParameterSetRegistry::get ( ParameterSetID const &  id)
inlinestatic

Definition at line 165 of file ParameterSetRegistry.h.

References fhicl::cant_find, and it.

167 {
168  std::lock_guard<decltype(mutex_)> lock{mutex_};
169  auto it = instance_().find_(id);
170  if (it == instance_().registry_.cend()) {
171  throw exception(error::cant_find, "Can't find ParameterSet")
172  << "with ID " << id.to_string() << " in the registry.";
173  }
174  return it->second;
175 }
set< int >::iterator it
const_iterator find_(ParameterSetID const &id)
static std::recursive_mutex mutex_
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
static ParameterSetRegistry & instance_()
bool fhicl::ParameterSetRegistry::get ( ParameterSetID const &  id,
ParameterSet ps 
)
inlinestatic

Definition at line 178 of file ParameterSetRegistry.h.

References it, and fillBadChanDBTables::result.

179 {
180  std::lock_guard<decltype(mutex_)> lock{mutex_};
181  bool result{false};
182  auto it = instance_().find_(id);
183  if (it != instance_().registry_.cend()) {
184  ps = it->second;
185  result = true;
186  }
187  return result;
188 }
set< int >::iterator it
const_iterator find_(ParameterSetID const &id)
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
bool fhicl::ParameterSetRegistry::has ( ParameterSetID const &  id)
inlinestatic

Definition at line 191 of file ParameterSetRegistry.h.

192 {
193  std::lock_guard<decltype(mutex_)> lock{mutex_};
194  auto const& reg = instance_().registry_;
195  return reg.find(id) != reg.cend();
196 }
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
static void fhicl::ParameterSetRegistry::importFrom ( sqlite3 *  db)
static
auto fhicl::ParameterSetRegistry::instance_ ( )
inlinestaticprivate

Definition at line 199 of file ParameterSetRegistry.h.

200 {
201  static ParameterSetRegistry s_registry;
202  return s_registry;
203 }
ParameterSetRegistry& fhicl::ParameterSetRegistry::operator= ( ParameterSet const &  )
delete
ParameterSetRegistry& fhicl::ParameterSetRegistry::operator= ( ParameterSet &&  )
delete
auto fhicl::ParameterSetRegistry::put ( ParameterSet const &  ps)
inlinestatic

Definition at line 117 of file ParameterSetRegistry.h.

References nd_projection_maker::ps.

Referenced by put().

119 {
120  std::lock_guard<decltype(mutex_)> lock{mutex_};
121  return instance_().registry_.emplace(ps.id(), ps).first->first;
122 }
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
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
void fhicl::ParameterSetRegistry::put ( collection_type const &  c)
inlinestatic

Definition at line 151 of file ParameterSetRegistry.h.

152 {
153  // No lock here -- it will be acquired by 3.
154  put(c.cbegin(), c.cend());
155 }
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

Definition at line 127 of file ParameterSetRegistry.h.

References b, e, put(), and void().

130 {
131  // No lock here -- it will be acquired by 3.
132  for (; b != e; ++b) {
133  (void)put(*b);
134  }
135 }
static ParameterSetID const & put(ParameterSet const &ps)
const hit & b
Definition: hits.cxx:21
Float_t e
Definition: plot.C:35
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
auto fhicl::ParameterSetRegistry::size ( void  )
inlinestatic

Definition at line 109 of file ParameterSetRegistry.h.

110 {
111  std::lock_guard<decltype(mutex_)> lock{mutex_};
112  return instance_().registry_.size();
113 }
static std::recursive_mutex mutex_
static ParameterSetRegistry & instance_()
static void fhicl::ParameterSetRegistry::stageIn ( )
static

Member Data Documentation

std::recursive_mutex fhicl::ParameterSetRegistry::mutex_
staticprivate

Definition at line 98 of file ParameterSetRegistry.h.

sqlite3* fhicl::ParameterSetRegistry::primaryDB_
private

Definition at line 95 of file ParameterSetRegistry.h.

collection_type fhicl::ParameterSetRegistry::registry_ {}
private

Definition at line 97 of file ParameterSetRegistry.h.

sqlite3_stmt* fhicl::ParameterSetRegistry::stmt_ {nullptr}
private

Definition at line 96 of file ParameterSetRegistry.h.


The documentation for this class was generated from the following file: