1 #ifndef fhiclcpp_types_TupleAs_h 2 #define fhiclcpp_types_TupleAs_h 21 template <
typename T,
typename... ARGS>
24 template <
typename T,
typename... ARGS>
36 std::function<
bool()> maybeUse);
43 std::function<
bool()> maybeUse,
46 template <std::size_t... I>
50 return T{std::get<I>(via)...};
57 return tupleObj_(via) ?
fill(via, std::index_sequence_for<ARGS...>{}) :
58 tupleObj_.has_default() ?
85 template <
typename T,
typename... ARGS>
90 template <
typename T,
typename... ARGS>
92 : tupleObj_{std::move(name), conversion_comment(std::move(comment))}
97 template <
typename T,
typename... ARGS>
100 std::function<
bool()> maybeUse)
101 : tupleObj_{std::move(name),
102 conversion_comment(std::move(comment)),
109 template <
typename T,
typename... ARGS>
114 template <
typename T,
typename... ARGS>
116 : tupleObj_{std::move(name), conversion_comment(std::move(comment), t)}
117 , t_{std::make_shared<T>(t)}
122 template <
typename T,
typename... ARGS>
125 std::function<
bool()> maybeUse,
127 : tupleObj_{std::move(name),
128 conversion_comment(std::move(comment), t),
130 , t_{std::make_shared<T>(t)}
135 template <
typename T,
typename... ARGS>
139 std::string
const preface =
140 "N.B. The following sequence is converted to type:";
141 std::string
const name =
142 " '" + cet::demangle_symbol(
typeid(T).name()) +
"'";
143 std::string
const user_comment =
144 comment.value.empty() ?
"" :
"\n\n" + comment.value;
146 std::ostringstream oss;
147 oss << preface <<
'\n' << name << user_comment;
148 return Comment{oss.str().c_str()};
155 namespace has_insertion_operator_impl {
160 template <
typename T>
166 yes&
test(std::ostream&);
169 template <
typename T>
171 static std::ostream&
s;
173 static bool const value =
sizeof(
test(s << t)) ==
sizeof(yes);
177 template <
typename T>
183 template <
typename T>
187 return " A default value is present, but it cannot be\n" 188 " printed out since no 'operator<<' overload has\n" 189 " been provided for the above type.";
194 template <
typename T>
198 std::ostringstream os;
199 os <<
" with a default value of:\n" 207 template <
typename T,
typename... ARGS>
211 std::string
const preface{
212 "N.B. The following sequence is converted to type:"};
213 std::string
const name{
" '" +
214 cet::demangle_symbol(
typeid(T).name()) +
"'"};
219 std::string
const user_comment{
220 comment.value.empty() ?
"" :
"\n\n" + comment.value};
222 std::ostringstream oss;
223 oss << preface <<
'\n' 225 << stringified_default(t) << user_comment;
226 return Comment{oss.str().c_str()};
T fill(via_type const &via, std::index_sequence< I... >) const
typename OptionalTuple< ARGS... >::ftype ftype
std::string operator()(T const &)
typename OptionalTuple< ARGS... >::value_type via_type
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
std::string value(boost::any const &)
std::string operator()(T const &t)
std::ostream & operator<<(std::ostream &, ParameterSetID const &)
OptionalTuple< ARGS... > tupleObj_
cet::coded_exception< error, detail::translate > exception