@@ -2360,6 +2360,43 @@ consteval static std::string_view namespace_prefix()
23602360 }; \
23612361 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
23622362
2363+ #define DECLARE_SOA_CCDB_COLUMN_FULL (_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_ ) \
2364+ struct _Name_ : o2::soa::Column<std::span<std::byte>, _Name_> { \
2365+ static constexpr const char * mLabel = _Label_; \
2366+ static constexpr const char * query = _CCDBQuery_; \
2367+ static constexpr const uint32_t hash = crc32(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2368+ using base = o2::soa::Column<std::span<std::byte>, _Name_>; \
2369+ using type = std::span<std::byte>; \
2370+ using column_t = _Name_; \
2371+ _Name_ (arrow::ChunkedArray const * column) \
2372+ : o2::soa::Column<std::span<std::byte>, _Name_>(o2::soa::ColumnIterator<std::span<std::byte>>(column)) \
2373+ { \
2374+ } \
2375+ \
2376+ _Name_ () = default ; \
2377+ _Name_ (_Name_ const & other) = default ; \
2378+ _Name_& operator =(_Name_ const & other) = default ; \
2379+ \
2380+ decltype (auto ) _Getter_() const \
2381+ { \
2382+ static std::byte* payload = nullptr ; \
2383+ static _ConcreteType_* deserialised = nullptr ; \
2384+ auto span = *mColumnIterator ; \
2385+ if (payload != (std::byte*)span.data ()) { \
2386+ payload = (std::byte*)span.data (); \
2387+ TBufferFile f (TBufferFile::EMode::kRead , span.size (), (char *)span.data (), kFALSE ); \
2388+ deserialised = (_ConcreteType_*)f.ReadObjectAny (TClass::GetClass (#_ConcreteType_)); \
2389+ } \
2390+ return *deserialised; \
2391+ } \
2392+ \
2393+ decltype (auto ) \
2394+ get () const \
2395+ { \
2396+ return _Getter_ (); \
2397+ } \
2398+ };
2399+
23632400#define DECLARE_SOA_COLUMN (_Name_, _Getter_, _Type_ ) \
23642401 DECLARE_SOA_COLUMN_FULL (_Name_, _Getter_, _Type_, " f" #_Name_)
23652402
@@ -3235,6 +3272,32 @@ consteval auto getIndexTargets()
32353272 using metadata = _Name_##Metadata; \
32363273 };
32373274
3275+ // Declare were each row is associated to a timestamp column of an _TimestampSource_
3276+ // table.
3277+ //
3278+ // The columns of this table have to be CCDB_COLUMNS so that for each timestamp, we get a row
3279+ // which points to the specified CCDB objectes described by those columns.
3280+ #define DECLARE_SOA_TIMESTAMPED_TABLE_FULL (_Name_, _Label_, _TimestampSource_, _TimestampColumn_, _Origin_, _Version_, _Desc_, ...) \
3281+ O2HASH (_Desc_ " /" #_Version_); \
3282+ template <typename O> \
3283+ using _Name_##TimestampFrom = soa::Table<o2::aod::Hash<_Label_ " " _h>, o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, O>; \
3284+ using _Name_##Timestamp = _Name_##TimestampFrom<o2::aod::Hash<_Origin_ " " _h>>; \
3285+ template <typename O = o2::aod::Hash<_Origin_ " " _h>> \
3286+ struct _Name_ ##TimestampMetadataFrom : TableMetadata<o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, __VA_ARGS__> { \
3287+ using timestamp_table_t = _TimestampSource_; \
3288+ using extension_table_t = _Name_##TimestampFrom<O>; \
3289+ using ccdb_pack_t = framework::pack<__VA_ARGS__>; \
3290+ /* static constexpr auto timestampColumn = _TimestampColumn_;*/ \
3291+ }; \
3292+ using _Name_##TimestampMetadata = _Name_##TimestampMetadataFrom<o2::aod::Hash<_Origin_ " " _h>>; \
3293+ template <> \
3294+ struct MetadataTrait <o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>> { \
3295+ using metadata = _Name_##TimestampMetadata; \
3296+ }; \
3297+ template <typename O> \
3298+ using _Name_##From = o2::soa::JoinFull<o2::aod::Hash<_Desc_ " /" #_Version_ " " _h>, _TimestampSource_, _Name_##TimestampFrom<O>>; \
3299+ using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ " " _h>>;
3300+
32383301#define DECLARE_SOA_INDEX_TABLE (_Name_, _Key_, _Description_, ...) \
32393302 DECLARE_SOA_INDEX_TABLE_FULL (_Name_, _Key_, " IDX" , 0 , _Description_, false , __VA_ARGS__)
32403303
0 commit comments