diff --git a/Framework/Core/include/Framework/ConfigParamRegistry.h b/Framework/Core/include/Framework/ConfigParamRegistry.h index 91c523b9d96e7..b6902a2316997 100644 --- a/Framework/Core/include/Framework/ConfigParamRegistry.h +++ b/Framework/Core/include/Framework/ConfigParamRegistry.h @@ -13,14 +13,11 @@ #include "Framework/ConfigParamStore.h" #include -#include "Framework/Traits.h" #include #include #include #include -#include -#include template concept SimpleConfigValueType = std::same_as || @@ -37,6 +34,13 @@ concept SimpleConfigValueType = std::same_as || std::same_as || std::same_as; +template +concept VectorConfigValueType = std::same_as> || + std::same_as> || + std::same_as> || + std::same_as> || + std::same_as>; + template concept StringConfigValueType = std::same_as; @@ -50,7 +54,7 @@ template concept LabeledArrayLike = requires(T& t) { t.is_labeled_array(); }; template -concept ConfigValueType = SimpleConfigValueType || StringConfigValueType || o2::framework::base_of_template || Array2DLike || LabeledArrayLike; +concept ConfigValueType = SimpleConfigValueType || StringConfigValueType || VectorConfigValueType || Array2DLike || LabeledArrayLike; namespace o2::framework { diff --git a/Framework/Core/include/Framework/TableBuilder.h b/Framework/Core/include/Framework/TableBuilder.h index 1be53dc39567a..df392f6fbbaf5 100644 --- a/Framework/Core/include/Framework/TableBuilder.h +++ b/Framework/Core/include/Framework/TableBuilder.h @@ -623,6 +623,9 @@ auto makeHolders(arrow::MemoryPool* pool, size_t nRows) template using IndexedHoldersTuple = decltype(makeHolderTypes()); +template +concept ShouldNotDeconstruct = std::is_bounded_array_v || std::is_arithmetic_v || framework::is_base_of_template_v; + /// Helper class which creates a lambda suitable for building /// an arrow table from a tuple. This can be used, for example /// to build an arrow::Table from a TDataFrame. @@ -662,21 +665,15 @@ class TableBuilder public: template - requires(sizeof...(ARGS) == 0) + requires(sizeof...(ARGS) == 0) && (!ShouldNotDeconstruct) static constexpr int countColumns() { - if constexpr (std::is_bounded_array_v == false && - std::is_arithmetic_v == false && - framework::is_base_of_template_v == false) { - using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); - return framework::pack_size(argsPack_t{}); - } else { - return 1; - } + using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); + return framework::pack_size(argsPack_t{}); } template - requires(sizeof...(ARGS) > 0) + requires(sizeof...(ARGS) > 0) || ShouldNotDeconstruct static constexpr int countColumns() { return 1 + sizeof...(ARGS); @@ -698,7 +695,7 @@ class TableBuilder /// Creates a lambda which is suitable to persist things /// in an arrow::Table template - requires(sizeof...(ARGS) > 0) + requires(sizeof...(ARGS) > 0) || ShouldNotDeconstruct auto persist(std::array const& columnNames) { auto persister = persistTuple(framework::pack{}, columnNames); @@ -711,31 +708,15 @@ class TableBuilder // Special case for a single parameter to handle the serialization of struct // which can be decomposed template - requires(sizeof...(ARGS) == 0) + requires(sizeof...(ARGS) == 0) && (!ShouldNotDeconstruct) auto persist(std::array()> const& columnNames) { - if constexpr (std::is_bounded_array_v == false && - std::is_arithmetic_v == false && - framework::is_base_of_template_v == false) { - using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); - auto persister = persistTuple(argsPack_t{}, columnNames); - return [persister = persister](unsigned int slot, ARG0 const& obj) -> void { - auto t = to_tuple(obj); - persister(slot, t); - }; - } else if constexpr ((std::is_bounded_array_v == true || - framework::is_base_of_template_v == true)) { - auto persister = persistTuple(framework::pack{}, columnNames); - // Callback used to fill the builders - return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg) -> void { - persister(slot, std::forward_as_tuple(arg)); - }; - } else { - auto persister = persistTuple(framework::pack{}, columnNames); - return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg) -> void { - persister(slot, std::forward_as_tuple(arg)); - }; - } + using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); + auto persister = persistTuple(argsPack_t{}, columnNames); + return [persister = persister](unsigned int slot, ARG0 const& obj) -> void { + auto t = to_tuple(obj); + persister(slot, t); + }; } /// Same a the above, but use a tuple to persist stuff. diff --git a/Framework/Core/src/ConfigParamRegistry.cxx b/Framework/Core/src/ConfigParamRegistry.cxx index 44eb61b4a30c4..0e895bc38e063 100644 --- a/Framework/Core/src/ConfigParamRegistry.cxx +++ b/Framework/Core/src/ConfigParamRegistry.cxx @@ -50,7 +50,7 @@ T getImpl(boost::property_tree::ptree const& tree, const char* key) } template - requires base_of_template + requires VectorConfigValueType auto getImpl(boost::property_tree::ptree const& tree, const char* key) { return o2::framework::vectorFromBranch(tree.get_child(key));