[yoda-svn] yoda: Add static Reader methods to match the Writer ones.

YODA Mercurial yoda at projects.hepforge.org
Tue May 2 15:00:02 BST 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/ab0149a04682
branches:  release-1-6
changeset: 1335:ab0149a04682
user:      Andy Buckley <andy at insectnation.org>
date:      Tue May 02 12:29:45 2017 +0100
description:
Add static Reader methods to match the Writer ones.

diffs (truncated from 180 to 50 lines):

--- a/ChangeLog	Mon Apr 03 14:17:52 2017 +0100
+++ b/ChangeLog	Tue May 02 12:29:45 2017 +0100
@@ -1,9 +1,13 @@
+2017-05-02  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add static Reader methods to match the Writer ones.
+
 2017-02-23  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Fix Histo2D and Profile2D total distribution reading from YODA format.
 
 2017-02-19  Holger Schulz <holger.schulz at durham.ac.uk>
-	
+
 	* Convert TH1F to TH1D in root2flat. Much simpler than duplicating
         the TH1D stuff in pyext.
 
--- a/include/YODA/Makefile.am	Mon Apr 03 14:17:52 2017 +0100
+++ b/include/YODA/Makefile.am	Tue May 02 12:29:45 2017 +0100
@@ -21,6 +21,7 @@
     YODA.h IO.h ROOTCnv.h
 
 nobase_pkginclude_HEADERS = \
+	ReaderMethods.icc \
 	WriterMethods.icc \
 	Utils/StringUtils.h \
 	Utils/MathUtils.h \
--- a/include/YODA/Reader.h	Mon Apr 03 14:17:52 2017 +0100
+++ b/include/YODA/Reader.h	Tue May 02 12:29:45 2017 +0100
@@ -32,18 +32,17 @@
     ///
     /// This version fills (actually, appends to) a variable supplied container
     /// Note: SFINAE is used to check for a void push_back(const AnalysisObject*) method
+    ///
+    /// @todo Extend SFINAE Pushable cf. Writer to allow adding to containers of smart ptr type
     template<typename CONT>
     typename std::enable_if<YODA::Pushable<CONT,AnalysisObject*>::value>::type
     read(std::istream& stream, CONT& aos) {
-      //if CONT==std::vector<AnalysisObject*>, the compiler should select
-      //the virtual method below, since it prefers non-templated methods in the lookup
-      //otherwise we would enter a endless recursion. Check in case of problems.
+      // if CONT==std::vector<AnalysisObject*>, the compiler should select
+      // the virtual method below, since it prefers non-templated methods in the lookup
+      // otherwise we would enter a endless recursion. Check in case of problems.
       std::vector<AnalysisObject*> v_aos;
-      read(stream,v_aos);
-      std::vector<AnalysisObject*>::const_iterator it = v_aos.begin();
-      for(it = v_aos.begin(); it!=v_aos.end(); ++it){
-        aos.push_back(*it);
-      }


More information about the yoda-svn mailing list