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

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

Inheritance diagram for fhicl::OptionalSequence< T, N >:
fhicl::detail::SequenceBase fhicl::detail::RegisterIfTableMember fhicl::detail::ParameterBase

Public Types

using ftype = std::array< std::shared_ptr< tt::fhicl_type< T >>, N >
 
using value_type = std::array< tt::return_type< T >, N >
 

Public Member Functions

 OptionalSequence (Name &&name)
 
 OptionalSequence (Name &&name, Comment &&comment)
 
 OptionalSequence (Name &&name, Comment &&comment, std::function< bool()> maybeUse)
 
bool operator() (value_type &t) const
 
bool hasValue () const
 
bool empty () const
 
std::size_t size () const
 
void prepare_elements_for_validation (std::size_t const n)
 
void walk_elements (ParameterWalker< tt::const_flavor::require_non_const > &pw)
 
void walk_elements (ParameterWalker< tt::const_flavor::require_const > &pw) const
 
std::string key () const
 
std::string name () const
 
std::string 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)
 
void set_key (std::string const &key)
 

Private Member Functions

std::size_t get_size () const override
 
void do_prepare_elements_for_validation (std::size_t const n) override
 
void do_walk_elements (detail::ParameterWalker< tt::const_flavor::require_non_const > &pw) override
 
void do_walk_elements (detail::ParameterWalker< tt::const_flavor::require_const > &pw) const override
 
void do_set_value (fhicl::ParameterSet const &, bool const trimParents) override
 

Private Attributes

ftype value_
 
bool has_value_ {false}
 

Detailed Description

template<typename T, std::size_t N = -1ull>
class fhicl::OptionalSequence< T, N >

Definition at line 45 of file type_traits.h.

Member Typedef Documentation

template<typename T, std::size_t N = -1ull>
using fhicl::OptionalSequence< T, N >::ftype = std::array<std::shared_ptr<tt::fhicl_type<T>>, N>

Definition at line 35 of file OptionalSequence.h.

template<typename T, std::size_t N = -1ull>
using fhicl::OptionalSequence< T, N >::value_type = std::array<tt::return_type<T>, N>

Definition at line 36 of file OptionalSequence.h.

Constructor & Destructor Documentation

template<typename T, std::size_t N = -1ull>
fhicl::OptionalSequence< T, N >::OptionalSequence ( Name &&  name)
explicit
template<typename T, std::size_t N = -1ull>
fhicl::OptionalSequence< T, N >::OptionalSequence ( Name &&  name,
Comment &&  comment 
)
explicit
template<typename T, std::size_t N = -1ull>
fhicl::OptionalSequence< T, N >::OptionalSequence ( Name &&  name,
Comment &&  comment,
std::function< bool()>  maybeUse 
)
explicit

Member Function Documentation

std::string fhicl::detail::ParameterBase::comment ( ) const
inlineinherited
template<typename T, std::size_t N = -1ull>
void fhicl::OptionalSequence< T, N >::do_prepare_elements_for_validation ( std::size_t const  n)
inlineoverrideprivatevirtual

Implements fhicl::detail::SequenceBase.

Definition at line 75 of file OptionalSequence.h.

76  {
78  }
void check_nargs_for_bounded_sequences(std::string const &key, std::size_t expected, std::size_t provided)
std::size_t get_size() const override
std::string key() const
Definition: ParameterBase.h:44
template<typename T, std::size_t N = -1ull>
void fhicl::OptionalSequence< T, N >::do_set_value ( fhicl::ParameterSet const &  ,
bool const  trimParents 
)
overrideprivatevirtual
template<typename T, std::size_t N = -1ull>
void fhicl::OptionalSequence< T, N >::do_walk_elements ( detail::ParameterWalker< tt::const_flavor::require_non_const > &  pw)
inlineoverrideprivatevirtual

Implements fhicl::detail::SequenceBase.

Definition at line 81 of file OptionalSequence.h.

83  {
84  cet::for_all(value_, [&pw](auto& e) { pw.walk_over(*e); });
85  }
auto for_all(FwdCont &, Func)
Float_t e
Definition: plot.C:35
template<typename T, std::size_t N = -1ull>
void fhicl::OptionalSequence< T, N >::do_walk_elements ( detail::ParameterWalker< tt::const_flavor::require_const > &  pw) const
inlineoverrideprivatevirtual

Implements fhicl::detail::SequenceBase.

Definition at line 88 of file OptionalSequence.h.

90  {
91  cet::for_all(value_, [&pw](auto const& e) { pw.walk_over(*e); });
92  }
auto for_all(FwdCont &, Func)
Float_t e
Definition: plot.C:35
bool fhicl::detail::SequenceBase::empty ( ) const
inlineinherited

Definition at line 29 of file SequenceBase.h.

References fhicl::detail::SequenceBase::size().

30  {
31  return size() == 0;
32  }
std::size_t size() const
Definition: SequenceBase.h:34
template<typename T, std::size_t N = -1ull>
std::size_t fhicl::OptionalSequence< T, N >::get_size ( ) const
inlineoverrideprivatevirtual
bool fhicl::detail::ParameterBase::has_default ( ) const
inlineinherited
template<typename T, std::size_t N = -1ull>
bool fhicl::OptionalSequence< T, N >::hasValue ( ) const
inline

Definition at line 59 of file OptionalSequence.h.

60  {
61  return has_value_;
62  }
bool fhicl::detail::ParameterBase::is_conditional ( ) const
inlineinherited
bool fhicl::detail::ParameterBase::is_optional ( ) const
inlineinherited
std::string fhicl::detail::ParameterBase::key ( ) const
inlineinherited
std::string fhicl::detail::ParameterBase::name ( ) const
inlineinherited
template<typename T, std::size_t N = -1ull>
bool fhicl::OptionalSequence< T, N >::operator() ( value_type t) const
inline

Definition at line 45 of file OptionalSequence.h.

46  {
47  if (!has_value_)
48  return false;
49 
52  value_, result.begin(), [](auto const& elem) { return (*elem)(); });
53 
54  std::swap(result, t);
55  return true;
56  }
std::array< tt::return_type< T >, N > value_type
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
auto transform_all(Container &, OutputIt, UnaryOp)
typename return_type_impl< ARGS... >::value_type return_type
Definition: type_traits.h:310
par_type fhicl::detail::ParameterBase::parameter_type ( ) const
inlineinherited
void fhicl::detail::SequenceBase::prepare_elements_for_validation ( std::size_t const  n)
inlineinherited

Definition at line 40 of file SequenceBase.h.

References fhicl::detail::SequenceBase::do_prepare_elements_for_validation().

41  {
43  }
virtual void do_prepare_elements_for_validation(std::size_t)=0
void fhicl::detail::ParameterBase::set_key ( std::string const &  key)
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::size_t fhicl::detail::SequenceBase::size ( void  ) const
inlineinherited

Definition at line 34 of file SequenceBase.h.

References fhicl::detail::SequenceBase::get_size().

Referenced by fhicl::detail::SequenceBase::empty().

35  {
36  return get_size();
37  }
virtual std::size_t get_size() const =0
void fhicl::detail::SequenceBase::walk_elements ( ParameterWalker< tt::const_flavor::require_non_const > &  pw)
inlineinherited

Definition at line 45 of file SequenceBase.h.

References fhicl::detail::SequenceBase::do_walk_elements().

46  {
47  do_walk_elements(pw);
48  }
virtual void do_walk_elements(ParameterWalker< tt::const_flavor::require_non_const > &)=0
void fhicl::detail::SequenceBase::walk_elements ( ParameterWalker< tt::const_flavor::require_const > &  pw) const
inlineinherited

Definition at line 50 of file SequenceBase.h.

References fhicl::detail::SequenceBase::do_prepare_elements_for_validation(), fhicl::detail::SequenceBase::do_walk_elements(), and fhicl::detail::SequenceBase::get_size().

51  {
52  do_walk_elements(pw);
53  }
virtual void do_walk_elements(ParameterWalker< tt::const_flavor::require_non_const > &)=0

Member Data Documentation

template<typename T, std::size_t N = -1ull>
bool fhicl::OptionalSequence< T, N >::has_value_ {false}
private
template<typename T, std::size_t N = -1ull>
ftype fhicl::OptionalSequence< T, N >::value_
private

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