Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
ColumnReaderUtils.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud CERN 09/2020
2
3/*************************************************************************
4 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RDF_COLUMNREADERUTILS
12#define ROOT_RDF_COLUMNREADERUTILS
13
14#include "RColumnReaderBase.hxx"
15#include "RColumnRegister.hxx"
16#include "RDefineBase.hxx"
17#include "RDefineReader.hxx"
18#include "RDSColumnReader.hxx"
19#include "RLoopManager.hxx"
20#include "RVariationBase.hxx"
21#include "RVariationReader.hxx"
22
23#include <ROOT/RDataSource.hxx>
24#include <ROOT/TypeTraits.hxx>
25
26#include <array>
27#include <cassert>
28#include <map>
29#include <memory>
30#include <string>
31#include <typeinfo> // for typeid
32#include <vector>
33
34class TTreeReader;
35
36namespace ROOT {
37namespace Internal {
38namespace RDF {
39
40using namespace ROOT::TypeTraits;
42
44 RLoopManager &lm, TTreeReader *treeReader, std::string_view colName,
45 const std::type_info &ti);
46
47/// This type aggregates some of the arguments passed to GetColumnReaders.
48/// We need to pass a single RColumnReadersInfo object rather than each argument separately because with too many
49/// arguments passed, gcc 7.5.0 and cling disagree on the ABI, which leads to the last function argument being read
50/// incorrectly from a compiled GetColumnReaders symbols when invoked from a jitted symbol.
52 const std::vector<std::string> &fColNames;
54 const bool *fIsDefine;
56};
57
58/// Create a group of column readers, one per type in the parameter pack.
59template <typename... ColTypes>
60std::array<RDFDetail::RColumnReaderBase *, sizeof...(ColTypes)>
62 const std::string &variationName = "nominal")
63{
64 // see RColumnReadersInfo for why we pass these arguments like this rather than directly as function arguments
65 const auto &colNames = colInfo.fColNames;
66 auto &lm = colInfo.fLoopManager;
67 auto &colRegister = colInfo.fColRegister;
68
69 int i = -1;
70
71 std::array<RDFDetail::RColumnReaderBase *, sizeof...(ColTypes)> ret{
72 (++i, GetColumnReader(slot, colRegister.GetReader(slot, colNames[i], variationName, typeid(ColTypes)), lm,
73 treeReader, colNames[i], typeid(ColTypes)))...};
74 return ret;
75}
76
77// Shortcut overload for the case of no columns
78inline std::array<RDFDetail::RColumnReaderBase *, 0>
79GetColumnReaders(unsigned int, TTreeReader *, TypeList<>, const RColumnReadersInfo &, const std::string & = "nominal")
80{
81 return {};
82}
83
84} // namespace RDF
85} // namespace Internal
86} // namespace ROOT
87
88#endif // ROOT_RDF_COLUMNREADERS
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The head node of a RDF computation graph.
Pure virtual base class for all column reader types.
A binder for user-defined columns, variations and aliases.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition TTreeReader.h:46
RDFDetail::RColumnReaderBase * GetColumnReader(unsigned int slot, RColumnReaderBase *defineOrVariationReader, RLoopManager &lm, TTreeReader *treeReader, std::string_view colName, const std::type_info &ti)
std::array< RDFDetail::RColumnReaderBase *, sizeof...(ColTypes)> GetColumnReaders(unsigned int slot, TTreeReader *treeReader, TypeList< ColTypes... >, const RColumnReadersInfo &colInfo, const std::string &variationName="nominal")
Create a group of column readers, one per type in the parameter pack.
ROOT type_traits extensions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
This type aggregates some of the arguments passed to GetColumnReaders.
const std::vector< std::string > & fColNames