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

Namespaces

 atom
 
 no_defaults
 
 sequence
 
 table
 
 yes_defaults
 

Classes

struct  AllowedConfiguration
 
struct  AllowedConfiguration< T, cet::enable_if_type_exists_t< typename T::Parameters > >
 
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
 

Typedefs

typedef std::string ps_atom_t
 
typedef std::vector< boost::any > ps_sequence_t
 
typedef long double ldbl
 
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 (boost::any const &val)
 
bool is_table (boost::any const &val)
 
bool is_nil (boost::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 >
tt::enable_if< tt::is_uint< T >::value, ps_atom_t >::type encode (T const &)
 
ps_atom_t encode (std::intmax_t)
 
template<class T >
tt::enable_if< tt::is_int< T >::value, ps_atom_t >::type encode (T const &)
 
ps_atom_t encode (ldbl)
 
template<class T >
tt::enable_if< tt::is_floating_point< T >::value, ps_atom_t >::type encode (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< tt::is_numeric< T >::value, std::string >::type encode (T const &)
 
void decode (boost::any const &, std::string &)
 
void decode (boost::any const &, void *&)
 
void decode (boost::any const &, bool &)
 
void decode (boost::any const &, ParameterSet &)
 
void decode (boost::any const &, std::uintmax_t &)
 
template<class T >
tt::enable_if< tt::is_uint< T >::value, void >::type decode (boost::any const &, T &)
 
void decode (boost::any const &, std::intmax_t &)
 
template<class T >
tt::enable_if< tt::is_int< T >::value, void >::type decode (boost::any const &, T &)
 
void decode (boost::any const &, ldbl &)
 
template<class T >
tt::enable_if< tt::is_floating_point< T >::value, void >::type decode (boost::any const &, T &)
 
void decode (boost::any const &, std::complex< ldbl > &)
 
template<class T >
void decode (boost::any const &, std::complex< T > &)
 
template<class T >
void decode (boost::any const &, std::vector< T > &)
 
template<typename U >
void decode_tuple (boost::any const &, U &tuple)
 
template<typename T , std::size_t SIZE>
void decode (boost::any const &a, std::array< T, SIZE > &result)
 
template<typename KEY , typename VALUE >
void decode (boost::any const &a, std::pair< KEY, VALUE > &result)
 
template<typename... ARGS>
void decode (boost::any const &a, std::tuple< ARGS... > &result)
 
template<class T >
tt::disable_if< tt::is_numeric< T >::value, void >::type decode (boost::any const &, T &)
 
boost::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, boost::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)
 
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 17 of file MaybeDisplayParent.h.

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

Definition at line 108 of file ParameterSetImplHelpers.h.

Definition at line 71 of file KeyAssembler.h.

typedef long double fhicl::detail::ldbl

Definition at line 47 of file coding.h.

Definition at line 72 of file KeyAssembler.h.

Definition at line 45 of file coding.h.

typedef std::vector<boost::any> fhicl::detail::ps_sequence_t

Definition at line 46 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

Definition at line 10 of file ConfigPredicate.h.

Referenced by fhicl::OptionalTuple< TYPES >::OptionalTuple(), and fhicl::Tuple< TYPES >::Tuple().

11  {
12  return []() { return true; };
13  }
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 23 of file KeysToIgnore.h.

References caf_analysis::keys, and T.

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

24  {
25  return keys;
26  }
keys
Reco plots.
Definition: caf_analysis.py:46
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 30 of file KeysToIgnore.h.

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

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

Definition at line 222 of file coding.h.

References decode(), and T.

223 {
224  std::uintmax_t via;
225  decode(a, via);
226  result = boost::numeric_cast<T>(via);
227 }
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
const double a
double T
Definition: Xdiff_gwt.C:5
void fhicl::detail::decode ( boost::any const &  ,
std::intmax_t &   
)
template<class T >
tt::enable_if< tt::is_int< T >::value, void >::type fhicl::detail::decode ( boost::any const &  a,
T result 
)

Definition at line 233 of file coding.h.

References decode(), and T.

234 {
235  std::intmax_t via;
236  decode(a, via);
237  result = boost::numeric_cast<T>(via);
238 }
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
const double a
double T
Definition: Xdiff_gwt.C:5
void fhicl::detail::decode ( boost::any const &  ,
ldbl  
)
template<class T >
tt::enable_if< tt::is_floating_point< T >::value, void >::type fhicl::detail::decode ( boost::any const &  a,
T result 
)

Definition at line 244 of file coding.h.

References decode().

245 {
246  ldbl via;
247  decode(a, via);
248  result = via; // boost::numeric_cast<T>(via);
249 }
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
const double a
long double ldbl
Definition: coding.h:47
void fhicl::detail::decode ( boost::any const &  ,
std::complex< ldbl > &   
)
template<class T >
void fhicl::detail::decode ( boost::any const &  a,
std::complex< T > &  result 
)

Definition at line 255 of file coding.h.

References decode(), and T.

256 {
257  std::complex<ldbl> via;
258  decode(a, via);
259  result = std::complex<T>(boost::numeric_cast<T>(via.real()),
260  boost::numeric_cast<T>(via.imag()));
261 }
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
const double a
double T
Definition: Xdiff_gwt.C:5
template<class T >
void fhicl::detail::decode ( boost::any const &  a,
std::vector< T > &  result 
)

Definition at line 267 of file coding.h.

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

268 {
269  if (a.type() == typeid(std::string)) {
270  typedef fhicl::extended_value extended_value;
271  typedef extended_value::sequence_t sequence_t;
272 
274  decode(a, str);
275 
276  extended_value xval;
277  std::string unparsed;
278  if (!parse_value_string(str, xval, unparsed) || !xval.is_a(SEQUENCE))
279  throw fhicl::exception(type_mismatch, "error in sequence string:\n")
280  << str << "\nat or before:\n"
281  << unparsed;
282 
283  sequence_t const& seq = sequence_t(xval);
284  result.clear();
285  T via;
286  for (sequence_t::const_iterator it = seq.begin(), e = seq.end(); it != e;
287  ++it) {
288  decode(it->to_string(), via);
289  result.push_back(via);
290  }
291  }
292 
293  else if (a.type() == typeid(ps_sequence_t)) {
294  ps_sequence_t const& seq = boost::any_cast<ps_sequence_t>(a);
295  result.clear();
296  T via;
297  for (ps_sequence_t::const_iterator it = seq.begin(), e = seq.end(); it != e;
298  ++it) {
299  decode(*it, via);
300  result.push_back(via);
301  }
302  }
303 
304  else
305  throw fhicl::exception(type_mismatch, "invalid sequence");
306 }
bool parse_value_string(std::string const &s, extended_value &v, std::string &unparsed)
set< int >::iterator it
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
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
std::vector< boost::any > ps_sequence_t
Definition: coding.h:46
enum BeamMode string
template<typename T , std::size_t SIZE>
void fhicl::detail::decode ( boost::any const &  a,
std::array< T, SIZE > &  result 
)

Definition at line 129 of file coding.h.

References decode_tuple().

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

Definition at line 135 of file coding.h.

References decode_tuple().

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

Definition at line 141 of file coding.h.

References decode_tuple().

142  {
144  }
const double a
void decode_tuple(boost::any const &, U &tuple)
Definition: coding.h:337
template<class T >
tt::disable_if< tt::is_numeric< T >::value, void >::type fhicl::detail::decode ( boost::any const &  a,
T result 
)

Definition at line 366 of file coding.h.

References a, and T.

367 {
368  result = boost::any_cast<T>(a);
369 }
const double a
double T
Definition: Xdiff_gwt.C:5
template<typename U >
void fhicl::detail::decode_tuple ( boost::any const &  a,
U &  tuple 
)

Definition at line 337 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().

338 {
339  ps_sequence_t const& seq = boost::any_cast<ps_sequence_t>(a);
340 
341  constexpr std::size_t TUPLE_SIZE = std::tuple_size<U>::value;
342 
343  if (seq.size() != TUPLE_SIZE) {
344  std::ostringstream errmsg;
345  errmsg << "Number of expected arguments (" << TUPLE_SIZE
346  << ") does not match "
347  << "number of FHiCL sequence entries (" << seq.size() << "): [ ";
348  for (auto ca = seq.begin(); ca != seq.cend(); ++ca) {
350  decode(*ca, tmp);
351  errmsg << tmp;
352  if (ca != seq.cend() - 1) {
353  errmsg << ", ";
354  }
355  }
356  errmsg << " ]";
357  throw std::length_error(errmsg.str());
358  }
359 
360  per_entry<TUPLE_SIZE - 1, U>::decode_tuple_entry(seq, result);
361 }
Float_t tmp
Definition: plot.C:36
tt::disable_if< tt::is_numeric< T >::value, void >::type decode(boost::any const &, T &)
Definition: coding.h:366
const XML_Char int const XML_Char * value
Definition: expat.h:331
const double a
std::vector< boost::any > ps_sequence_t
Definition: coding.h:46
enum BeamMode string
boost::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 >
tt::enable_if<tt::is_uint<T>::value, ps_atom_t>::type fhicl::detail::encode ( T const &  )
ps_atom_t fhicl::detail::encode ( std::intmax_t  )
template<class T >
tt::enable_if<tt::is_int<T>::value, ps_atom_t>::type fhicl::detail::encode ( T const &  )
ps_atom_t fhicl::detail::encode ( ldbl  )
template<class T >
tt::enable_if<tt::is_floating_point<T>::value, ps_atom_t>::type 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< tt::is_numeric< T >::value, std::string >::type fhicl::detail::encode ( T const &  value)

Definition at line 211 of file coding.h.

References string.

212 {
213  return boost::lexical_cast<std::string>(value);
214 }
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 16 of file KeysToIgnore.h.

References T, and TEMPLATE_ARG.

17  {
19  return T{}();
20  }
#define TEMPLATE_ARG
Definition: KeysToIgnore.h:9
double T
Definition: Xdiff_gwt.C:5
bool fhicl::detail::find_an_any ( cit_size_t  it,
cit_size_t const  cend,
boost::any &  a 
)
inline

Definition at line 111 of file ParameterSetImplHelpers.h.

References a, and it.

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

112  {
113  if (it == cend) {
114  // If we got this far, that means the element must exist,
115  // otherwise the previous recursive 'find_parameter' call would
116  // have returned false.
117  return true;
118  }
119 
120  auto const seq = boost::any_cast<ps_sequence_t>(a);
121 
122  if (*it >= seq.size())
123  return false;
124 
125  a = seq[*it];
126 
127  return find_an_any(++it, cend, a);
128  }
set< int >::iterator it
const double a
std::vector< boost::any > ps_sequence_t
Definition: coding.h:46
bool find_an_any(cit_size_t it, cit_size_t const cend, boost::any &a)
Keys fhicl::detail::get_names ( std::string const &  key)
inline

Definition at line 42 of file ParameterSetImplHelpers.h.

References fhicl::cant_find, caf_analysis::keys, fhicl::detail::Keys::last(), split(), and string.

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

43  {
44  std::vector<std::string> keys;
45  boost::algorithm::split(keys, key, boost::algorithm::is_any_of("."));
46 
47  // Remove empty keys
48  keys.erase(std::remove(keys.begin(), keys.end(), ""), keys.end());
49 
50  if (keys.empty())
51  throw fhicl::exception(cant_find, "vacuous key");
52 
53  std::string const last = keys.back();
54  keys.pop_back();
55 
56  return Keys{keys, last};
57  }
void split(double tt, double *fr)
keys
Reco plots.
Definition: caf_analysis.py:46
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
enum BeamMode string
SequenceKey fhicl::detail::get_sequence_indices ( std::string const &  key)
inline

Definition at line 86 of file ParameterSetImplHelpers.h.

References allTimeWatchdog::index, cet::split_by_regex(), string, parsePQSLOutput::tokens, and cet::transform_all().

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

87  {
88 
89  // Split "name[0][5][1]" according to delimiters "][", "[", and "]"
90  // to give {"name","0","5","1"};
91  auto tokens = cet::split_by_regex(key, R"((\]\[|\[|\]))");
92 
93  auto const name = tokens.front();
94  tokens.erase(tokens.begin());
95 
96  std::vector<std::size_t> indices;
98  tokens, std::back_inserter(indices), [](std::string const& index) {
99  return std::stoul(index);
100  });
101 
102  return SequenceKey{name, indices};
103  }
const XML_Char * name
Definition: expat.h:151
std::vector< std::string > split_by_regex(std::string const &str, std::string const &delimSet)
auto transform_all(Container &, OutputIt, UnaryOp)
enum BeamMode string
bool fhicl::detail::is_nil ( boost::any const &  val)

Referenced by is_table().

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

Definition at line 50 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().

51  {
52  return val.type() == typeid(ps_sequence_t);
53  }
std::vector< boost::any > ps_sequence_t
Definition: coding.h:46
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 ( boost::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 is_sequence_element().

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.

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