LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DelegatedParameter.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_DelegatedParameter_h
2 #define fhiclcpp_types_DelegatedParameter_h
3 
6 #include "fhiclcpp/types/Name.h"
11 
12 namespace fhicl {
13 
14  //========================================================
17  public:
18  explicit DelegatedParameter(Name&& name);
20  explicit DelegatedParameter(Name&& name,
21  Comment&& comment,
22  std::function<bool()> maybeUse);
23 
24  // A DelegatedParameter object must be present. Therefore, it is
25  // safe and correct to call 'pset.get' with no default.
26  template <typename T>
27  auto
28  get() const
29  {
30  auto const trimmed_key = detail::strip_first_containing_name(key());
31  return pset_.get<T>(trimmed_key);
32  }
33 
34  private:
35  void
36  do_set_value(fhicl::ParameterSet const& pset) override
37  {
38  pset_ = pset;
39  };
40 
42  };
43 }
44 
45 #endif /* fhiclcpp_types_DelegatedParameter_h */
46 
47 // Local variables:
48 // mode: c++
49 // End:
std::string strip_first_containing_name(std::string const &key)
parameter set interface
T get(std::string const &key) const
Definition: ParameterSet.h:314
std::string const & name() const
std::string const & key() const
Definition: ParameterBase.cc:6
void do_set_value(fhicl::ParameterSet const &pset) override
std::string const & comment() const
fhicl::ParameterSet pset_