Namespaces | Classes | Typedefs | Enumerations | Functions
fhicl::detail Namespace Reference

Namespaces

 atom
 
 no_defaults
 
 sequence
 
 table
 
 yes_defaults
 

Classes

struct  AllowedConfiguration
 
class  AtomBase
 
class  DelegateBase
 
class  HashParameterSetID
 
class  Indentation
 
class  it_value_get
 
class  it_value_get< std::complex< U >, typename tt::disable_if< std::is_reference< std::complex< U > >::value|| std::is_pointer< std::complex< U > >::value >::type >
 
class  it_value_get< T, typename tt::disable_if< std::is_reference< T >::value|| std::is_pointer< T >::value >::type >
 
class  it_value_get< intermediate_table::sequence_t & >
 
class  it_value_get< intermediate_table::sequence_t >
 
class  it_value_get< intermediate_table::sequence_t const & >
 
class  it_value_get< intermediate_table::table_t & >
 
class  it_value_get< intermediate_table::table_t >
 
class  it_value_get< intermediate_table::table_t const & >
 
class  KeyAssembler
 
class  Keys
 
class  MaybeDisplayParent
 
class  ParameterBase
 
class  ParameterMetadata
 
class  ParameterWalker
 
struct  per_entry
 
struct  per_entry< 0, TUPLE >
 
class  Prettifier
 
class  PrettifierAnnotated
 
class  PrettifierPrefixAnnotated
 
class  PrintAllowedConfiguration
 
class  RegisterIfTableMember
 
class  SearchAllowedConfiguration
 
class  SequenceBase
 
class  SequenceKey
 
class  TableBase
 
class  TableMemberRegistry
 
class  ValidateThenSet
 
class  validationException
 
struct  void_t< decltype(typename T::Parameters{ std::declval< fhicl::Name >()})>
 

Typedefs

using ps_atom_t = std::string
 
using ps_sequence_t = std::vector< std::any >
 
using ldbl = long double
 
using key_t = std::string
 
using name_t = std::string
 
using cit_size_t = std::vector< std::size_t >::const_iterator
 
using base_ptr = cet::exempt_ptr< ParameterBase >
 

Enumerations

enum  binding_modifier : unsigned char { binding_modifier::NONE, binding_modifier::PROTECT_IGNORE, binding_modifier::PROTECT_ERROR }
 
enum  print_mode { print_mode::raw, print_mode::annotated, print_mode::prefix_annotated }
 

Functions

bool is_sequence (std::any const &val)
 
bool is_table (std::any const &val)
 
bool is_nil (std::any const &val)
 
ps_atom_t encode (std::string const &)
 
ps_atom_t encode (char const *)
 
ps_atom_t encode (void *)
 
ps_atom_t encode (bool)
 
ParameterSetID encode (ParameterSet const &)
 
ps_atom_t encode (std::uintmax_t)
 
template<class T >
std::enable_if_t< tt::is_uint< T >::value, ps_atom_tencode (T const &)
 
ps_atom_t encode (std::intmax_t)
 
template<class T >
std::enable_if_t< tt::is_int< T >::value, ps_atom_tencode (T const &)
 
ps_atom_t encode (ldbl)
 
template<class T >
std::enable_if_t< std::is_floating_point_v< T >, ps_atom_tencode (T const &)
 
template<class T >
ps_atom_t encode (std::complex< T > const &)
 
template<class T >
ps_sequence_t encode (std::vector< T > const &)
 
template<class T >
tt::disable_if_t< tt::is_numeric< T >::value, std::stringencode (T const &)
 
void decode (std::any const &, std::string &)
 
void decode (std::any const &, void *&)
 
void decode (std::any const &, bool &)
 
void decode (std::any const &, ParameterSet &)
 
void decode (std::any const &, std::uintmax_t &)
 
template<class T >
std::enable_if_t< tt::is_uint< T >::valuedecode (std::any const &, T &)
 
void decode (std::any const &, std::intmax_t &)
 
template<class T >
std::enable_if_t< tt::is_int< T >::valuedecode (std::any const &, T &)
 
void decode (std::any const &, ldbl &)
 
template<class T >
std::enable_if_t< std::is_floating_point_v< T > > decode (std::any const &, T &)
 
void decode (std::any const &, std::complex< ldbl > &)
 
template<class T >
void decode (std::any const &, std::complex< T > &)
 
template<class T >
void decode (std::any const &, std::vector< T > &)
 
template<typename U >
void decode_tuple (std::any const &, U &tuple)
 
template<typename T , std::size_t SIZE>
void decode (std::any const &a, std::array< T, SIZE > &result)
 
template<typename KEY , typename VALUE >
void decode (std::any const &a, std::pair< KEY, VALUE > &result)
 
template<typename... ARGS>
void decode (std::any const &a, std::tuple< ARGS... > &result)
 
template<class T >
tt::disable_if_t< tt::is_numeric< T >::valuedecode (std::any const &, T &)
 
std::any encode (extended_value const &xval)
 
Keys get_names (std::string const &key)
 
SequenceKey get_sequence_indices (std::string const &key)
 
bool find_an_any (cit_size_t it, cit_size_t const cend, std::any &a)
 
std::string nl (std::size_t i=1)
 
std::string printed_suffix (std::string const &key, std::size_t const sz)
 
std::string print_prefix_annotated_info (std::string const &curr_info)
 
std::string print_annotated_info (std::string const &curr_info, std::string const &cached_info)
 
bool is_sequence_element (std::string const &key)
 
bool is_table_member (std::string const &key)
 
std::size_t index_for_sequence_element (std::string const &name)
 
template<typename L >
void try_insert (L l, std::string const &key)
 
std::string translate (error)
 
void throwOnSQLiteFailure (int rc, char *msg=nullptr)
 
void throwOnSQLiteFailure (sqlite3 *db, char *msg=nullptr)
 
std::function< bool()> AlwaysUse ()
 
void check_nargs_for_bounded_sequences (std::string const &key, std::size_t expected, std::size_t provided)
 
std::string optional_parameter_message (bool const with_comment=true)
 
std::string strip_first_containing_name (std::string const &key)
 
std::string strip_all_containing_names (std::string const &key)
 
template<typename T >
std::set< std::stringensure_callable ()
 
std::set< std::string > & concatenate_keys (std::set< std::string > &keys)
 
template<typename H , typename... T>
std::set< std::string > & concatenate_keys (std::set< std::string > &keys, H const &h, T const &...t)
 

Typedef Documentation

Definition at line 18 of file MaybeDisplayParent.h.

using fhicl::detail::cit_size_t = typedef std::vector<std::size_t>::const_iterator

Definition at line 71 of file ParameterSetImplHelpers.h.

Definition at line 70 of file KeyAssembler.h.

using fhicl::detail::ldbl = typedef long double

Definition at line 46 of file coding.h.

Definition at line 71 of file KeyAssembler.h.

Definition at line 44 of file coding.h.

using fhicl::detail::ps_sequence_t = typedef std::vector<std::any>

Definition at line 45 of file coding.h.

Enumeration Type Documentation

enum fhicl::detail::binding_modifier : unsigned char
strong
Enumerator
NONE 
PROTECT_IGNORE 
PROTECT_ERROR 

Definition at line 5 of file binding_modifier.h.

5  : unsigned char {
6  NONE,
9 #if 0 /* Preparation for issue #7231. */
10  INITIAL,
11  REPLACE,
12  REPLACE_COMPAT,
13  ADD_OR_REPLACE_COMPAT
14 #endif
15  };

Function Documentation

std::function<bool()> fhicl::detail::AlwaysUse ( )
inline
void fhicl::detail::check_nargs_for_bounded_sequences ( std::string const &  key,
std::size_t  expected,
std::size_t  provided 
)
std::set<std::string>& fhicl::detail::concatenate_keys ( std::set< std::string > &  keys)
inline

Definition at line 22 of file KeysToIgnore.h.

References T.

Referenced by concatenate_keys(), and fhicl::KeysToIgnore< H, T >::operator()().

23  {
24  return keys;
25  }
template<typename H , typename... T>
std::set<std::string>& fhicl::detail::concatenate_keys ( std::set< std::string > &  keys,
H const &  h,
T const &...  t 
)

Definition at line 29 of file KeysToIgnore.h.

References concatenate_keys(), febshutoff_auto::end, and T.

30  {
31  keys.insert(begin(h), end(h));
32  return concatenate_keys(keys, t...);
33  }
std::set< std::string > & concatenate_keys(std::set< std::string > &keys, H const &h, T const &...t)
Definition: KeysToIgnore.h:29
void fhicl::detail::decode ( std::any const &  ,
std::string  
)
void fhicl::detail::decode ( std::any const &  ,
void *&   
)
void fhicl::detail::decode ( std::any const &  ,
bool &   
)
void fhicl::detail::decode ( std::any const &  ,
ParameterSet  
)
void fhicl::detail::decode ( std::any const &  ,
std::uintmax_t &   
)
template<class T >
std::enable_if_t< tt::is_uint< T >::value > fhicl::detail::decode ( std::any const &  a,
T result 
)

Definition at line 211 of file coding.h.

References decode(), and T.

212 {
213  std::uintmax_t via;
214  decode(a, via);
215  result = boost::numeric_cast<T>(via);
216 }
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
const double a
double T
Definition: Xdiff_gwt.C:5
void fhicl::detail::decode ( std::any const &  ,
std::intmax_t &   
)
template<class T >
std::enable_if_t< tt::is_int< T >::value > fhicl::detail::decode ( std::any const &  a,
T result 
)

Definition at line 222 of file coding.h.

References decode(), and T.

223 {
224  std::intmax_t via;
225  decode(a, via);
226  result = boost::numeric_cast<T>(via);
227 }
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
const double a
double T
Definition: Xdiff_gwt.C:5
void fhicl::detail::decode ( std::any const &  ,
ldbl  
)
template<class T >
std::enable_if_t< std::is_floating_point_v< T > > fhicl::detail::decode ( std::any const &  a,
T result 
)

Definition at line 233 of file coding.h.

References decode().

234 {
235  ldbl via;
236  decode(a, via);
237  result = via; // boost::numeric_cast<T>(via);
238 }
long double ldbl
Definition: coding.h:46
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
const double a
void fhicl::detail::decode ( std::any const &  ,
std::complex< ldbl > &   
)
template<class T >
void fhicl::detail::decode ( std::any const &  a,
std::complex< T > &  result 
)

Definition at line 244 of file coding.h.

References decode(), and T.

245 {
246  std::complex<ldbl> via;
247  decode(a, via);
248  result = std::complex<T>(boost::numeric_cast<T>(via.real()),
249  boost::numeric_cast<T>(via.imag()));
250 }
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
const double a
double T
Definition: Xdiff_gwt.C:5
template<class T >
void fhicl::detail::decode ( std::any const &  a,
std::vector< T > &  result 
)

Definition at line 256 of file coding.h.

References a, decode(), e, fhicl::extended_value::is_a(), fhicl::parse_value_string(), fhicl::SEQUENCE, submit_syst::str, string, T, and fhicl::type_mismatch.

257 {
258  if (a.type() == typeid(std::string)) {
259  typedef fhicl::extended_value extended_value;
260  typedef extended_value::sequence_t sequence_t;
261 
263  decode(a, str);
264 
265  extended_value xval;
266  std::string unparsed;
267  if (!parse_value_string(str, xval, unparsed) || !xval.is_a(SEQUENCE))
268  throw fhicl::exception(type_mismatch, "error in sequence string:\n")
269  << str << "\nat or before:\n"
270  << unparsed;
271 
272  sequence_t const& seq = sequence_t(xval);
273  result.clear();
274  T via;
275  for (auto const& e : seq) {
276  decode(e.to_string(), via);
277  result.push_back(via);
278  }
279  }
280 
281  else if (a.type() == typeid(ps_sequence_t)) {
282  ps_sequence_t const& seq = std::any_cast<ps_sequence_t>(a);
283  result.clear();
284  T via;
285  for (auto const& e : seq) {
286  decode(e, via);
287  result.push_back(via);
288  }
289  }
290 
291  else
292  throw fhicl::exception(type_mismatch, "invalid sequence");
293 }
bool parse_value_string(std::string const &s, extended_value &v, std::string &unparsed)
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
std::vector< std::any > ps_sequence_t
Definition: coding.h:45
const double a
double T
Definition: Xdiff_gwt.C:5
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
enum BeamMode string
template<typename T , std::size_t SIZE>
void fhicl::detail::decode ( std::any const &  a,
std::array< T, SIZE > &  result 
)

Definition at line 124 of file coding.h.

References decode_tuple().

125  {
127  }
void decode_tuple(std::any const &, U &tuple)
Definition: coding.h:324
const double a
template<typename KEY , typename VALUE >
void fhicl::detail::decode ( std::any const &  a,
std::pair< KEY, VALUE > &  result 
)

Definition at line 130 of file coding.h.

References decode_tuple().

131  {
133  }
void decode_tuple(std::any const &, U &tuple)
Definition: coding.h:324
const double a
template<typename... ARGS>
void fhicl::detail::decode ( std::any const &  a,
std::tuple< ARGS... > &  result 
)

Definition at line 136 of file coding.h.

References decode_tuple().

137  {
139  }
void decode_tuple(std::any const &, U &tuple)
Definition: coding.h:324
const double a
template<class T >
tt::disable_if_t< tt::is_numeric< T >::value > fhicl::detail::decode ( std::any const &  a,
T result 
)

Definition at line 353 of file coding.h.

References a, and T.

354 {
355  result = std::any_cast<T>(a);
356 }
const double a
double T
Definition: Xdiff_gwt.C:5
template<typename U >
void fhicl::detail::decode_tuple ( std::any const &  a,
U &  tuple 
)

Definition at line 324 of file coding.h.

References a, decode(), fhicl::detail::per_entry< SIZE, TUPLE >::decode_tuple_entry(), string, and tmp.

Referenced by decode(), and is_table().

325 {
326  auto const seq = std::any_cast<ps_sequence_t>(a);
327 
328  constexpr std::size_t TUPLE_SIZE = std::tuple_size_v<U>;
329 
330  if (seq.size() != TUPLE_SIZE) {
331  std::ostringstream errmsg;
332  errmsg << "Number of expected arguments (" << TUPLE_SIZE
333  << ") does not match "
334  << "number of FHiCL sequence entries (" << seq.size() << "): [ ";
335  for (auto ca = seq.begin(); ca != seq.cend(); ++ca) {
337  decode(*ca, tmp);
338  errmsg << tmp;
339  if (ca != seq.cend() - 1) {
340  errmsg << ", ";
341  }
342  }
343  errmsg << " ]";
344  throw std::length_error(errmsg.str());
345  }
346 
347  per_entry<TUPLE_SIZE - 1, U>::decode_tuple_entry(seq, result);
348 }
Float_t tmp
Definition: plot.C:36
tt::disable_if_t< tt::is_numeric< T >::value > decode(std::any const &, T &)
Definition: coding.h:353
std::vector< std::any > ps_sequence_t
Definition: coding.h:45
const double a
enum BeamMode string
std::any fhicl::detail::encode ( extended_value const &  xval)
ps_atom_t fhicl::detail::encode ( std::string const &  )
ps_atom_t fhicl::detail::encode ( char const *  )
ps_atom_t fhicl::detail::encode ( void )
ps_atom_t fhicl::detail::encode ( bool  )
ParameterSetID fhicl::detail::encode ( ParameterSet const &  )
ps_atom_t fhicl::detail::encode ( std::uintmax_t  )
template<class T >
std::enable_if_t<tt::is_uint<T>::value, ps_atom_t> fhicl::detail::encode ( T const &  )
ps_atom_t fhicl::detail::encode ( std::intmax_t  )
template<class T >
std::enable_if_t<tt::is_int<T>::value, ps_atom_t> fhicl::detail::encode ( T const &  )
ps_atom_t fhicl::detail::encode ( ldbl  )
template<class T >
std::enable_if_t<std::is_floating_point_v<T>, ps_atom_t> fhicl::detail::encode ( T const &  )
template<class T >
ps_atom_t fhicl::detail::encode ( std::complex< T > const &  )
template<class T >
ps_sequence_t fhicl::detail::encode ( std::vector< T > const &  )
template<class T >
tt::disable_if_t< tt::is_numeric< T >::value, std::string > fhicl::detail::encode ( T const &  value)

Definition at line 200 of file coding.h.

References string.

201 {
202  return boost::lexical_cast<std::string>(value);
203 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
enum BeamMode string
template<typename T >
std::set<std::string> fhicl::detail::ensure_callable ( )

Definition at line 15 of file KeysToIgnore.h.

References T.

16  {
17  static_assert(tt::is_callable<T>::value);
18  return T{}();
19  }
double T
Definition: Xdiff_gwt.C:5
bool fhicl::detail::find_an_any ( cit_size_t  it,
cit_size_t const  cend,
std::any &  a 
)
inline

Definition at line 74 of file ParameterSetImplHelpers.h.

References a, and it.

Referenced by fhicl::ParameterSet::get_one_().

75  {
76  if (it == cend) {
77  // If we got this far, that means the element must exist,
78  // otherwise the previous recursive 'find_parameter' call would
79  // have returned false.
80  return true;
81  }
82 
83  auto const seq = std::any_cast<ps_sequence_t>(a);
84 
85  if (*it >= seq.size())
86  return false;
87 
88  a = seq[*it];
89 
90  return find_an_any(++it, cend, a);
91  }
set< int >::iterator it
bool find_an_any(cit_size_t it, cit_size_t const cend, std::any &a)
std::vector< std::any > ps_sequence_t
Definition: coding.h:45
const double a
Keys fhicl::detail::get_names ( std::string const &  key)
SequenceKey fhicl::detail::get_sequence_indices ( std::string const &  key)
std::size_t fhicl::detail::index_for_sequence_element ( std::string const &  name)

Referenced by is_table_member().

bool fhicl::detail::is_nil ( std::any const &  val)

Referenced by is_table().

bool fhicl::detail::is_sequence ( std::any const &  val)
inline

Definition at line 49 of file coding.h.

Referenced by fhicl::ParameterSet::is_key_to_atom(), fhicl::ParameterSet::is_key_to_sequence(), and fhicl::detail::ParameterWalker< C >::walk_over().

50  {
51  return val.type() == typeid(ps_sequence_t);
52  }
std::vector< std::any > ps_sequence_t
Definition: coding.h:45
bool fhicl::detail::is_sequence_element ( std::string const &  key)
inline

Definition at line 67 of file printing_helpers.h.

References fhicl::detail::sequence::closing_brace(), and elec2geo::pos.

Referenced by is_table_member().

68  {
69  auto pos = key.find_last_of(sequence::closing_brace());
70  return pos != std::string::npos && pos == key.size() - 1;
71  }
bool fhicl::detail::is_table ( std::any const &  val)
inline
bool fhicl::detail::is_table_member ( std::string const &  key)
inline

Definition at line 74 of file printing_helpers.h.

References index_for_sequence_element(), is_sequence_element(), and string.

Referenced by fhicl::detail::RegisterIfTableMember::RegisterIfTableMember().

75  {
76  auto pos1 = key.find_last_of(".");
77  if (pos1 == std::string::npos)
78  return false;
79 
80  return is_sequence_element(key) ? false : true;
81  }
bool is_sequence_element(std::string const &key)
std::string fhicl::detail::nl ( std::size_t  i = 1)
inline
std::string fhicl::detail::optional_parameter_message ( bool const  with_comment = true)
inline

Definition at line 7 of file optional_parameter_message.h.

References fillBadChanDBTables::result, and string.

Referenced by fhicl::OptionalTable< T >::print_allowed_configuration(), and fhicl::Table< T, KeysToIgnore >::print_allowed_configuration().

8  {
10  if (with_comment) {
11  result += "## ";
12  }
13  result += "Any parameters prefaced with '#' are optional.";
14  return result;
15  }
enum BeamMode string
std::string fhicl::detail::print_annotated_info ( std::string const &  curr_info,
std::string const &  cached_info 
)

Referenced by nl().

std::string fhicl::detail::print_prefix_annotated_info ( std::string const &  curr_info)

Referenced by nl().

std::string fhicl::detail::printed_suffix ( std::string const &  key,
std::size_t const  sz 
)

Referenced by nl().

std::string fhicl::detail::strip_all_containing_names ( std::string const &  key)
std::string fhicl::detail::strip_first_containing_name ( std::string const &  key)
void fhicl::detail::throwOnSQLiteFailure ( int  rc,
char *  msg = nullptr 
)
void fhicl::detail::throwOnSQLiteFailure ( sqlite3 *  db,
char *  msg = nullptr 
)
std::string fhicl::detail::translate ( error  )
template<typename L >
void fhicl::detail::try_insert ( l,
std::string const &  key 
)

Definition at line 13 of file try_blocks.h.

References fhicl::cant_insert, e, findDuplicateFiles::key, and submit_hadd::l.

Referenced by fhicl::ParameterSet::put(), fhicl::ParameterSet::put_or_replace(), and fhicl::ParameterSet::put_or_replace_compatible().

13  {
14  l(key);
15  }
16  catch (boost::bad_lexical_cast const& e) {
17  throw fhicl::exception(cant_insert, key) << e.what();
18  }
19  catch (boost::bad_numeric_cast const& e) {
20  throw fhicl::exception(cant_insert, key) << e.what();
21  }
22  catch (fhicl::exception const& e) {
23  throw fhicl::exception(cant_insert, key, e);
24  }
25  catch (std::exception const& e) {
26  throw fhicl::exception(cant_insert, key) << e.what();
27  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33