From f91c4d1067a0f1b22b1e21069b951d4311f552f5 Mon Sep 17 00:00:00 2001 From: Enrico Guiraud <enrico.guiraud@cern.ch> Date: Tue, 4 Sep 2018 19:30:47 +0200 Subject: [PATCH] [DF] Move RNodeBase to its on header file --- tree/dataframe/inc/ROOT/RDFNodes.hxx | 35 +------------- tree/dataframe/inc/ROOT/RNodeBase.hxx | 68 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 33 deletions(-) create mode 100644 tree/dataframe/inc/ROOT/RNodeBase.hxx diff --git a/tree/dataframe/inc/ROOT/RDFNodes.hxx b/tree/dataframe/inc/ROOT/RDFNodes.hxx index bfcfe43d3d1..2ba68f27834 100644 --- a/tree/dataframe/inc/ROOT/RDFNodes.hxx +++ b/tree/dataframe/inc/ROOT/RDFNodes.hxx @@ -13,6 +13,7 @@ #include "ROOT/RCutFlowReport.hxx" #include "ROOT/RDataSource.hxx" +#include "ROOT/RNodeBase.hxx" #include "ROOT/RDFNodesUtils.hxx" #include "ROOT/RDFBookedCustomColumns.hxx" #include "ROOT/RDFUtils.hxx" @@ -46,6 +47,7 @@ class RResultPtr; namespace Internal { namespace RDF { +// forward declarations for RLoopManager class RActionBase; class GraphCreatorHelper; } // ns RDF @@ -53,8 +55,6 @@ class GraphCreatorHelper; namespace Detail { namespace RDF { -class RCustomColumnBase; - using namespace ROOT::TypeTraits; namespace RDFInternal = ROOT::Internal::RDF; @@ -63,37 +63,6 @@ class RCustomColumnBase; class RFilterBase; class RRangeBase; -class RLoopManager; - -/// Base class for non-leaf nodes of the computational graph. -/// It only exposes the bare minimum interface required to work as a generic part of the computation graph. -/// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::ToCommonNodeType. -class RNodeBase { -protected: - RLoopManager *fLoopManager; - unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object - unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries. - -public: - RNodeBase(RLoopManager *lm = nullptr) : fLoopManager(lm) {} - virtual ~RNodeBase() {} - virtual bool CheckFilters(unsigned int, Long64_t) = 0; - virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0; - virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0; - virtual void IncrChildrenCount() = 0; - virtual void StopProcessing() = 0; - virtual void AddFilterName(std::vector<std::string> &filters) = 0; - virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0; - - virtual void ResetChildrenCount() - { - fNChildren = 0; - fNStopsReceived = 0; - } - - virtual RLoopManager *GetLoopManagerUnchecked() { return fLoopManager; } -}; - class RLoopManager : public RNodeBase { friend class ROOT::Internal::RDF::GraphDrawing::GraphCreatorHelper; using RDataSource = ROOT::RDF::RDataSource; diff --git a/tree/dataframe/inc/ROOT/RNodeBase.hxx b/tree/dataframe/inc/ROOT/RNodeBase.hxx new file mode 100644 index 00000000000..4318bcdbe1b --- /dev/null +++ b/tree/dataframe/inc/ROOT/RNodeBase.hxx @@ -0,0 +1,68 @@ +// Author: Enrico Guiraud, Danilo Piparo CERN 09/2018 + +/************************************************************************* + * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_RDFNODEBASE +#define ROOT_RDFNODEBASE + +#include <memory> +#include <string> +#include <vector> + +namespace ROOT { +namespace RDF { +class RCutFlowReport; +} + +namespace Internal { +namespace RDF { +namespace GraphDrawing { +class GraphNode; +} +} +} + +namespace Detail { +namespace RDF { + +class RLoopManager; + +/// Base class for non-leaf nodes of the computational graph. +/// It only exposes the bare minimum interface required to work as a generic part of the computation graph. +/// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::ToCommonNodeType. +class RNodeBase { +protected: + RLoopManager *fLoopManager; + unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object + unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries. + +public: + RNodeBase(RLoopManager *lm = nullptr) : fLoopManager(lm) {} + virtual ~RNodeBase() {} + virtual bool CheckFilters(unsigned int, Long64_t) = 0; + virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0; + virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0; + virtual void IncrChildrenCount() = 0; + virtual void StopProcessing() = 0; + virtual void AddFilterName(std::vector<std::string> &filters) = 0; + virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0; + + virtual void ResetChildrenCount() + { + fNChildren = 0; + fNStopsReceived = 0; + } + + virtual RLoopManager *GetLoopManagerUnchecked() { return fLoopManager; } +}; +} // ns RDF +} // ns Detail +} // ns ROOT + +#endif -- GitLab