Skip to content

Commit 78b4c54

Browse files
authored
DPL: decouple DataAllocator from TableBuilder (#2983)
If one needs DataAllocator to create arrow tables, the TableBuilder.h header should be included before DataAllocator.h. This way we avoid rebuilding everything when ASoA.h changes. We should probably do the same for boost and ROOT.
1 parent ccca5e0 commit 78b4c54

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

Framework/Core/include/Framework/AODReaderHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef o2_framework_readers_AODReaderHelpers_INCLUDED_H
1212
#define o2_framework_readers_AODReaderHelpers_INCLUDED_H
1313

14+
#include "Framework/TableBuilder.h"
1415
#include "Framework/AlgorithmSpec.h"
1516

1617
namespace o2

Framework/Core/include/Framework/DataAllocator.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "Framework/TypeTraits.h"
2727
#include "Framework/Traits.h"
2828
#include "Framework/SerializationMethods.h"
29-
#include "Framework/TableBuilder.h"
29+
#include "Framework/FunctionalHelpers.h"
3030

3131
#include "Headers/DataHeader.h"
3232
#include <TClass.h>
@@ -130,9 +130,12 @@ class DataAllocator
130130
std::string* s = new std::string(args...);
131131
adopt(spec, s);
132132
return *s;
133-
} else if constexpr (std::is_base_of_v<TableBuilder, T>) {
134-
TableBuilder* tb = new TableBuilder(args...);
135-
adopt(spec, tb);
133+
} else if constexpr (std::is_base_of_v<struct TableBuilder, T>) {
134+
TableBuilder* tb = nullptr;
135+
call_if_defined<struct TableBuilder>([&](auto* p) {
136+
tb = new std::decay_t<decltype(*p)>(args...);
137+
adopt(spec, tb);
138+
});
136139
return *tb;
137140
} else if constexpr (sizeof...(Args) == 0) {
138141
if constexpr (is_messageable<T>::value == true) {
@@ -189,7 +192,7 @@ class DataAllocator
189192
/// Adopt a TableBuilder in the framework and serialise / send
190193
/// it as an Arrow table to all consumers of @a spec once done
191194
void
192-
adopt(const Output& spec, TableBuilder*);
195+
adopt(const Output& spec, struct TableBuilder*);
193196

194197
/// Adopt a raw buffer in the framework and serialize / send
195198
/// it to the consumers of @a spec once done.

Framework/Core/include/Framework/TableTreeHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "TFile.h"
1414
#include "TTreeReader.h"
1515
#include "TTreeReaderValue.h"
16+
#include "TableBuilder.h"
1617

1718
// =============================================================================
1819
namespace o2

Framework/Core/src/CommonDataProcessors.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "Framework/DataDescriptorMatcher.h"
1919
#include "Framework/DataProcessorSpec.h"
2020
#include "Framework/DataSpecUtils.h"
21+
#include "Framework/TableBuilder.h"
2122
#include "Framework/EndOfStreamContext.h"
2223
#include "Framework/InitContext.h"
2324
#include "Framework/InputSpec.h"

Framework/Core/src/DataAllocator.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010
#include "Framework/CompilerBuiltins.h"
11+
#include "Framework/TableBuilder.h"
1112
#include "Framework/DataAllocator.h"
1213
#include "Framework/MessageContext.h"
1314
#include "Framework/ArrowContext.h"

Framework/TestWorkflows/src/o2AODDummy.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// In applying this license CERN does not waive the privileges and immunities
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
10+
#include "Framework/TableBuilder.h"
1011
#include "Framework/runDataProcessing.h"
1112

1213
#include <ROOT/RDataFrame.hxx>

0 commit comments

Comments
 (0)