@@ -425,6 +425,9 @@ concept has_metadata = is_metadata_trait<T> && not_void<typename T::metadata>;
425425template <typename T>
426426concept has_extension = is_metadata<T> && not_void<typename T::extension_table_t >;
427427
428+ template <typename T>
429+ concept has_configurable_extension = has_extension<T> && requires (T t) { typename T::configurable_t ; requires std::same_as<std::true_type, typename T::configurable_t >; };
430+
428431template <typename T>
429432concept is_spawnable_column = std::same_as<typename T::spawnable_t , std::true_type>;
430433
@@ -2355,7 +2358,7 @@ O2HASH("TEST/0");
23552358 DECLARE_SOA_BITMAP_COLUMN_FULL (_Name_, _Getter_, _Size_, " f" #_Name_)
23562359
23572360// / An 'expression' column. i.e. a column that can be calculated from other
2358- // / columns with gandiva based on supplied C++ expression.
2361+ // / columns with gandiva based on static C++ expression.
23592362#define DECLARE_SOA_EXPRESSION_COLUMN_FULL (_Name_, _Getter_, _Type_, _Label_, _Expression_ ) \
23602363 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
23612364 static constexpr const char * mLabel = _Label_; \
@@ -2393,6 +2396,38 @@ O2HASH("TEST/0");
23932396#define DECLARE_SOA_EXPRESSION_COLUMN (_Name_, _Getter_, _Type_, _Expression_ ) \
23942397 DECLARE_SOA_EXPRESSION_COLUMN_FULL (_Name_, _Getter_, _Type_, " f" #_Name_, _Expression_);
23952398
2399+ // / A configurable 'expression' column. i.e. a column that can be calculated from other
2400+ // / columns with gandiva based on dynamically supplied C++ expression or a string definition.
2401+ #define DECLARE_SOA_CONFIGURABLE_EXPRESSION_COLUMN (_Name_, _Getter_, _Type_, _Label_ ) \
2402+ struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2403+ static constexpr const char * mLabel = _Label_; \
2404+ static constexpr const int32_t mHash = _Label_ " " _h; \
2405+ using base = o2::soa::Column<_Type_, _Name_>; \
2406+ using type = _Type_; \
2407+ using column_t = _Name_; \
2408+ using spawnable_t = std::true_type; \
2409+ _Name_ (arrow::ChunkedArray const * column) \
2410+ : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2411+ { \
2412+ } \
2413+ \
2414+ _Name_ () = default ; \
2415+ _Name_ (_Name_ const & other) = default ; \
2416+ _Name_& operator =(_Name_ const & other) = default ; \
2417+ \
2418+ decltype (auto ) _Getter_() const \
2419+ { \
2420+ return *mColumnIterator ; \
2421+ } \
2422+ \
2423+ decltype (auto ) get() const \
2424+ { \
2425+ return _Getter_ (); \
2426+ } \
2427+ }; \
2428+ [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, o2::framework::TypeIdHelpers::uniqueId<_Name_>(), \
2429+ o2::framework::expressions::selectArrowType<_Type_>() }
2430+
23962431// / An index column is a column of indices to elements / of another table named
23972432// / _Name_##s. The column name will be _Name_##Id and will always be stored in
23982433// / "fIndex"#_Table_#[_Suffix_]. If _Suffix_ is not empty it has to begin
@@ -3104,6 +3139,32 @@ consteval auto getIndexTargets()
31043139 O2HASH (#_Name_ " Extension" ); \
31053140 DECLARE_SOA_EXTENDED_TABLE_FULL (_Name_, #_Name_ " Extension" , _Table_, " AOD" , " EX" _Description_, 0 , __VA_ARGS__)
31063141
3142+ #define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_FULL (_Name_, _Label_, _OriginalTable_, _Origin_, _Desc_, _Version_, ...) \
3143+ O2HASH (_Desc_ " /" #_Version_); \
3144+ template <typename O> \
3145+ using _Name_##CfgExtensionFrom = soa::Table<o2::aod::Hash<_Label_ " " _h>, o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, O>; \
3146+ using _Name_##CfgExtension = _Name_##CfgExtensionFrom<o2::aod::Hash<_Origin_ " " _h>>; \
3147+ template <typename O = o2::aod::Hash<_Origin_ " " _h>> \
3148+ struct _Name_ ##CfgExtensionMetadataFrom : TableMetadata<o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, __VA_ARGS__> { \
3149+ using base_table_t = _OriginalTable_; \
3150+ using extension_table_t = _Name_##CfgExtensionFrom<O>; \
3151+ using placeholders_pack_t = framework::pack<__VA_ARGS__>; \
3152+ using configurable_t = std::true_type; \
3153+ static constexpr auto sources = _OriginalTable_::originals; \
3154+ }; \
3155+ using _Name_##CfgExtensionMetadata = _Name_##CfgExtensionMetadataFrom<o2::aod::Hash<_Origin_ " " _h>>; \
3156+ template <> \
3157+ struct MetadataTrait <o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>> { \
3158+ using metadata = _Name_##CfgExtensionMetadata; \
3159+ }; \
3160+ template <typename O> \
3161+ using _Name_##From = o2::soa::JoinFull<o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, _OriginalTable_, _Name_##CfgExtensionFrom<O>>; \
3162+ using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ " " _h>>;
3163+
3164+ #define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE (_Name_, _Table_, _Description_, ...) \
3165+ O2HASH (#_Name_ " CfgExtension" ); \
3166+ DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_FULL (_Name_, #_Name_ " CfgExtension" , _Table_, " AOD" , " EX" _Description_, 0 , __VA_ARGS__)
3167+
31073168#define DECLARE_SOA_INDEX_TABLE_FULL (_Name_, _Key_, _Origin_, _Version_, _Desc_, _Exclusive_, ...) \
31083169 O2HASH (#_Name_); \
31093170 O2HASH (_Desc_ " /" #_Version_); \
0 commit comments