Logo ROOT  
Reference Guide
RCustomColumnBase.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_RCUSTOMCOLUMNBASE
12#define ROOT_RCUSTOMCOLUMNBASE
13
16
17#include <memory>
18#include <string>
19#include <vector>
20#include <deque>
21
22class TTreeReader;
23
24namespace ROOT {
25namespace Detail {
26namespace RDF {
27
29class RLoopManager;
30
32protected:
33 RLoopManager *fLoopManager; ///< A raw pointer to the RLoopManager at the root of this functional graph. It is only
34 /// guaranteed to contain a valid address during an event loop.
35 const std::string fName;
36 unsigned int fNChildren{0}; ///< number of nodes of the functional graph hanging from this object
37 unsigned int fNStopsReceived{0}; ///< number of times that a children node signaled to stop processing entries.
38 const unsigned int fNSlots; ///< number of thread slots used by this node, inherited from parent node.
39 const bool fIsDataSourceColumn; ///< does the custom column refer to a data-source column? (or a user-define column?)
40 std::vector<Long64_t> fLastCheckedEntry;
41 /// A unique ID that identifies this custom column.
42 /// Used e.g. to distinguish custom columns with the same name in different branches of the computation graph.
43 const unsigned int fID = GetNextID();
45 std::deque<bool> fIsInitialized; // because vector<bool> is not thread-safe
46
47 static unsigned int GetNextID();
48
49public:
50 RCustomColumnBase(RLoopManager *lm, std::string_view name, const unsigned int nSlots, const bool isDSColumn,
51 const RDFInternal::RBookedCustomColumns &customColumns);
52
54 virtual ~RCustomColumnBase();
55 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
56 virtual void *GetValuePtr(unsigned int slot) = 0;
57 virtual const std::type_info &GetTypeId() const = 0;
59 std::string GetName() const;
60 virtual void Update(unsigned int slot, Long64_t entry) = 0;
61 virtual void ClearValueReaders(unsigned int slot) = 0;
62 bool IsDataSourceColumn() const { return fIsDataSourceColumn; }
63 virtual void InitNode();
64 /// Return the unique identifier of this RCustomColumnBase.
65 unsigned int GetID() const { return fID; }
66};
67
68} // ns RDF
69} // ns Detail
70} // ns ROOT
71
72#endif // ROOT_RCUSTOMCOLUMNBASE
ROOT::R::TRInterface & r
Definition: Object.C:4
long long Long64_t
Definition: RtypesCore.h:69
char name[80]
Definition: TGX11.cxx:109
unsigned int fNChildren
number of nodes of the functional graph hanging from this object
virtual void Update(unsigned int slot, Long64_t entry)=0
unsigned int GetID() const
Return the unique identifier of this RCustomColumnBase.
virtual void * GetValuePtr(unsigned int slot)=0
RLoopManager * fLoopManager
A raw pointer to the RLoopManager at the root of this functional graph.
unsigned int fNStopsReceived
number of times that a children node signaled to stop processing entries.
virtual void InitSlot(TTreeReader *r, unsigned int slot)=0
virtual void ClearValueReaders(unsigned int slot)=0
const bool fIsDataSourceColumn
does the custom column refer to a data-source column? (or a user-define column?)
std::vector< Long64_t > fLastCheckedEntry
virtual const std::type_info & GetTypeId() const =0
RLoopManager * GetLoopManagerUnchecked() const
RCustomColumnBase(RLoopManager *lm, std::string_view name, const unsigned int nSlots, const bool isDSColumn, const RDFInternal::RBookedCustomColumns &customColumns)
RDFInternal::RBookedCustomColumns fCustomColumns
RCustomColumnBase & operator=(const RCustomColumnBase &)=delete
const unsigned int fNSlots
number of thread slots used by this node, inherited from parent node.
const unsigned int fID
A unique ID that identifies this custom column.
The head node of a RDF computation graph.
Encapsulates the columns defined by the user.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition: TTreeReader.h:43
basic_string_view< char > string_view
VSD Structures.
Definition: StringConv.hxx:21