@@ -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+ requires 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+ requires 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,21 @@ struct OutputObj {
550571 uint32_t mTaskHash ;
551572};
552573
574+ template <typename T>
575+ concept is_outputobj = requires (T t) {
576+ &T::setHash;
577+ &T::spec;
578+ &T::ref;
579+ requires std::same_as<decltype (t.operator ->()), typename T::obj_t *>;
580+ requires std::same_as<decltype (t.object ), std::shared_ptr<typename T::obj_t >>;
581+ };
582+
553583// / This helper allows you to fetch a Sevice from the context or
554584// / by using some singleton. This hopefully will hide the Singleton and
555585// / We will be able to retrieve it in a more thread safe manner later on.
556586template <typename T>
557587struct Service {
588+ using service_t = T;
558589 T* service;
559590
560591 decltype (auto ) operator ->() const
@@ -567,6 +598,12 @@ struct Service {
567598 }
568599};
569600
601+ template <typename T>
602+ concept is_service = requires (T t) {
603+ requires std::same_as<decltype (t.service ), typename T::service_t *>;
604+ &T::operator ->;
605+ };
606+
570607auto getTableFromFilter (soa::is_filtered_table auto const & table, soa::SelectionVector&& selection)
571608{
572609 return std::make_unique<o2::soa::Filtered<std::decay_t <decltype (table)>>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
@@ -581,6 +618,7 @@ void initializePartitionCaches(std::set<uint32_t> const& hashes, std::shared_ptr
581618
582619template <typename T>
583620struct Partition {
621+ using content_t = T;
584622 Partition (expressions::Node&& filter_) : filter{std::forward<expressions::Node>(filter_)}
585623 {
586624 }
@@ -690,6 +728,13 @@ struct Partition {
690728 return mFiltered ->size ();
691729 }
692730};
731+
732+ template <typename T>
733+ concept is_partition = requires (T t) {
734+ &T::updatePlaceholders;
735+ requires std::same_as<decltype (t.filter ), expressions::Filter>;
736+ requires std::same_as<decltype (t.mFiltered ), std::unique_ptr<o2::soa::Filtered<typename T::content_t >>>;
737+ };
693738} // namespace o2::framework
694739
695740namespace o2 ::soa
0 commit comments