Logo ROOT  
Reference Guide
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#include <unordered_map>
20
21namespace ROOT {
22namespace RDF {
23class RCutFlowReport;
24}
25
26namespace Internal {
27namespace RDF {
28namespace GraphDrawing {
29class GraphNode;
30}
31}
32}
33
34namespace Detail {
35namespace RDF {
36
37class RLoopManager;
38
39/// Base class for non-leaf nodes of the computational graph.
40/// It only exposes the bare minimum interface required to work as a generic part of the computation graph.
41/// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::RNode (or ROOT.RDF.AsRNode in PyROOT).
42class RNodeBase {
43protected:
45 unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object
46 unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries.
47
48public:
49 RNodeBase(RLoopManager *lm = nullptr) : fLoopManager(lm) {}
50 virtual ~RNodeBase() {}
51 virtual bool CheckFilters(unsigned int, Long64_t) = 0;
52 virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0;
53 virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0;
54 virtual void IncrChildrenCount() = 0;
55 virtual void StopProcessing() = 0;
56 virtual void AddFilterName(std::vector<std::string> &filters) = 0;
57 // Helper function for SaveGraph
58 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>
59 GetGraph(std::unordered_map<void *, std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>> &visitedMap) = 0;
60
61 virtual void ResetChildrenCount()
62 {
63 fNChildren = 0;
65 }
66
68};
69} // ns RDF
70} // ns Detail
71} // ns ROOT
72
73#endif
long long Long64_t
Definition: RtypesCore.h:80
const char * filters[]
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
Definition: RNodeBase.hxx:42
RNodeBase(RLoopManager *lm=nullptr)
Definition: RNodeBase.hxx:49
virtual void AddFilterName(std::vector< std::string > &filters)=0
virtual void StopProcessing()=0
virtual RLoopManager * GetLoopManagerUnchecked()
Definition: RNodeBase.hxx:67
virtual bool CheckFilters(unsigned int, Long64_t)=0
virtual void IncrChildrenCount()=0
unsigned int fNStopsReceived
Number of times that a children node signaled to stop processing entries.
Definition: RNodeBase.hxx:46
virtual void Report(ROOT::RDF::RCutFlowReport &) const =0
unsigned int fNChildren
Number of nodes of the functional graph hanging from this object.
Definition: RNodeBase.hxx:45
virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const =0
virtual std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > GetGraph(std::unordered_map< void *, std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > > &visitedMap)=0
virtual void ResetChildrenCount()
Definition: RNodeBase.hxx:61
RLoopManager * fLoopManager
Definition: RNodeBase.hxx:44
Class used to create the operation graph to be printed in the dot representation.
Definition: GraphNode.hxx:26
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.