[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Fri Apr 8 18:45:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/a3db0e1c317c
branches:  
changeset: 5112:a3db0e1c317c
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Apr 08 18:16:35 2016 +0100
description:
AnalysisInfo factory gives unique_ptr

details:   https://rivet.hepforge.org/hg/rivet/rev/0b6ecc342a2f
branches:  
changeset: 5113:0b6ecc342a2f
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Apr 08 18:30:28 2016 +0100
description:
Analysis is sole owner of AnalysisInfo -> unique_ptr

diffs (truncated from 80 to 50 lines):

--- a/include/Rivet/Analysis.hh	Thu Apr 07 16:26:03 2016 +0100
+++ b/include/Rivet/Analysis.hh	Fri Apr 08 18:30:28 2016 +0100
@@ -102,7 +102,7 @@
 
     /// Get the actual AnalysisInfo object in which all this metadata is stored.
     const AnalysisInfo& info() const {
-      assert(_info.get() != 0 && "No AnalysisInfo object :O");
+      assert(_info && "No AnalysisInfo object :O");
       return *_info;
     }
 
@@ -244,7 +244,7 @@
 
     /// Get the actual AnalysisInfo object in which all this metadata is stored (non-const).
     AnalysisInfo& info() {
-      assert(_info.get() != 0 && "No AnalysisInfo object :O");
+      assert(_info && "No AnalysisInfo object :O");
       return *_info;
     }
 
@@ -886,7 +886,7 @@
     string _defaultname;
 
     /// Pointer to analysis metadata object
-    std::shared_ptr<AnalysisInfo> _info;
+    unique_ptr<AnalysisInfo> _info;
 
     /// Storage of all plot objects
     /// @todo Make this a map for fast lookup by path?
--- a/include/Rivet/AnalysisInfo.hh	Thu Apr 07 16:26:03 2016 +0100
+++ b/include/Rivet/AnalysisInfo.hh	Fri Apr 08 18:30:28 2016 +0100
@@ -12,7 +12,7 @@
   public:
 
     /// Static factory method: returns null pointer if no metadata found
-    static AnalysisInfo* make(const std::string& name);
+    static unique_ptr<AnalysisInfo> make(const std::string& name);
 
     /// @name Standard constructors and destructors.
     //@{
--- a/src/Core/Analysis.cc	Thu Apr 07 16:26:03 2016 +0100
+++ b/src/Core/Analysis.cc	Fri Apr 08 18:30:28 2016 +0100
@@ -18,10 +18,10 @@
     ProjectionApplier::_allowProjReg = false;
     _defaultname = name;
 
-    AnalysisInfo* ai = AnalysisInfo::make(name);
-    assert(ai != 0);
-    _info.reset(ai);
-    assert(_info.get() != 0);


More information about the Rivet-svn mailing list