Logo ROOT   6.18/05
Reference Guide
RActionBase.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_RACTIONBASE
12#define ROOT_RACTIONBASE
13
15#include "ROOT/RDF/Utils.hxx" // ColumnNames_t
16#include "RtypesCore.h"
17
18#include <memory>
19#include <string>
20
21namespace ROOT {
22
23namespace Detail {
24namespace RDF {
25class RLoopManager;
26class RCustomColumnBase;
27}
28}
29
30namespace Internal {
31namespace RDF {
32namespace GraphDrawing {
33class GraphNode;
34}
35
36using namespace ROOT::Detail::RDF;
37
38// fwd decl for RActionBase
39namespace GraphDrawing {
40bool CheckIfDefaultOrDSColumn(const std::string &name,
41 const std::shared_ptr<ROOT::Detail::RDF::RCustomColumnBase> &column);
42} // namespace GraphDrawing
43
45protected:
46 /// A raw pointer to the RLoopManager at the root of this functional graph.
47 /// Never null: children nodes have shared ownership of parent nodes in the graph.
49
50private:
51 const unsigned int fNSlots; ///< Number of thread slots used by this node.
52 bool fHasRun = false;
54
56
57public:
58 RActionBase(RLoopManager *lm, const ColumnNames_t &colNames, RBookedCustomColumns &&customColumns);
59 RActionBase(const RActionBase &) = delete;
60 RActionBase &operator=(const RActionBase &) = delete;
61 virtual ~RActionBase();
62
63 const ColumnNames_t &GetColumnNames() const { return fColumnNames; }
66 unsigned int GetNSlots() const { return fNSlots; }
67 virtual void Run(unsigned int slot, Long64_t entry) = 0;
68 virtual void Initialize() = 0;
69 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
70 virtual void TriggerChildrenCount() = 0;
71 virtual void ClearValueReaders(unsigned int slot) = 0;
72 virtual void FinalizeSlot(unsigned int) = 0;
73 virtual void Finalize() = 0;
74 /// This method is invoked to update a partial result during the event loop, right before passing the result to a
75 /// user-defined callback registered via RResultPtr::RegisterCallback
76 virtual void *PartialUpdate(unsigned int slot) = 0;
77
78 // overridden by RJittedAction
79 virtual bool HasRun() const { return fHasRun; }
80 virtual void SetHasRun() { fHasRun = true; }
81
82 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0;
83};
84
85} // ns RDF
86} // ns Internal
87} // ns ROOT
88
89#endif // ROOT_RACTIONBASE
ROOT::R::TRInterface & r
Definition: Object.C:4
long long Long64_t
Definition: RtypesCore.h:69
char name[80]
Definition: TGX11.cxx:109
The head node of a RDF computation graph.
Class used to create the operation graph to be printed in the dot representation.
Definition: GraphNode.hxx:26
const ColumnNames_t fColumnNames
Definition: RActionBase.hxx:53
virtual void ClearValueReaders(unsigned int slot)=0
const unsigned int fNSlots
Number of thread slots used by this node.
Definition: RActionBase.hxx:51
RActionBase & operator=(const RActionBase &)=delete
virtual void TriggerChildrenCount()=0
RActionBase(RLoopManager *lm, const ColumnNames_t &colNames, RBookedCustomColumns &&customColumns)
Definition: RActionBase.cxx:16
unsigned int GetNSlots() const
Definition: RActionBase.hxx:66
virtual void Run(unsigned int slot, Long64_t entry)=0
const ColumnNames_t & GetColumnNames() const
Definition: RActionBase.hxx:63
virtual void FinalizeSlot(unsigned int)=0
RActionBase(const RActionBase &)=delete
virtual bool HasRun() const
Definition: RActionBase.hxx:79
virtual void * PartialUpdate(unsigned int slot)=0
This method is invoked to update a partial result during the event loop, right before passing the res...
virtual std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > GetGraph()=0
RBookedCustomColumns fCustomColumns
Definition: RActionBase.hxx:55
RLoopManager * fLoopManager
A raw pointer to the RLoopManager at the root of this functional graph.
Definition: RActionBase.hxx:48
virtual void InitSlot(TTreeReader *r, unsigned int slot)=0
RBookedCustomColumns & GetCustomColumns()
Definition: RActionBase.hxx:64
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:44
bool CheckIfDefaultOrDSColumn(const std::string &name, const std::shared_ptr< ROOT::Detail::RDF::RCustomColumnBase > &column)
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
ROOT::Detail::RDF::ColumnNames_t ColumnNames_t
Definition: RDataFrame.cxx:788