1 #ifndef fhiclcpp_types_Sequence_h 2 #define fhiclcpp_types_Sequence_h 16 #include <initializer_list> 19 #include <type_traits> 24 namespace sequence_detail {
38 template <std::
size_t N>
74 template <
typename T, std::size_t
N = -1ull>
84 using ftype = std::array<std::shared_ptr<tt::fhicl_type<T>>, N>;
106 if (
auto value = std::get_if<value_type>(&value_)) {
112 [](
auto const& elem) {
return (*elem)(); });
119 if (
auto value = std::get_if<value_type>(&value_)) {
122 return (*std::get<ftype>(value_).at(i))();
131 if (
auto value = std::get_if<value_type>(&value_)) {
132 return value->size();
134 return std::get<ftype>(value_).
size();
180 template <
typename T>
188 using default_type = std::vector<typename tt::fhicl_type<T>::default_type>;
189 using ftype = std::vector<std::shared_ptr<tt::fhicl_type<T>>>;
211 if (
auto value = std::get_if<value_type>(&value_)) {
216 std::back_inserter(result),
217 [](
auto const&
e) {
return (*
e)(); });
224 if (
auto value = std::get_if<value_type>(&value_)) {
227 return (*std::get<ftype>(value_).at(i))();
237 auto&
value = std::get<ftype>(value_);
241 if (n <
value.size()) {
243 }
else if (n >
value.size()) {
250 std::size_t
const pos =
251 key_fragment.find(current_stem) != std::string::npos ?
252 current_stem.size() + 1ul :
254 key_fragment.replace(0ul, pos,
"");
257 for (
auto i =
value.size(); i !=
n; ++i) {
267 if (
auto value = std::get_if<value_type>(&value_)) {
268 return value->size();
270 return std::get<ftype>(value_).
size();
309 #include "cetlib_except/demangle.h" 325 template <
typename T, std::
size_t N>
329 template <
typename T, std::
size_t N>
340 for (std::size_t i{}; i !=
N; ++i) {
347 template <
typename T, std::
size_t N>
360 for (std::size_t i{}; i !=
N; ++i) {
368 template <
typename T, std::
size_t N>
373 template <
typename T, std::
size_t N>
387 for (
auto const& arg : defaults) {
395 template <
typename T, std::
size_t N>
410 for (
auto const& arg : defaults) {
421 template <
typename T>
426 template <
typename T>
440 template <
typename T>
457 template <
typename T>
462 template <
typename T>
476 for (
auto const&
t : defaults) {
484 template <
typename T>
499 for (
auto const&
t : defaults) {
std::array< tt::return_type< float >, N > value_type
std::string const & name() const
std::vector< T > const holder_
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
std::variant< ftype, value_type > value_
#define NO_DELEGATED_PARAMETERS
void check_nargs_for_bounded_sequences(std::string const &key, std::size_t expected, std::size_t provided)
auto operator()(std::size_t const i) const
bool do_preset_value(fhicl::ParameterSet const &ps) override
auto operator()(std::size_t const i) const
#define NO_OPTIONAL_TYPES
ValueHolder(std::array< T, N > const &array)
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 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
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::string strip_first_containing_name(std::string const &key)
bool do_preset_value(fhicl::ParameterSet const &ps) override
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
RegisterIfTableMember(ParameterBase *pb)
auto end() const noexcept
typename fhicl_type_impl< T >::type fhicl_type
auto begin() const noexcept
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
T get(std::string const &key) const
void do_set_value(fhicl::ParameterSet const &) override
auto cend() const noexcept
void do_walk_elements(detail::ParameterWalker< tt::const_flavor::require_non_const > &pw) override
static std::string current()
static constexpr double ps
auto transform_all(Container &, OutputIt, UnaryOp)
void do_set_value(fhicl::ParameterSet const &) 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)
std::size_t get_size() const noexcept override
auto array(Array const &a)
Returns a manipulator which will print the specified array.
ValueHolder(std::initializer_list< T > list)
auto for_all(FwdCont &, Func)
std::string const & comment() const
typename return_type_impl< ARGS... >::value_type return_type
auto cbegin() const noexcept
#define NO_DEFAULTS_FOR_TABLE
std::variant< ftype, value_type > value_
void function(int client, int *resource, int parblock, int *test, int p)
std::size_t get_size() const noexcept override