1 #ifndef fhiclcpp_types_Tuple_h 2 #define fhiclcpp_types_Tuple_h 19 namespace tuple_detail {
28 template <
typename... DEFAULTS>
32 :
holder_{std::forward_as_tuple(defaults...)}
37 template <std::
size_t I>
55 template <
typename... TYPES>
61 using value_type = std::tuple<tt::return_type<TYPES>...>;
62 using ftype = std::tuple<std::shared_ptr<tt::fhicl_type<TYPES>>...>;
68 std::function<
bool()> maybeUse);
77 std::function<
bool()> maybeUse,
80 auto operator()()
const;
82 template <std::
size_t I>
86 return (*std::get<I>(value_))();
92 using TUPLE = std::tuple<tt::fhicl_type<TYPES>...>;
100 return std::tuple_size<ftype>();
117 template <
typename E,
typename... T>
127 visit_element(pw, others...);
130 template <std::size_t... I>
134 visit_element(pw, std::get<I>(value_)...);
146 iterate_over_tuple(pw, std::index_sequence_for<TYPES...>{});
153 template <
typename E,
typename... T>
163 visit_element(pw, others...);
166 template <std::size_t... I>
170 visit_element(pw, std::get<I>(value_)...);
176 iterate_over_tuple(pw, std::index_sequence_for<TYPES...>{});
183 template <
typename E,
typename... T>
187 using elem_ftype =
typename E::element_type;
195 finalize_tuple_elements(++i, others...);
198 template <std::size_t... I>
202 finalize_tuple_elements(0, std::get<I>(value_)...);
216 using elem_utype = std::tuple_element_t<I, UTUPLE>;
222 auto& elem = std::get<I>(value_);
223 elem = std::make_shared<tt::fhicl_type<elem_utype>>(
225 fill_tuple_element<I + 1>(defaults);
231 fill_tuple_element<0>(default_values);
236 template <
size_t I,
typename value_type>
241 template <
size_t I,
typename value_type>
245 std::get<I>(result) = (*std::get<I>(value_))();
246 fill_return_element<I + 1>(result);
252 fill_return_element<0>(result);
267 prepare_element_for_validation<I + 1>();
274 template <
typename... TYPES>
278 template <
typename... TYPES>
291 template <
typename... TYPES>
294 std::function<
bool()> maybeUse)
308 template <
typename... TYPES>
313 template <
typename... TYPES>
328 template <
typename... TYPES>
331 std::function<
bool()> maybeUse,
344 template <
typename... TYPES>
ValueHolder(DEFAULTS...defaults)
void do_walk_elements(PW_const &pw) const override
void do_set_value(fhicl::ParameterSet const &, bool) override
ValueHolder(std::tuple< DEFAULTS... > const &tup)
#define NO_DELEGATED_PARAMETERS
std::enable_if_t<(I< std::tuple_size< TUPLE >::value)> fill_return_element(value_type &result) const
void check_nargs_for_bounded_sequences(std::string const &key, std::size_t expected, std::size_t provided)
void fill_tuple_elements(default_type const &default_values)
#define NO_OPTIONAL_TYPES
std::size_t get_size() const override
std::enable_if_t<(I >=std::tuple_size< TUPLE >::value)> fill_tuple_element(default_type const &)
static void end_of_ctor()
std::function< bool()> AlwaysUse()
SequenceBase(Name &&name, Comment &&comment, par_style const vt, par_type const type, std::function< bool()> maybeUse)
void finalize_elements(std::index_sequence< I... >)
void iterate_over_tuple(PW_non_const &pw, std::index_sequence< I... >)
void do_prepare_elements_for_validation(std::size_t const n) override
std::enable_if_t<(I >=std::tuple_size< TUPLE >::value)> prepare_element_for_validation()
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
std::enable_if_t<(I< std::tuple_size< TUPLE >::value)> fill_tuple_element(default_type const &defaults)
RegisterIfTableMember(ParameterBase *pb)
typename fhicl_type_impl< T >::type fhicl_type
#define NO_STD_CONTAINERS
void iterate_over_tuple(PW_const &pw, std::index_sequence< I... >) const
void finalize_tuple_elements(std::size_t i, E &elem, T &...others)
std::tuple< TYPES... > UTUPLE
#define NO_NESTED_TABLE_FRAGMENTS
void visit_element(PW_non_const &pw, E &elem, T &...others)
static Name sequence_element(std::size_t const i)
void finalize_tuple_elements(std::size_t)
void assemble_rtype(value_type &result) const
std::string value(boost::any const &)
std::tuple< tt::return_type< TYPES >... > value_type
std::enable_if_t<(I< std::tuple_size< TUPLE >::value)> prepare_element_for_validation()
void do_walk_elements(PW_non_const &pw) override
#define NO_DEFAULTS_FOR_TABLE
std::tuple< DEFAULTS... > holder_
std::tuple< std::shared_ptr< tt::fhicl_type< TYPES >>... > ftype
std::enable_if_t<(I >=std::tuple_size< TUPLE >::value)> fill_return_element(value_type &) const
void visit_element(PW_non_const &)
std::string comment() const
std::tuple< tt::fhicl_type< TYPES >... > TUPLE
void visit_element(PW_const &) const
void visit_element(PW_const &pw, E const &elem, T const &...others) const