Skip to content

Commit 7321dbb

Browse files
committed
array instead of vector; missing static; remove obsolete FIXMEs
1 parent 72ddeb7 commit 7321dbb

1 file changed

Lines changed: 15 additions & 25 deletions

File tree

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ struct WritingCursor {
503503
using persistent_table_t = decltype([]() { if constexpr (soa::is_iterator<T>) { return typename T::parent_t{nullptr}; } else { return T{nullptr}; } }());
504504
using cursor_t = decltype(std::declval<TableBuilder>().cursor<persistent_table_t>());
505505
OutputSpec outputSpec{soa::tableRef2OutputSpec<persistent_table_t::ref>()};
506-
OutputSpec updateOutputSpec(header::DataOrigin const& newOrigin = header::DataOrigin{"AOD"})
506+
static OutputSpec updateOutputSpec(header::DataOrigin const& newOrigin = header::DataOrigin{"AOD"})
507507
{
508508
return soa::tableRef2OutputSpec<persistent_table_t::ref>(newOrigin);
509509
}
@@ -597,8 +597,9 @@ struct OutputForTable {
597597
}
598598
};
599599

600-
/// In a multi-origin case the origin is provided by the type
601-
/// FIXME: in a rewritten origin case, we need to modify the output designation
600+
/// For the table-producing category of templates
601+
/// * In a multi-origin case the origin is provided by the type
602+
/// * In a rewritten origin case, we need to modify the output designation
602603

603604
/// This helper class allows you to declare things which will be created by a
604605
/// given analysis task. Notice how the actual cursor is implemented by the
@@ -625,9 +626,6 @@ struct ProducesGroup {
625626
template <typename T>
626627
concept is_produces_group = std::derived_from<T, ProducesGroup>;
627628

628-
/// In a multi-origin case the origin is provided by the type
629-
/// FIXME: In a rewritten origin case, we need to modify the output designation
630-
631629
/// Helper template for table transformations
632630
template <soa::is_metadata M, soa::TableRef Ref>
633631
struct TableTransform {
@@ -640,11 +638,11 @@ struct TableTransform {
640638
return soa::tableRef2OutputSpec<Ref>(newOrigin);
641639
}
642640

643-
std::vector<InputSpec> requiredInputs = getRequiredInputs();
644-
static std::vector<InputSpec> getRequiredInputs(header::DataOrigin const& newOrigin = header::DataOrigin{"AOD"})
641+
std::array<InputSpec, sources.size()> requiredInputs = getRequiredInputs();
642+
static consteval auto getRequiredInputs(header::DataOrigin const& newOrigin = header::DataOrigin{"AOD"})
645643
{
646644
return [&newOrigin]<size_t... Is>(std::index_sequence<Is...>) {
647-
return std::vector{soa::tableRef2InputSpec<sources[Is]>(newOrigin)...};
645+
return std::array{soa::tableRef2InputSpec<sources[Is]>(newOrigin)...};
648646
}(std::make_index_sequence<sources.size()>());
649647
}
650648
};
@@ -664,9 +662,10 @@ constexpr auto transformBase()
664662
return TableTransform<metadata, metadata::template extension_table_t_from<o2::aod::Hash<T::originals[T::originals.size() - 1].origin_hash>>::ref>{};
665663
}
666664

667-
/// In a multi-origin case the origin is provided by the type
668-
/// FIXME: In a rewritten origin case the output designation needs to be changed (through base class)
669-
/// The extraction of the elements needs to be changed in AnalysisManagers using the origin information from the base class
665+
/// for the automatic table templates
666+
/// * In a multi-origin case the origin is provided by the type
667+
/// * In a rewritten origin case the output designation needs to be changed through base class
668+
/// * The extraction of the elements happens in AnalysisManagers using the origin information from the base class
670669
template <is_spawnable T>
671670
struct Spawns : decltype(transformBase<T>()) {
672671
using spawnable_t = T;
@@ -691,7 +690,7 @@ struct Spawns : decltype(transformBase<T>()) {
691690

692691
std::shared_ptr<typename T::table_t> table = nullptr;
693692
std::shared_ptr<extension_t> extension = nullptr;
694-
std::array<o2::framework::expressions::Projector, N> projectors = []<typename... C>(framework::pack<C...>)->std::array<expressions::Projector, sizeof...(C)>
693+
static std::array<o2::framework::expressions::Projector, N> projectors = []<typename... C>(framework::pack<C...>)->std::array<expressions::Projector, sizeof...(C)>
695694
{
696695
return {{std::move(C::Projector())...}};
697696
}
@@ -711,10 +710,6 @@ concept is_spawns = requires(T t) {
711710
requires std::same_as<decltype(t.projector), std::shared_ptr<gandiva::Projector>>;
712711
};
713712

714-
/// In a multi-origin case the origin is provided by the type
715-
/// FIXME: In a rewritten origin case the output designation needs to be changed (through base class)
716-
/// The extraction of the elements needs to be changed in AnalysisManagers using the origin information from the base class
717-
718713
/// This helper struct allows you to declare extended tables with dynamically-supplied
719714
/// expressions to be created by the task
720715
/// The actual expressions have to be set in init() for the configurable expression
@@ -775,25 +770,20 @@ concept is_defines = requires(T t) {
775770

776771
/// Policy to control index building
777772
/// Exclusive index: each entry in a row has a valid index
778-
/// Sparse index: values in a row can be (-1), index table is isomorphic (joinable)
779-
/// to T1
773+
/// Sparse index: values in a row can be (-1), index table is isomorphic (joinable) to T1
780774
struct Exclusive {
781775
};
782776
struct Sparse {
783777
};
784778

785779
/// This helper struct allows you to declare index tables to be created in a task
786780
template <soa::is_index_table T>
787-
constexpr auto transformBase()
781+
consteval auto transformBase()
788782
{
789783
using metadata = typename aod::MetadataTrait<o2::aod::Hash<T::ref.desc_hash>>::metadata;
790784
return TableTransform<metadata, T::ref>{};
791785
}
792786

793-
/// In a multi-origin case the origin is provided by the type
794-
/// FIXME: In a rewritten origin case the output designation needs to be changed (through base class)
795-
/// The extraction of the elements needs to be changed in AnalysisManagers using the origin information from the base class
796-
797787
template <soa::is_index_table T>
798788
struct Builds : decltype(transformBase<T>()) {
799789
using buildable_t = T;
@@ -824,7 +814,7 @@ struct Builds : decltype(transformBase<T>()) {
824814
}
825815
std::shared_ptr<T> table = nullptr;
826816

827-
constexpr auto pack()
817+
static consteval auto pack()
828818
{
829819
return index_pack_t{};
830820
}

0 commit comments

Comments
 (0)