Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
fhicl::Atom< T > Class Template Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/fhiclcpp/v4_11_01/source/fhiclcpp/type_traits.h"

Inheritance diagram for fhicl::Atom< T >:
fhicl::detail::AtomBase fhicl::detail::RegisterIfTableMember fhicl::detail::ParameterBase

Public Types

using default_type = T
 
using value_type = T
 

Public Member Functions

 Atom (Name &&name)
 
 Atom (Name &&name, Comment &&comment)
 
 Atom (Name &&name, Comment &&comment, std::function< bool()> useIf)
 
 Atom (Name &&name, T const &dflt_value)
 
 Atom (Name &&name, Comment &&comment, T const &dflt_value)
 
 Atom (Name &&name, Comment &&comment, std::function< bool()> useIf, T const &dflt_value)
 
auto const & operator() () const
 
std::string stringified_value () const
 
std::string const & key () const
 
std::string const & name () const
 
std::string const & comment () const
 
bool has_default () const
 
bool is_optional () const
 
bool is_conditional () const
 
par_type parameter_type () const
 
bool should_use () const
 
void set_value (fhicl::ParameterSet const &ps, bool trimParents)
 
void set_par_style (par_style const vt)
 

Private Member Functions

std::string get_stringified_value () const override
 
void do_set_value (fhicl::ParameterSet const &, bool const) override
 

Private Attributes

std::shared_ptr< Tvalue_
 

Detailed Description

template<typename T>
class fhicl::Atom< T >

Definition at line 25 of file type_traits.h.

Member Typedef Documentation

template<typename T>
using fhicl::Atom< T >::default_type = T

Definition at line 55 of file Atom.h.

template<typename T>
using fhicl::Atom< T >::value_type = T

Definition at line 56 of file Atom.h.

Constructor & Destructor Documentation

template<typename T >
fhicl::Atom< T >::Atom ( Name &&  name)
explicit

Definition at line 124 of file Atom.h.

124  : Atom{std::move(name), Comment("")}
125  {}
const XML_Char * name
Definition: expat.h:151
Atom(Name &&name)
Definition: Atom.h:124
template<typename T >
fhicl::Atom< T >::Atom ( Name &&  name,
Comment &&  comment 
)
explicit

Definition at line 73 of file Atom.h.

References fhicl::detail::AlwaysUse(), fhicl::detail::ParameterBase::comment(), fhicl::NameStackRegistry::end_of_ctor(), fhicl::detail::RegisterIfTableMember::RegisterIfTableMember(), fhicl::REQUIRED, and fhicl::Atom< T >::value_.

74  : AtomBase{std::move(name),
75  std::move(comment),
78  , RegisterIfTableMember{this}
79  , value_{std::make_shared<T>()}
80  {
82  }
const XML_Char * name
Definition: expat.h:151
AtomBase(Name const &name, Comment const &comment, par_style const vt, std::function< bool()> maybeUse)
Definition: AtomBase.h:16
std::shared_ptr< T > value_
Definition: Atom.h:59
std::function< bool()> AlwaysUse()
std::string const & comment() const
Definition: ParameterBase.h:54
template<typename T >
fhicl::Atom< T >::Atom ( Name &&  name,
Comment &&  comment,
std::function< bool()>  useIf 
)
explicit

Definition at line 85 of file Atom.h.

References fhicl::detail::ParameterBase::comment(), fhicl::NameStackRegistry::end_of_ctor(), fhicl::detail::RegisterIfTableMember::RegisterIfTableMember(), fhicl::REQUIRED_CONDITIONAL, and fhicl::Atom< T >::value_.

86  : AtomBase{std::move(name),
87  std::move(comment),
89  maybeUse}
90  , RegisterIfTableMember{this}
91  , value_{std::make_shared<T>()}
92  {
94  }
const XML_Char * name
Definition: expat.h:151
AtomBase(Name const &name, Comment const &comment, par_style const vt, std::function< bool()> maybeUse)
Definition: AtomBase.h:16
std::shared_ptr< T > value_
Definition: Atom.h:59
std::string const & comment() const
Definition: ParameterBase.h:54
template<typename T>
fhicl::Atom< T >::Atom ( Name &&  name,
T const &  dflt_value 
)
explicit

Definition at line 128 of file Atom.h.

References string.

129  : Atom{std::move(name), Comment(""), dflt_value}
130  {}
const XML_Char * name
Definition: expat.h:151
Atom(Name &&name)
Definition: Atom.h:124
template<typename T>
fhicl::Atom< T >::Atom ( Name &&  name,
Comment &&  comment,
T const &  dflt_value 
)
explicit

Definition at line 97 of file Atom.h.

References fhicl::detail::AlwaysUse(), fhicl::detail::ParameterBase::comment(), fhicl::DEFAULT, fhicl::NameStackRegistry::end_of_ctor(), fhicl::detail::RegisterIfTableMember::RegisterIfTableMember(), and fhicl::Atom< T >::value_.

98  : AtomBase{std::move(name),
99  std::move(comment),
102  , RegisterIfTableMember{this}
103  , value_{std::make_shared<T>(dflt_value)}
104  {
106  }
const XML_Char * name
Definition: expat.h:151
AtomBase(Name const &name, Comment const &comment, par_style const vt, std::function< bool()> maybeUse)
Definition: AtomBase.h:16
std::shared_ptr< T > value_
Definition: Atom.h:59
std::function< bool()> AlwaysUse()
std::string const & comment() const
Definition: ParameterBase.h:54
template<typename T>
fhicl::Atom< T >::Atom ( Name &&  name,
Comment &&  comment,
std::function< bool()>  useIf,
T const &  dflt_value 
)
explicit

Definition at line 109 of file Atom.h.

References fhicl::detail::ParameterBase::comment(), fhicl::DEFAULT_CONDITIONAL, fhicl::NameStackRegistry::end_of_ctor(), fhicl::detail::RegisterIfTableMember::RegisterIfTableMember(), and fhicl::Atom< T >::value_.

113  : AtomBase{std::move(name),
114  std::move(comment),
116  maybeUse}
117  , RegisterIfTableMember{this}
118  , value_{std::make_shared<T>(dflt_value)}
119  {
121  }
const XML_Char * name
Definition: expat.h:151
AtomBase(Name const &name, Comment const &comment, par_style const vt, std::function< bool()> maybeUse)
Definition: AtomBase.h:16
std::shared_ptr< T > value_
Definition: Atom.h:59
std::string const & comment() const
Definition: ParameterBase.h:54

Member Function Documentation

std::string const& fhicl::detail::ParameterBase::comment ( ) const
inlineinherited
template<typename T >
void fhicl::Atom< T >::do_set_value ( fhicl::ParameterSet const &  pset,
bool const  trimParent 
)
overrideprivatevirtual

Implements fhicl::detail::ParameterBase.

Definition at line 149 of file Atom.h.

References fhicl::ParameterSet::get(), fhicl::ParameterSet::get_if_present(), fhicl::detail::ParameterBase::has_default(), fhicl::detail::ParameterBase::key(), string, fhicl::detail::strip_first_containing_name(), T, and fhicl::Atom< T >::value_.

150  {
151  std::string const& rkey = key();
152  std::string const& key =
153  trimParent ? detail::strip_first_containing_name(rkey) : rkey;
154 
155  if (has_default())
156  pset.get_if_present<T>(key, *value_);
157  else
158  value_ = std::make_shared<T>(pset.get<T>(key));
159  }
std::shared_ptr< T > value_
Definition: Atom.h:59
std::string strip_first_containing_name(std::string const &key)
std::string const & key() const
Definition: ParameterBase.h:44
double T
Definition: Xdiff_gwt.C:5
enum BeamMode string
template<typename T >
std::string fhicl::Atom< T >::get_stringified_value ( ) const
overrideprivatevirtual

Implements fhicl::detail::AtomBase.

Definition at line 134 of file Atom.h.

References fhicl::detail::ParameterBase::has_default().

135  {
136  std::stringstream oss;
137  if (has_default()) {
138  using namespace detail::yes_defaults;
139  oss << maybe_quotes<T>(*value_);
140  } else {
141  using namespace detail::no_defaults;
142  oss << expected_types<T>();
143  }
144  return oss.str();
145  }
bool fhicl::detail::ParameterBase::has_default ( ) const
inlineinherited
bool fhicl::detail::ParameterBase::is_conditional ( ) const
inlineinherited
bool fhicl::detail::ParameterBase::is_optional ( ) const
inlineinherited
std::string const& fhicl::detail::ParameterBase::key ( ) const
inlineinherited
std::string const& fhicl::detail::ParameterBase::name ( ) const
inlineinherited
template<typename T>
auto const& fhicl::Atom< T >::operator() ( void  ) const
inline

Definition at line 49 of file Atom.h.

50  {
51  return *value_;
52  }
std::shared_ptr< T > value_
Definition: Atom.h:59
par_type fhicl::detail::ParameterBase::parameter_type ( ) const
inlineinherited
void fhicl::detail::ParameterBase::set_par_style ( par_style const  vt)
inlineinherited
void fhicl::detail::ParameterBase::set_value ( fhicl::ParameterSet const &  ps,
bool  trimParents 
)
inlineinherited

Definition at line 96 of file ParameterBase.h.

References fhicl::detail::ParameterBase::do_set_value().

97  {
98  do_set_value(ps, trimParents);
99  }
virtual void do_set_value(fhicl::ParameterSet const &, bool trimParents)=0
bool fhicl::detail::ParameterBase::should_use ( ) const
inlineinherited

Definition at line 79 of file ParameterBase.h.

References fhicl::detail::ParameterBase::maybeUse_.

80  {
81  return maybeUse_();
82  }
std::function< bool()> maybeUse_
std::string fhicl::detail::AtomBase::stringified_value ( ) const
inlineinherited

Definition at line 24 of file AtomBase.h.

References fhicl::detail::AtomBase::get_stringified_value(), and string.

25  {
26  return get_stringified_value();
27  }
virtual std::string get_stringified_value() const =0

Member Data Documentation

template<typename T>
std::shared_ptr<T> fhicl::Atom< T >::value_
private

The documentation for this class was generated from the following files: