LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
Atom.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_Atom_h
2 #define fhiclcpp_types_Atom_h
3 
5 #include "fhiclcpp/type_traits.h"
8 #include "fhiclcpp/types/Name.h"
15 
16 #include <memory>
17 #include <sstream>
18 #include <string>
19 
20 namespace fhicl {
21 
22  //========================================================
23  template <typename T>
24  class Atom final : public detail::AtomBase,
25  private detail::RegisterIfTableMember {
26  public:
32 
33  //=====================================================
34  // User-friendly
35  // ... c'tors
36  explicit Atom(Name&& name);
37  explicit Atom(Name&& name, Comment&& comment);
38  explicit Atom(Name&& name, Comment&& comment, std::function<bool()> useIf);
39 
40  // ... c'tors supporting defaults
41  explicit Atom(Name&& name, T const& dflt_value);
42  explicit Atom(Name&& name, Comment&& comment, T const& dflt_value);
43  explicit Atom(Name&& name,
44  Comment&& comment,
45  std::function<bool()> useIf,
46  T const& dflt_value);
47 
48  // ... Accessors
49  auto const&
50  operator()() const
51  {
52  return *value_;
53  }
54 
55  // Expert-only
56  using default_type = T;
57  using value_type = T;
58 
59  private:
60  std::shared_ptr<T> value_;
61 
62  std::string get_stringified_value() const override;
63  void do_set_value(fhicl::ParameterSet const&, bool const) override;
64  };
65 }
66 
68 
69 #endif /* fhiclcpp_types_Atom_h */
70 
71 // Local variables:
72 // mode: c++
73 // End:
auto const & operator()() const
Definition: Atom.h:50
std::string get_stringified_value() const override
#define NO_DELEGATED_PARAMETERS
std::shared_ptr< T > value_
Definition: Atom.h:60
parameter set interface
#define NO_STD_CONTAINERS
Atom(Name &&name)
std::int64_t value_type
Definition: Atom.h:57
#define NO_NESTED_TABLE_FRAGMENTS
std::string name() const
Definition: ParameterBase.h:49
void do_set_value(fhicl::ParameterSet const &, bool const) override
#define NO_NESTED_FHICL_TYPES_IN_ATOM
std::int64_t default_type
Definition: Atom.h:56
std::string comment() const
Definition: ParameterBase.h:54