Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
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#include "TError.h" // R__ASSERT
16
17#include <memory>
18#include <string>
19#include <vector>
20#include <unordered_map>
21
22namespace ROOT {
23namespace RDF {
24class RCutFlowReport;
25}
26
27namespace Internal {
28namespace RDF {
29namespace GraphDrawing {
30class GraphNode;
31}
32}
33}
34
35namespace Detail {
36namespace RDF {
37
38class RLoopManager;
39
40/// Base class for non-leaf nodes of the computational graph.
41/// It only exposes the bare minimum interface required to work as a generic part of the computation graph.
42/// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::RNode (or ROOT.RDF.AsRNode in PyROOT).
43class RNodeBase {
44protected:
46 unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object
47 unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries.
48 std::vector<std::string> fVariations; ///< List of systematic variations that affect this node.
49
50public:
51 RNodeBase(const std::vector<std::string> &variations = {}, RLoopManager *lm = nullptr)
52 : fLoopManager(lm), fVariations(variations)
53 {
54 }
55
56 // Rule of five
57 RNodeBase(const RNodeBase &) = delete;
58 RNodeBase &operator=(const RNodeBase &) = delete;
59 RNodeBase(RNodeBase &&) = delete;
61 virtual ~RNodeBase() = default;
62
63 virtual bool CheckFilters(unsigned int, Long64_t) = 0;
64 virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0;
65 virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0;
66 virtual void IncrChildrenCount() = 0;
67 virtual void StopProcessing() = 0;
68 virtual void AddFilterName(std::vector<std::string> &filters) = 0;
69 // Helper function for SaveGraph
70 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>
71 GetGraph(std::unordered_map<void *, std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>> &visitedMap) = 0;
72
73 virtual void ResetChildrenCount()
74 {
75 fNChildren = 0;
77 }
78
80
81 const std::vector<std::string> &GetVariations() const { return fVariations; }
82
83 /// Return a clone of this node that acts as a Filter working with values in the variationName "universe".
84 virtual std::shared_ptr<RNodeBase> GetVariedFilter(const std::string & /*variationName*/)
85 {
86 R__ASSERT(false &&
87 "GetVariedFilter was called on a node type that does not implement it. This should never happen.");
88 return nullptr;
89 }
90};
91} // ns RDF
92} // ns Detail
93} // ns ROOT
94
95#endif
long long Long64_t
Definition RtypesCore.h:69
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
const char * filters[]
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
Definition RNodeBase.hxx:43
const std::vector< std::string > & GetVariations() const
Definition RNodeBase.hxx:81
virtual void AddFilterName(std::vector< std::string > &filters)=0
RNodeBase & operator=(const RNodeBase &)=delete
virtual ~RNodeBase()=default
virtual void StopProcessing()=0
virtual RLoopManager * GetLoopManagerUnchecked()
Definition RNodeBase.hxx:79
virtual bool CheckFilters(unsigned int, Long64_t)=0
virtual void IncrChildrenCount()=0
RNodeBase(RNodeBase &&)=delete
virtual std::shared_ptr< RNodeBase > GetVariedFilter(const std::string &)
Return a clone of this node that acts as a Filter working with values in the variationName "universe"...
Definition RNodeBase.hxx:84
unsigned int fNStopsReceived
Number of times that a children node signaled to stop processing entries.
Definition RNodeBase.hxx:47
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:46
virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const =0
RNodeBase(const std::vector< std::string > &variations={}, RLoopManager *lm=nullptr)
Definition RNodeBase.hxx:51
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:73
std::vector< std::string > fVariations
List of systematic variations that affect this node.
Definition RNodeBase.hxx:48
RNodeBase(const RNodeBase &)=delete
RNodeBase & operator=(RNodeBase &&)=delete
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...