Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RActionBase.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 09/2018
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_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 RDefineBase;
27class RMergeableValueBase;
28} // namespace RDF
29} // namespace Detail
30
31namespace Internal {
32namespace RDF {
33namespace GraphDrawing {
34class GraphNode;
35}
36
37using namespace ROOT::Detail::RDF;
38
40protected:
41 /// A raw pointer to the RLoopManager at the root of this functional graph.
42 /// Never null: children nodes have shared ownership of parent nodes in the graph.
44
45private:
46 const unsigned int fNSlots; ///< Number of thread slots used by this node.
47 bool fHasRun = false;
49
51
52public:
53 RActionBase(RLoopManager *lm, const ColumnNames_t &colNames, const RBookedDefines &defines);
54 RActionBase(const RActionBase &) = delete;
55 RActionBase &operator=(const RActionBase &) = delete;
56 virtual ~RActionBase();
57
58 const ColumnNames_t &GetColumnNames() const { return fColumnNames; }
61 unsigned int GetNSlots() const { return fNSlots; }
62 virtual void Run(unsigned int slot, Long64_t entry) = 0;
63 virtual void Initialize() = 0;
64 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
65 virtual void TriggerChildrenCount() = 0;
66 virtual void FinalizeSlot(unsigned int) = 0;
67 virtual void Finalize() = 0;
68 /// This method is invoked to update a partial result during the event loop, right before passing the result to a
69 /// user-defined callback registered via RResultPtr::RegisterCallback
70 virtual void *PartialUpdate(unsigned int slot) = 0;
71
72 // overridden by RJittedAction
73 virtual bool HasRun() const { return fHasRun; }
74 virtual void SetHasRun() { fHasRun = true; }
75
76 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0;
77
78 /**
79 Retrieve a wrapper to the result of the action that knows how to merge
80 with others of the same type.
81 */
82 virtual std::unique_ptr<RMergeableValueBase> GetMergeableValue() const = 0;
83
84 virtual std::function<void(unsigned int)> GetDataBlockCallback() = 0;
85};
86} // namespace RDF
87} // namespace Internal
88} // namespace ROOT
89
90#endif // ROOT_RACTIONBASE
ROOT::R::TRInterface & r
Definition Object.C:4
long long Long64_t
Definition RtypesCore.h:73
typedef void((*Func_t)())
The head node of a RDF computation graph.
Class used to create the operation graph to be printed in the dot representation.
const ColumnNames_t fColumnNames
virtual std::function< void(unsigned int)> GetDataBlockCallback()=0
const unsigned int fNSlots
Number of thread slots used by this node.
RActionBase & operator=(const RActionBase &)=delete
virtual std::unique_ptr< RMergeableValueBase > GetMergeableValue() const =0
Retrieve a wrapper to the result of the action that knows how to merge with others of the same type.
virtual void TriggerChildrenCount()=0
unsigned int GetNSlots() const
virtual void Run(unsigned int slot, Long64_t entry)=0
const ColumnNames_t & GetColumnNames() const
virtual void FinalizeSlot(unsigned int)=0
RActionBase(const RActionBase &)=delete
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
RLoopManager * fLoopManager
A raw pointer to the RLoopManager at the root of this functional graph.
virtual void InitSlot(TTreeReader *r, unsigned int slot)=0
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
std::vector< std::string > ColumnNames_t
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...