Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RNodeBase.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_RDFNODEBASE
12 #define ROOT_RDFNODEBASE
13 
14 #include "RtypesCore.h"
15 
16 #include <memory>
17 #include <string>
18 #include <vector>
19 
20 namespace ROOT {
21 namespace RDF {
22 class RCutFlowReport;
23 }
24 
25 namespace Internal {
26 namespace RDF {
27 namespace GraphDrawing {
28 class GraphNode;
29 }
30 }
31 }
32 
33 namespace Detail {
34 namespace RDF {
35 
36 class RLoopManager;
37 
38 /// Base class for non-leaf nodes of the computational graph.
39 /// It only exposes the bare minimum interface required to work as a generic part of the computation graph.
40 /// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::ToCommonNodeType.
41 class RNodeBase {
42 protected:
43  RLoopManager *fLoopManager;
44  unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object
45  unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries.
46 
47 public:
48  RNodeBase(RLoopManager *lm = nullptr) : fLoopManager(lm) {}
49  virtual ~RNodeBase() {}
50  virtual bool CheckFilters(unsigned int, Long64_t) = 0;
51  virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0;
52  virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0;
53  virtual void IncrChildrenCount() = 0;
54  virtual void StopProcessing() = 0;
55  virtual void AddFilterName(std::vector<std::string> &filters) = 0;
56  virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0;
57 
58  virtual void ResetChildrenCount()
59  {
60  fNChildren = 0;
61  fNStopsReceived = 0;
62  }
63 
64  virtual RLoopManager *GetLoopManagerUnchecked() { return fLoopManager; }
65 };
66 } // ns RDF
67 } // ns Detail
68 } // ns ROOT
69 
70 #endif