From 170a366a4b0622f224fc11b2e4835540047e0aa5 Mon Sep 17 00:00:00 2001
From: Enrico Guiraud <enrico.guiraud@cern.ch>
Date: Wed, 10 May 2017 14:56:55 +0200
Subject: [PATCH] [TDF] Move TDataFrame{,Interface} to Experimental::TDF

---
 tree/treeplayer/inc/DataFrameLinkDef.h           |  6 +++---
 tree/treeplayer/inc/ROOT/TDataFrame.hxx          | 10 ++++------
 tree/treeplayer/inc/ROOT/TDataFrameInterface.hxx | 15 ++++++++-------
 tree/treeplayer/src/TDataFrame.cxx               | 14 ++++----------
 tree/treeplayer/src/TDataFrameInterface.cxx      | 15 ++++++---------
 5 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/tree/treeplayer/inc/DataFrameLinkDef.h b/tree/treeplayer/inc/DataFrameLinkDef.h
index 84d308f253d..360a4e43fd9 100644
--- a/tree/treeplayer/inc/DataFrameLinkDef.h
+++ b/tree/treeplayer/inc/DataFrameLinkDef.h
@@ -9,9 +9,9 @@
 #ifdef __ROOTCLING__
 
 // All these are there for the autoloading
-#pragma link C++ class ROOT::Experimental::TDataFrame-;
-#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>-;
-#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>-;
+#pragma link C++ class ROOT::Experimental::TDF::TDataFrame-;
+#pragma link C++ class ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>-;
+#pragma link C++ class ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>-;
 #pragma link C++ class ROOT::Detail::TDataFrameImpl-;
 
 #endif
diff --git a/tree/treeplayer/inc/ROOT/TDataFrame.hxx b/tree/treeplayer/inc/ROOT/TDataFrame.hxx
index ca702c8ee40..b2a466c9297 100644
--- a/tree/treeplayer/inc/ROOT/TDataFrame.hxx
+++ b/tree/treeplayer/inc/ROOT/TDataFrame.hxx
@@ -30,13 +30,9 @@ class TTree;
 
 R__LOAD_LIBRARY(libTreePlayer)
 
-namespace cling {
-// TDataFrame pretty-printing
-std::string printValue(ROOT::Experimental::TDataFrame *tdf);
-}
-
 namespace ROOT {
 namespace Experimental {
+namespace TDF {
 
 class TDataFrame : public TDataFrameInterface<ROOT::Detail::TDataFrameImpl> {
 public:
@@ -50,7 +46,7 @@ public:
    ///
    /// The default branches are looked at in case no branch is specified in the
    /// booking of actions or transformations.
-   /// See ROOT::Experimental::TDataFrameInterface for the documentation of the
+   /// See TDataFrameInterface for the documentation of the
    /// methods available.
    template <
       typename FILENAMESCOLL,
@@ -74,6 +70,8 @@ TDataFrame::TDataFrame(const std::string &treeName, const FILENAMESCOLL &filenam
    fProxiedPtr->SetTree(std::make_shared<TTree>(static_cast<TTree *>(chain)));
 }
 
+} // end NS TDF
+using TDF::TDataFrame; // let users access TDataFrame as ROOT::Experimental::TDataFrame
 } // end NS Experimental
 } // end NS ROOT
 
diff --git a/tree/treeplayer/inc/ROOT/TDataFrameInterface.hxx b/tree/treeplayer/inc/ROOT/TDataFrameInterface.hxx
index f24b8d82713..43f53b46717 100644
--- a/tree/treeplayer/inc/ROOT/TDataFrameInterface.hxx
+++ b/tree/treeplayer/inc/ROOT/TDataFrameInterface.hxx
@@ -61,13 +61,13 @@ void JitBuildAndBook(const BranchNames_t &bl, const std::string &nodeTypename, v
 } // namespace Internal
 
 namespace Experimental {
-using namespace ROOT::Experimental::TDF; //TODO delete line
+namespace TDF {
 
 // forward declarations
 class TDataFrame;
 
 /**
-* \class ROOT::Experimental::TDataFrameInterface
+* \class ROOT::Experimental::TDF::TDataFrameInterface
 * \ingroup dataframe
 * \brief The public interface to the TDataFrame federation of classes: TDataFrameImpl, TDataFrameFilter,
 * TDataFrameBranch
@@ -76,7 +76,7 @@ class TDataFrame;
 */
 template <typename Proxied>
 class TDataFrameInterface {
-   friend std::string cling::printValue(ROOT::Experimental::TDataFrame *tdf); // For a nice printing at the prompt
+   friend std::string cling::printValue(ROOT::Experimental::TDF::TDataFrame *tdf); // For a nice printing at the prompt TODO try using unqualified TDataFrame name
    template <typename T>
    friend class TDataFrameInterface;
    template <typename TDFNode, typename ActionType, typename... BranchTypes, typename ActionResultType>
@@ -1127,31 +1127,32 @@ protected:
 template <>
 inline const char *TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>::GetNodeTypeName()
 {
-   return "ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>";
+   return "ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>";
 }
 
 template <>
 inline const char *TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>::GetNodeTypeName()
 {
-   return "ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>";
+   return "ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>";
 }
 
 template <>
 inline const char *TDataFrameInterface<ROOT::Detail::TDataFrameImpl>::GetNodeTypeName()
 {
-   return "ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameImpl>";
+   return "ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameImpl>";
 }
 
 template <>
 inline const char *TDataFrameInterface<ROOT::Detail::TDataFrameRangeBase>::GetNodeTypeName()
 {
-   return "ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameRangeBase>";
+   return "ROOT::Experimental::TDF::TDataFrameInterface<ROOT::Detail::TDataFrameRangeBase>";
 }
 
 // Before we had to specialise the GetNodeTypeName method
 // extern template class TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>;
 // extern template class TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>;
 
+} // end NS TDF
 } // end NS Experimental
 } // end NS ROOT
 
diff --git a/tree/treeplayer/src/TDataFrame.cxx b/tree/treeplayer/src/TDataFrame.cxx
index f8ff0c03d68..e2a5d446276 100644
--- a/tree/treeplayer/src/TDataFrame.cxx
+++ b/tree/treeplayer/src/TDataFrame.cxx
@@ -9,9 +9,7 @@
  *************************************************************************/
 
 #include "ROOT/TDataFrame.hxx"
-
-namespace ROOT {
-namespace Experimental {
+using namespace ROOT::Experimental::TDF;
 
 /**
 * \class ROOT::Experimental::TDataFrame
@@ -502,7 +500,7 @@ thread-safety, see [here](#generic-actions).
 ///
 /// The default branches are looked at in case no branch is specified in the
 /// booking of actions or transformations.
-/// See ROOT::Experimental::TDataFrameInterface for the documentation of the
+/// See TDataFrameInterface for the documentation of the
 /// methods available.
 TDataFrame::TDataFrame(const std::string &treeName, TDirectory *dirPtr, const BranchNames_t &defaultBranches)
    : TDataFrameInterface<ROOT::Detail::TDataFrameImpl>(
@@ -528,7 +526,7 @@ TDataFrame::TDataFrame(const std::string &treeName, TDirectory *dirPtr, const Br
 ///
 /// The default branches are looked at in case no branch is specified in the
 /// booking of actions or transformations.
-/// See ROOT::Experimental::TDataFrameInterface for the documentation of the
+/// See TDataFrameInterface for the documentation of the
 /// methods available.
 TDataFrame::TDataFrame(const std::string &treeName, const std::string &filenameglob,
                        const BranchNames_t &defaultBranches)
@@ -547,7 +545,7 @@ TDataFrame::TDataFrame(const std::string &treeName, const std::string &filenameg
 ///
 /// The default branches are looked at in case no branch is specified in the
 /// booking of actions or transformations.
-/// See ROOT::Experimental::TDataFrameInterface for the documentation of the
+/// See TDataFrameInterface for the documentation of the
 /// methods available.
 TDataFrame::TDataFrame(TTree &tree, const BranchNames_t &defaultBranches)
    : TDataFrameInterface<ROOT::Detail::TDataFrameImpl>(
@@ -567,7 +565,3 @@ TDataFrame::TDataFrame(Long64_t numEntries)
         std::make_shared<ROOT::Detail::TDataFrameImpl>(numEntries))
 {
 }
-
-} // end NS Experimental
-
-} // end NS ROOT
diff --git a/tree/treeplayer/src/TDataFrameInterface.cxx b/tree/treeplayer/src/TDataFrameInterface.cxx
index f1733e5efca..3f0c775c88c 100644
--- a/tree/treeplayer/src/TDataFrameInterface.cxx
+++ b/tree/treeplayer/src/TDataFrameInterface.cxx
@@ -15,9 +15,14 @@
 
 #include <vector>
 #include <string>
+using namespace ROOT::Experimental::TDF;
 
-namespace ROOT {
+// extern templates
+template class TDataFrameInterface<ROOT::Detail::TDataFrameImpl>;
+template class TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>;
+template class TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>;
 
+namespace ROOT {
 namespace Internal {
 // Match expression against names of branches passed as parameter
 // Return vector of names of the branches used in the expression
@@ -217,12 +222,4 @@ void JitBuildAndBook(const BranchNames_t &bl, const std::string &nodeTypename, v
 }
 } // namespace Internal
 
-namespace Experimental {
-
-// extern templates
-template class TDataFrameInterface<ROOT::Detail::TDataFrameImpl>;
-template class TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>;
-template class TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>;
-
-} // namespace Experimental
 } // namespace ROOT
-- 
GitLab