|
[Rivet-svn] r2956 - trunk/include/Rivet/Toolsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Feb 22 23:42:11 GMT 2011
Author: buckley Date: Tue Feb 22 23:42:11 2011 New Revision: 2956 Log: Adding optional prepend and append path list args to the path searching functions Modified: trunk/include/Rivet/Tools/RivetPaths.hh trunk/include/Rivet/Tools/Utils.hh Modified: trunk/include/Rivet/Tools/RivetPaths.hh ============================================================================== --- trunk/include/Rivet/Tools/RivetPaths.hh Tue Feb 22 23:41:30 2011 (r2955) +++ trunk/include/Rivet/Tools/RivetPaths.hh Tue Feb 22 23:42:11 2011 (r2956) @@ -47,21 +47,27 @@ /// @brief Find the first file of the given name in the ref data file search dirs /// @note If none found, returns an empty string - std::string findAnalysisRefFile(const std::string& filename); + std::string findAnalysisRefFile(const std::string& filename, + const std::vector<std::string>& pathprepend=std::vector<std::string>(), + const std::vector<std::string>& pathappend=std::vector<std::string>()); /// Get Rivet analysis info metadata search paths std::vector<std::string> getAnalysisInfoPaths(); /// @brief Find the first file of the given name in the analysis info file search dirs /// @note If none found, returns an empty string - std::string findAnalysisInfoFile(const std::string& filename); + std::string findAnalysisInfoFile(const std::string& filename, + const std::vector<std::string>& pathprepend=std::vector<std::string>(), + const std::vector<std::string>& pathappend=std::vector<std::string>()); /// Get Rivet analysis plot style search paths std::vector<std::string> getAnalysisPlotPaths(); /// @brief Find the first file of the given name in the analysis plot file search dirs /// @note If none found, returns an empty string - std::string findAnalysisPlotFile(const std::string& filename); + std::string findAnalysisPlotFile(const std::string& filename, + const std::vector<std::string>& pathprepend=std::vector<std::string>(), + const std::vector<std::string>& pathappend=std::vector<std::string>()); //@} Modified: trunk/include/Rivet/Tools/Utils.hh ============================================================================== --- trunk/include/Rivet/Tools/Utils.hh Tue Feb 22 23:41:30 2011 (r2955) +++ trunk/include/Rivet/Tools/Utils.hh Tue Feb 22 23:42:11 2011 (r2956) @@ -109,10 +109,40 @@ } template <typename T> - inline void operator+=(vector<T>& s1, const vector<T>& s2) { - for (typename vector<T>::const_iterator s = s2.begin(); s != s2.end(); ++s) { - s1.push_back(*s); + inline set<T> operator+(const set<T>& s1, const set<T>& s2) { + set<T> rtn(s1); + rtn += s2; + return rtn; + } + + template <typename T> + inline string join(const set<T>& s, const string& sep = " ") { + stringstream out; + bool first = false; + for (typename set<T>::const_iterator it = s.begin(); it != s.end(); ++it) { + if (first) { + first = false; + } else { + out << sep; + } + out << *it; } + return out.str(); + } + + + template <typename T> + inline void operator+=(vector<T>& v1, const vector<T>& v2) { + for (typename vector<T>::const_iterator s = v2.begin(); s != v2.end(); ++s) { + v1.push_back(*s); + } + } + + template <typename T> + inline vector<T> operator+(const vector<T>& v1, const vector<T>& v2) { + vector<T> rtn(v1); + rtn += v2; + return rtn; } template <typename T>
More information about the Rivet-svn mailing list |