Classes | |
struct | SequenceWrapper |
Helper to return a converted sequence from FHiCL configuration. More... | |
Functions | |
template<typename Optional > | |
std::optional< typename Optional::value_type > | getOptionalValue (Optional const ¶meter) |
Returns the value of an optional parameter as std::optional . More... | |
template<typename T , typename Optional > | |
T | getOptionalValue (Optional const ¶meter, T defValue) |
Returns the value of an optional parameter, or a default value. More... | |
std::optional< typename Optional::value_type > util::fhicl::getOptionalValue | ( | Optional const & | parameter | ) |
Returns the value of an optional parameter as std::optional
.
Optional | FHiCL optional class (e.g. fhicl::OptionalAtom ) |
parameter | the optional FHiCL parameter |
This utility allows to carry the information whether an optional parameter was specified or not. It may also help with single-line initialization of data members from FHiCL optional parameters, e.g.
This feature will be rendered obsolete by Redmine Issue #23653.
Definition at line 188 of file FHiCLutils.h.
T util::fhicl::getOptionalValue | ( | Optional const & | parameter, |
T | defValue | ||
) |
Returns the value of an optional parameter, or a default value.
T | type of the value being returned |
Optional | FHiCL optional class (e.g. fhicl::OptionalAtom ) |
parameter | the optional FHiCL parameter |
defValue | default value to be returned |
defValue
if absentIt is usually preferable to use a non-optional FHiCL parameter with a default value, but some types are not well suited for this. Also, this function does not buy much unless the parameter reading needs to be done in a single statement, like in the initialization list of a constructor:
Definition at line 203 of file FHiCLutils.h.