1 #ifndef fhiclcpp_types_Sequence_h 2 #define fhiclcpp_types_Sequence_h 4 #include "cetlib/container_algorithms.h" 16 #include <initializer_list> 19 #include <type_traits> 23 namespace sequence_detail {
37 template <std::
size_t N>
73 template <
typename T, std::size_t N = -1ull>
84 using ftype = std::array<std::shared_ptr<tt::fhicl_type<T>>, N>;
91 std::function<
bool()> maybeUse);
100 std::function<
bool()> maybeUse,
108 value_, result.begin(), [](
auto const& elem) {
return (*elem)(); });
115 return (*value_.at(i))();
124 return value_.size();
137 cet::for_all(value_, [&pw](
auto&
e) { pw.
walk_over(*
e); });
144 cet::for_all(value_, [&pw](
auto const&
e) { pw.
walk_over(*
e); });
155 template <
typename T>
164 using default_type = std::vector<typename tt::fhicl_type<T>::default_type>;
165 using ftype = std::vector<std::shared_ptr<tt::fhicl_type<T>>>;
172 std::function<
bool()> maybeUse);
181 std::function<
bool()> maybeUse,
188 cet::transform_all(value_, std::back_inserter(result), [](
auto const&
e) {
197 return (*value_.at(i))();
208 if (n < value_.size()) {
210 }
else if (n > value_.size()) {
211 std::string key_fragment{key()};
217 std::string
const& current_stem = nsr.current();
218 std::size_t
const pos =
219 key_fragment.find(current_stem) != std::string::npos ?
220 current_stem.size() + 1ul :
222 key_fragment.replace(0ul, pos,
"");
225 for (
auto i = value_.size(); i !=
n; ++i) {
235 return value_.size();
242 cet::for_all(value_, [&pw](
auto&
e) { pw.
walk_over(*
e); });
249 cet::for_all(value_, [&pw](
auto const&
e) { pw.
walk_over(*
e); });
std::size_t get_size() const override
std::array< tt::return_type< float >, N > value_type
void do_set_value(fhicl::ParameterSet const &, bool) override
static NameStackRegistry & instance()
void do_walk_elements(detail::ParameterWalker< tt::const_flavor::require_const > &pw) const override
void do_prepare_elements_for_validation(std::size_t const n) override
#define NO_DELEGATED_PARAMETERS
std::size_t get_size() const override
void do_set_value(fhicl::ParameterSet const &, bool) override
void check_nargs_for_bounded_sequences(std::string const &key, std::size_t expected, std::size_t provided)
#define NO_OPTIONAL_TYPES
ValueHolder(std::array< T, N > const &array)
void do_walk_elements(detail::ParameterWalker< tt::const_flavor::require_non_const > &pw) override
void do_prepare_elements_for_validation(std::size_t const n) override
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto array(Array const &a)
Returns a manipulator which will print the specified array.
typename fhicl_type_impl< T >::type fhicl_type
auto operator()(std::size_t i) const
std::vector< typename tt::fhicl_type< T >::default_type > default_type
std::vector< std::shared_ptr< tt::fhicl_type< T >>> ftype
void do_walk_elements(detail::ParameterWalker< tt::const_flavor::require_const > &pw) const override
void do_walk_elements(detail::ParameterWalker< tt::const_flavor::require_non_const > &pw) override
#define NO_NESTED_TABLE_FRAGMENTS
std::vector< tt::return_type< T >> value_type
std::array< std::shared_ptr< tt::fhicl_type< float >>, N > ftype
static Name sequence_element(std::size_t const i)
ValueHolder(std::initializer_list< T > list)
typename return_type_impl< ARGS... >::value_type return_type
auto operator()(std::size_t i) const