[yoda-svn] yoda: 2 new changesets

YODA Mercurial yoda at projects.hepforge.org
Sun Nov 22 15:15:01 GMT 2015


details:   https://yoda.hepforge.org/hg/yoda/rev/b36a514ad39f
branches:  
changeset: 1177:b36a514ad39f
user:      Andy Buckley <andy at insectnation.org>
date:      Sun Nov 22 13:30:42 2015 +0000
description:
Fixes to annotation/path copying in ROOT -> YODA conversion

details:   https://yoda.hepforge.org/hg/yoda/rev/b0fba2cae010
branches:  
changeset: 1178:b0fba2cae010
user:      Andy Buckley <andy at insectnation.org>
date:      Sun Nov 22 15:05:53 2015 +0000
description:
Make AO path setting and retrieval prepend a leading slash if it is missing (unless the path is completely empty).

diffs (truncated from 88 to 50 lines):

--- a/ChangeLog	Sat Nov 21 21:46:04 2015 +0000
+++ b/ChangeLog	Sun Nov 22 15:05:53 2015 +0000
@@ -1,6 +1,11 @@
+2015-11-22  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Make AO path setting and retrieval prepend a leading slash if it
+	is missing (unless the path is completely empty).
+
 2015-11-21  Andy Buckley  <andy.buckley at cern.ch>
 
-	* Add root2yoda (slow) function.
+	* Add root2yoda conversion script.
 
 	* Deprecating yoda.to_root() in favour of yoda.root module, which
 	contains to_root and to_yoda functions, as well as a ROOT file
--- a/include/YODA/AnalysisObject.h	Sat Nov 21 21:46:04 2015 +0000
+++ b/include/YODA/AnalysisObject.h	Sun Nov 22 15:05:53 2015 +0000
@@ -185,8 +185,9 @@
     /// @name Standard annotations
     //@{
 
-    /// Get the AO title.
-    /// Returns a null string if undefined, rather than throwing an exception cf. the Title annotation.
+    /// @brief Get the AO title.
+    ///
+    /// Returns a null string if undefined, rather than throwing an exception cf. the annotation("Title").
     const std::string title() const {
       try {
         return annotation("Title");
@@ -200,22 +201,27 @@
       setAnnotation("Title", title);
     }
 
-    /// Get the AO path.
-    /// Returns a null string if undefined, rather than throwing an exception cf. the Title annotation.
+    /// @brief Get the AO path.
+    ///
+    /// Returns a null string if undefined, rather than throwing an exception cf. annotation("Path").
     const std::string path() const {
       try {
-        return annotation("Path");
+        const std::string p = annotation("Path");
+        return p.find("/") == 0 ? p : "/"+p; ///< @note A leading / will be prepended if not already set.
       } catch (AnnotationError& ae) {
         return "";
       }
     }
 
     /// Set the AO path
+    ///


More information about the yoda-svn mailing list