LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
fhicl::TupleAs< T(ARGS...)> Class Template Reference

#include "TupleAs.h"

Public Types

using default_type = T
 
using via_type = typename OptionalTuple< ARGS... >::value_type
 
using value_type = T
 
using ftype = typename OptionalTuple< ARGS... >::ftype
 

Public Member Functions

 TupleAs (Name &&name)
 
 TupleAs (Name &&name, Comment &&comment)
 
 TupleAs (Name &&name, Comment &&comment, std::function< bool()> maybeUse)
 
 TupleAs (Name &&name, T const &t)
 
 TupleAs (Name &&name, Comment &&comment, T const &t)
 
 TupleAs (Name &&name, Comment &&comment, std::function< bool()> maybeUse, T const &t)
 
operator() () const
 
 operator detail::ParameterBase & ()
 

Private Member Functions

Comment conversion_comment (Comment &&comment) const
 
Comment conversion_comment (Comment &&comment, T const &t) const
 

Private Attributes

OptionalTuple< ARGS... > tupleObj_
 
std::shared_ptr< T > t_ {}
 

Detailed Description

template<typename T, typename... ARGS>
class fhicl::TupleAs< T(ARGS...)>

Definition at line 27 of file TupleAs.h.

Member Typedef Documentation

template<typename T , typename... ARGS>
using fhicl::TupleAs< T(ARGS...)>::default_type = T

Definition at line 29 of file TupleAs.h.

template<typename T , typename... ARGS>
using fhicl::TupleAs< T(ARGS...)>::ftype = typename OptionalTuple<ARGS...>::ftype

Definition at line 32 of file TupleAs.h.

template<typename T , typename... ARGS>
using fhicl::TupleAs< T(ARGS...)>::value_type = T

Definition at line 31 of file TupleAs.h.

template<typename T , typename... ARGS>
using fhicl::TupleAs< T(ARGS...)>::via_type = typename OptionalTuple<ARGS...>::value_type

Definition at line 30 of file TupleAs.h.

Constructor & Destructor Documentation

template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name)
explicit

Definition at line 81 of file TupleAs.h.

82  : TupleAs{std::move(name), Comment("")}
83  {}
TupleAs(Name &&name)
Definition: TupleAs.h:81
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name,
Comment &&  comment 
)
explicit

Definition at line 86 of file TupleAs.h.

References fhicl::REQUIRED.

87  : tupleObj_{std::move(name), conversion_comment(std::move(comment))}
88  {
90  }
Comment conversion_comment(Comment &&comment) const
Definition: TupleAs.h:134
void set_par_style(par_style const vt)
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name,
Comment &&  comment,
std::function< bool()>  maybeUse 
)
explicit

Definition at line 93 of file TupleAs.h.

References fhicl::REQUIRED_CONDITIONAL.

96  : tupleObj_{std::move(name),
97  conversion_comment(std::move(comment)),
98  maybeUse}
99  {
101  }
Comment conversion_comment(Comment &&comment) const
Definition: TupleAs.h:134
void set_par_style(par_style const vt)
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name,
T const &  t 
)
explicit

Definition at line 105 of file TupleAs.h.

106  : TupleAs{std::move(name), Comment(""), t}
107  {}
TupleAs(Name &&name)
Definition: TupleAs.h:81
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name,
Comment &&  comment,
T const &  t 
)
explicit

Definition at line 110 of file TupleAs.h.

References fhicl::DEFAULT.

111  : tupleObj_{std::move(name), conversion_comment(std::move(comment), t)}
112  , t_{std::make_shared<T>(t)}
113  {
115  }
Comment conversion_comment(Comment &&comment) const
Definition: TupleAs.h:134
std::shared_ptr< T > t_
Definition: TupleAs.h:71
void set_par_style(par_style const vt)
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::TupleAs ( Name &&  name,
Comment &&  comment,
std::function< bool()>  maybeUse,
T const &  t 
)
explicit

Definition at line 118 of file TupleAs.h.

References fhicl::DEFAULT_CONDITIONAL.

122  : tupleObj_{std::move(name),
123  conversion_comment(std::move(comment), t),
124  maybeUse}
125  , t_{std::make_shared<T>(t)}
126  {
128  }
Comment conversion_comment(Comment &&comment) const
Definition: TupleAs.h:134
std::shared_ptr< T > t_
Definition: TupleAs.h:71
void set_par_style(par_style const vt)
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69

Member Function Documentation

template<typename T , typename... ARGS>
Comment fhicl::TupleAs< T(ARGS...)>::conversion_comment ( Comment &&  comment) const
private

Definition at line 134 of file TupleAs.h.

135  {
136  std::string const preface =
137  "N.B. The following sequence is converted to type:";
138  std::string const name =
139  " '" + cet::demangle_symbol(typeid(T).name()) + "'";
140  std::string const user_comment =
141  comment.value.empty() ? "" : "\n\n" + comment.value;
142 
143  std::ostringstream oss;
144  oss << preface << '\n' << name << user_comment;
145  return Comment{oss.str().c_str()};
146  }
template<typename T , typename... ARGS>
Comment fhicl::TupleAs< T(ARGS...)>::conversion_comment ( Comment &&  comment,
T const &  t 
) const
private

Definition at line 150 of file TupleAs.h.

References fhicl::detail::maybe_insert().

151  {
152  std::string const preface{
153  "N.B. The following sequence is converted to type:"};
154  std::string const name{" '" +
155  cet::demangle_symbol(typeid(T).name()) + "'"};
156 
157  std::string const user_comment{
158  comment.value.empty() ? "" : "\n\n" + comment.value};
159 
160  std::ostringstream oss;
161  oss << preface << '\n'
162  << name << '\n'
163  << detail::maybe_insert(t) << user_comment;
164  return Comment{oss.str().c_str()};
165  }
std::string maybe_insert(T const &t)
Definition: maybe_insert.h:23
template<typename T , typename... ARGS>
fhicl::TupleAs< T(ARGS...)>::operator detail::ParameterBase & ( )
inline

Definition at line 62 of file TupleAs.h.

63  {
64  return tupleObj_;
65  } // Allows implicit conversion from
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69
template<typename T , typename... ARGS>
T fhicl::TupleAs< T(ARGS...)>::operator() ( ) const
inline

Definition at line 49 of file TupleAs.h.

References fhicl::cant_find.

50  {
51  via_type via;
52  return tupleObj_(via) ? std::make_from_tuple<T>(via) :
54  *t_ :
55  throw fhicl::exception(
56  cant_find); // fix this exception category!
57  }
std::shared_ptr< T > t_
Definition: TupleAs.h:71
typename OptionalTuple< ARGS... >::value_type via_type
Definition: TupleAs.h:30
OptionalTuple< ARGS... > tupleObj_
Definition: TupleAs.h:69
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

template<typename T , typename... ARGS>
std::shared_ptr<T> fhicl::TupleAs< T(ARGS...)>::t_ {}
private

Definition at line 71 of file TupleAs.h.

template<typename T , typename... ARGS>
OptionalTuple<ARGS...> fhicl::TupleAs< T(ARGS...)>::tupleObj_
private

Definition at line 69 of file TupleAs.h.


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