Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RJittedCustomColumn.hxx
Go to the documentation of this file.
1 // Author: Enrico Guiraud, Danilo Piparo CERN 09/2018
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2018, 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_RJITTEDCUSTOMCOLUMN
12 #define ROOT_RJITTEDCUSTOMCOLUMN
13 
15 #include "ROOT/RStringView.hxx"
16 #include "RtypesCore.h"
17 
18 #include <memory>
19 #include <type_traits>
20 
21 class TTreeReader;
22 
23 namespace ROOT {
24 namespace Detail {
25 namespace RDF {
26 
27 class RLoopManager;
28 
29 /// A wrapper around a concrete RCustomColumn, which forwards all calls to it
30 /// RJittedCustomColumn is a placeholder that is put in the collection of custom columns in place of a RCustomColumn
31 /// that will be just-in-time compiled. Jitted code will assign the concrete RCustomColumn to this RJittedCustomColumn
32 /// before the event-loop starts.
33 class RJittedCustomColumn : public RCustomColumnBase {
34  std::unique_ptr<RCustomColumnBase> fConcreteCustomColumn = nullptr;
35 
36 public:
37  RJittedCustomColumn(RLoopManager *lm, std::string_view name, unsigned int nSlots)
38  : RCustomColumnBase(lm, name, nSlots, /*isDSColumn=*/false, RDFInternal::RBookedCustomColumns())
39  {
40  }
41 
42  void SetCustomColumn(std::unique_ptr<RCustomColumnBase> c) { fConcreteCustomColumn = std::move(c); }
43 
44  void InitSlot(TTreeReader *r, unsigned int slot) final;
45  void *GetValuePtr(unsigned int slot) final;
46  const std::type_info &GetTypeId() const final;
47  void Update(unsigned int slot, Long64_t entry) final;
48  void ClearValueReaders(unsigned int slot) final;
49  void InitNode() final;
50 };
51 
52 } // ns RDF
53 } // ns Detail
54 } // ns ROOT
55 
56 #endif // ROOT_RJITTEDCUSTOMCOLUMN