@@ -190,6 +190,9 @@ template <is_producable T>
190190struct Produces : WritingCursor<T> {
191191};
192192
193+ template <typename T>
194+ concept is_produces = requires (T t) { typename T::cursor_t ; typename T::persistent_table_t ; &T::cursor; };
195+
193196// / Use this to group together produces. Useful to separate them logically
194197// / or simply to stay within the 100 elements per Task limit.
195198// / Use as:
@@ -201,6 +204,9 @@ struct Produces : WritingCursor<T> {
201204struct ProducesGroup {
202205};
203206
207+ template <typename T>
208+ concept is_produces_group = std::derived_from<T, ProducesGroup>;
209+
204210// / Helper template for table transformations
205211template <soa::is_metadata M, soa::TableRef Ref>
206212struct TableTransform {
@@ -250,6 +256,7 @@ constexpr auto transformBase()
250256
251257template <is_spawnable T>
252258struct Spawns : decltype (transformBase<T>()) {
259+ using spawnable_t = T;
253260 using metadata = decltype (transformBase<T>())::metadata;
254261 using extension_t = typename metadata::extension_table_t ;
255262 using base_table_t = typename metadata::base_table_t ;
@@ -277,6 +284,12 @@ struct Spawns : decltype(transformBase<T>()) {
277284 std::shared_ptr<extension_t > extension = nullptr ;
278285};
279286
287+ template <typename T>
288+ concept is_spawns = requires (T t) {
289+ typename T::metadata;
290+ std::same_as<decltype (t.pack ()), typename T::expression_pack_t >;
291+ };
292+
280293// / Policy to control index building
281294// / Exclusive index: each entry in a row has a valid index
282295// / Sparse index: values in a row can be (-1), index table is isomorphic (joinable)
@@ -420,6 +433,7 @@ constexpr auto transformBase()
420433
421434template <soa::is_index_table T>
422435struct Builds : decltype (transformBase<T>()) {
436+ using buildable_t = T;
423437 using metadata = decltype (transformBase<T>())::metadata;
424438 using IP = std::conditional_t <metadata::exclusive, IndexBuilder<Exclusive>, IndexBuilder<Sparse>>;
425439 using Key = metadata::Key;
@@ -455,6 +469,13 @@ struct Builds : decltype(transformBase<T>()) {
455469 }
456470};
457471
472+ template <typename T>
473+ concept is_builds = requires (T t) {
474+ typename T::metadata;
475+ typename T::Key;
476+ std::same_as<decltype (t.pack ()), typename T::index_pack_t >;
477+ };
478+
458479// / This helper class allows you to declare things which will be created by a
459480// / given analysis task. Currently wrapped objects are limited to be TNamed
460481// / descendants. Objects will be written to a ROOT file at the end of the
@@ -550,11 +571,15 @@ struct OutputObj {
550571 uint32_t mTaskHash ;
551572};
552573
574+ template <typename T>
575+ concept is_outputobj = requires (T t) { &T::setObject; std::same_as<decltype (t.object ), std::shared_ptr<typename T::obj_t >>; };
576+
553577// / This helper allows you to fetch a Sevice from the context or
554578// / by using some singleton. This hopefully will hide the Singleton and
555579// / We will be able to retrieve it in a more thread safe manner later on.
556580template <typename T>
557581struct Service {
582+ using service_t = T;
558583 T* service;
559584
560585 decltype (auto ) operator ->() const
@@ -567,6 +592,9 @@ struct Service {
567592 }
568593};
569594
595+ template <typename T>
596+ concept is_service = requires (T t) { std::same_as<decltype (t.service ), typename T::service_t *>; &T::operator ->;};
597+
570598auto getTableFromFilter (soa::is_filtered_table auto const & table, soa::SelectionVector&& selection)
571599{
572600 return std::make_unique<o2::soa::Filtered<std::decay_t <decltype (table)>>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
@@ -581,6 +609,7 @@ void initializePartitionCaches(std::set<uint32_t> const& hashes, std::shared_ptr
581609
582610template <typename T>
583611struct Partition {
612+ using content_t = T;
584613 Partition (expressions::Node&& filter_) : filter{std::forward<expressions::Node>(filter_)}
585614 {
586615 }
@@ -690,6 +719,9 @@ struct Partition {
690719 return mFiltered ->size ();
691720 }
692721};
722+
723+ template <typename T>
724+ concept is_partition = requires (T t) {&T::updatePlaceholders; std::same_as<decltype (t.filter ), expressions::Filter>; std::same_as<decltype (t.mFiltered ), std::unique_ptr<o2::soa::Filtered<typename T::content_t >>>;};
693725} // namespace o2::framework
694726
695727namespace o2 ::soa
0 commit comments