From 932ac4eb310826101b4323b3910bb68369bcb2fc Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 18 Nov 2020 23:01:43 +0100 Subject: [PATCH] duplicate StringUtils to decouple Fit from Device --- Base/Utils/StringUtils.cpp | 96 +++++++++++++++++++ Base/Utils/StringUtils.h | 61 ++++++++++++ Core/Fitting/FitPrintService.cpp | 2 +- Core/Simulation/ISimulation.cpp | 2 +- Device/InputOutput/DataFormatUtils.cpp | 2 +- Device/Instrument/PyFmt2.cpp | 2 +- Fit/Minimizer/MinimizerOptions.cpp | 4 +- .../GSLLevenbergMarquardtMinimizer.cpp | 2 +- Fit/RootAdapter/Minuit2Minimizer.cpp | 2 +- Fit/RootAdapter/RootMinimizerAdapter.cpp | 2 +- Fit/Tools/StringUtils.cpp | 31 +----- Fit/Tools/StringUtils.h | 19 ++-- Param/Base/ParameterPool.cpp | 2 +- .../GUI/Translate/GUITranslationTest.cpp | 2 +- Tests/UnitTests/Fit/StringUtilsTest.cpp | 4 +- auto/Wrap/doxygenBase.i | 50 ++++++++++ auto/Wrap/doxygenFit.i | 62 +++++------- 17 files changed, 256 insertions(+), 89 deletions(-) create mode 100644 Base/Utils/StringUtils.cpp create mode 100644 Base/Utils/StringUtils.h diff --git a/Base/Utils/StringUtils.cpp b/Base/Utils/StringUtils.cpp new file mode 100644 index 00000000000..272a072c0c6 --- /dev/null +++ b/Base/Utils/StringUtils.cpp @@ -0,0 +1,96 @@ +// ************************************************************************************************ +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file Fit/Tools/StringUtils.cpp +//! @brief Implements a few helper functions +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2018 +//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) +// +// ************************************************************************************************ + +#include "Base/Utils/StringUtils.h" +#include <boost/algorithm/string.hpp> +#include <regex> + +//! Returns true if text matches pattern with wildcards '*' and '?'. +bool StringUtils::matchesPattern(const std::string& text, const std::string& wildcardPattern) +{ + // escape all regex special characters, except '?' and '*' + std::string mywildcardPattern = wildcardPattern; + boost::replace_all(mywildcardPattern, "\\", "\\\\"); + boost::replace_all(mywildcardPattern, "^", "\\^"); + boost::replace_all(mywildcardPattern, ".", "\\."); + boost::replace_all(mywildcardPattern, "$", "\\$"); + boost::replace_all(mywildcardPattern, "|", "\\|"); + boost::replace_all(mywildcardPattern, "(", "\\("); + boost::replace_all(mywildcardPattern, ")", "\\)"); + boost::replace_all(mywildcardPattern, "[", "\\["); + boost::replace_all(mywildcardPattern, "]", "\\]"); + boost::replace_all(mywildcardPattern, "+", "\\+"); + boost::replace_all(mywildcardPattern, "/", "\\/"); + + // Convert chars '*?' to their regex equivalents + boost::replace_all(mywildcardPattern, "?", "."); + boost::replace_all(mywildcardPattern, "*", ".*"); + + // constructing regexp pattern + mywildcardPattern = "^" + mywildcardPattern + "$"; + std::regex pattern(mywildcardPattern); + + // applaying match + return std::regex_match(text, pattern); +} + +//! Returns string right-padded with blanks. +std::string StringUtils::padRight(const std::string& name, size_t length) +{ + std::string result = name; + result.resize(length, ' '); + return result; +} + +//! Returns token vector obtained by splitting string at delimiters. +std::vector<std::string> StringUtils::split(const std::string& text, const std::string& delimiter) +{ + std::vector<std::string> tokens; + boost::split(tokens, text, boost::is_any_of(delimiter)); + return tokens; +} + +void StringUtils::replaceItemsFromString(std::string& text, const std::vector<std::string>& items, + const std::string& replacement) +{ + for (size_t i = 0; i < items.size(); ++i) + boost::replace_all(text, items[i], replacement); +} + +std::string StringUtils::join(const std::vector<std::string>& joinable, const std::string& joint) +{ + std::string result; + size_t n = joinable.size(); + if (n == 0) + return result; + for (size_t i = 0; i < n - 1; ++i) + result += joinable[i] + joint; + result += joinable[n - 1]; + return result; +} + +std::string StringUtils::removeSubstring(const std::string& text, const std::string& substr) +{ + std::string result = text; + for (std::string::size_type i = result.find(substr); i != std::string::npos; + i = result.find(substr)) + result.erase(i, substr.length()); + return result; +} + +std::string StringUtils::to_lower(std::string text) +{ + boost::to_lower(text); + return text; +} diff --git a/Base/Utils/StringUtils.h b/Base/Utils/StringUtils.h new file mode 100644 index 00000000000..f9c0ad1a2f3 --- /dev/null +++ b/Base/Utils/StringUtils.h @@ -0,0 +1,61 @@ +// ************************************************************************************************ +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file Fit/Tools/StringUtils.h +//! @brief Defines a few helper functions +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2018 +//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) +// +// ************************************************************************************************ + +#ifndef BORNAGAIN_FIT_TOOLS_STRINGUTILS_H +#define BORNAGAIN_FIT_TOOLS_STRINGUTILS_H + +#include <iomanip> +#include <sstream> +#include <string> +#include <vector> + +//! Utility functions to analyze or modify strings. + +namespace StringUtils +{ + +//! Returns true if text matches pattern with wildcards '*' and '?'. +bool matchesPattern(const std::string& text, const std::string& wildcardPattern); + +std::string padRight(const std::string& name, size_t length); + +//! Split string into vector of string using delimeter. +std::vector<std::string> split(const std::string& text, const std::string& delimeter); + +//! Replaces all occurences of items from string text with delimiter +void replaceItemsFromString(std::string& text, const std::vector<std::string>& items, + const std::string& replacement = ""); + +//! Returns string obtain by joining vector elements +std::string join(const std::vector<std::string>& joinable, const std::string& joint); + +//! Removes multiple occurences of given substring from a string and returns result. +std::string removeSubstring(const std::string& text, const std::string& substr); + +//! Returns scientific string representing given value of any numeric type. +template <typename T> std::string scientific(const T value, int n = 10); + +//! Returns new string which is lower case of text. +std::string to_lower(std::string text); + +} // namespace StringUtils + +template <typename T> std::string StringUtils::scientific(const T value, int n) +{ + std::ostringstream out; + out << std::scientific << std::setprecision(n) << value; + return out.str(); +} + +#endif // BORNAGAIN_FIT_TOOLS_STRINGUTILS_H diff --git a/Core/Fitting/FitPrintService.cpp b/Core/Fitting/FitPrintService.cpp index b95ec1bf0c5..7c30845c445 100644 --- a/Core/Fitting/FitPrintService.cpp +++ b/Core/Fitting/FitPrintService.cpp @@ -14,7 +14,7 @@ #include "Core/Fitting/FitPrintService.h" #include "Core/Fitting/FitObjective.h" -#include "Fit/Tools/StringUtils.h" +#include "Base/Utils/StringUtils.h" #include <iomanip> #include <iostream> #include <sstream> diff --git a/Core/Simulation/ISimulation.cpp b/Core/Simulation/ISimulation.cpp index 1fb5a2d15a8..3e2aa7ada2a 100644 --- a/Core/Simulation/ISimulation.cpp +++ b/Core/Simulation/ISimulation.cpp @@ -17,7 +17,7 @@ #include "Core/Computation/IComputation.h" #include "Core/Simulation/MPISimulation.h" #include "Core/Simulation/UnitConverterUtils.h" -#include "Fit/Tools/StringUtils.h" +#include "Base/Utils/StringUtils.h" #include "Param/Base/ParameterPool.h" #include "Sample/Multilayer/MultiLayer.h" #include "Sample/Multilayer/MultiLayerUtils.h" diff --git a/Device/InputOutput/DataFormatUtils.cpp b/Device/InputOutput/DataFormatUtils.cpp index 80080c97584..9cbf9649085 100644 --- a/Device/InputOutput/DataFormatUtils.cpp +++ b/Device/InputOutput/DataFormatUtils.cpp @@ -18,7 +18,7 @@ #include "Base/Axis/PointwiseAxis.h" #include "Base/Utils/FileSystemUtils.h" #include "Device/Data/OutputData.h" -#include "Fit/Tools/StringUtils.h" +#include "Base/Utils/StringUtils.h" #include <iostream> #include <iterator> diff --git a/Device/Instrument/PyFmt2.cpp b/Device/Instrument/PyFmt2.cpp index 0d4c071d649..431cd10aaf7 100644 --- a/Device/Instrument/PyFmt2.cpp +++ b/Device/Instrument/PyFmt2.cpp @@ -22,7 +22,7 @@ #include "Device/Mask/Line.h" #include "Device/Mask/Polygon.h" #include "Device/Mask/Rectangle.h" -#include "Fit/Tools/StringUtils.h" +#include "Base/Utils/StringUtils.h" #include "Param/Base/ParameterPool.h" #include "Param/Base/RealParameter.h" #include "Param/Distrib/Distributions.h" diff --git a/Fit/Minimizer/MinimizerOptions.cpp b/Fit/Minimizer/MinimizerOptions.cpp index 34e130a234f..1f5425349e5 100644 --- a/Fit/Minimizer/MinimizerOptions.cpp +++ b/Fit/Minimizer/MinimizerOptions.cpp @@ -35,7 +35,7 @@ std::string MinimizerOptions::toOptionString() const void MinimizerOptions::setOptionString(const std::string& options) { // splits multiple option string "Strategy=1;Tolerance=0.01;" - std::vector<std::string> tokens = StringUtils::split(options, delimeter); + std::vector<std::string> tokens = mumufit::StringUtils::split(options, delimeter); try { for (std::string opt : tokens) if (!opt.empty()) @@ -53,7 +53,7 @@ void MinimizerOptions::setOptionString(const std::string& options) void MinimizerOptions::processCommand(const std::string& command) { - std::vector<std::string> tokens = StringUtils::split(command, "="); + std::vector<std::string> tokens = mumufit::StringUtils::split(command, "="); if (tokens.size() != 2) throw std::runtime_error("MinimizerOptions::processOption() -> Can't parse option '" + command + "'"); diff --git a/Fit/RootAdapter/GSLLevenbergMarquardtMinimizer.cpp b/Fit/RootAdapter/GSLLevenbergMarquardtMinimizer.cpp index c3edfd11826..9390caeadb8 100644 --- a/Fit/RootAdapter/GSLLevenbergMarquardtMinimizer.cpp +++ b/Fit/RootAdapter/GSLLevenbergMarquardtMinimizer.cpp @@ -93,7 +93,7 @@ std::string GSLLevenbergMarquardtMinimizer::statusToString() const std::map<std::string, std::string> GSLLevenbergMarquardtMinimizer::statusMap() const { auto result = RootMinimizerAdapter::statusMap(); - result["Edm"] = StringUtils::scientific(rootMinimizer()->Edm()); + result["Edm"] = mumufit::StringUtils::scientific(rootMinimizer()->Edm()); result["CovMatrixStatus"] = covmatrixStatusDescription()[rootMinimizer()->CovMatrixStatus()]; result["functionCalls"] = std::to_string(rootMinimizer()->NCalls()); return result; diff --git a/Fit/RootAdapter/Minuit2Minimizer.cpp b/Fit/RootAdapter/Minuit2Minimizer.cpp index fdcc0eff73f..5bc6c7ec89a 100644 --- a/Fit/RootAdapter/Minuit2Minimizer.cpp +++ b/Fit/RootAdapter/Minuit2Minimizer.cpp @@ -126,7 +126,7 @@ std::string Minuit2Minimizer::statusToString() const std::map<std::string, std::string> Minuit2Minimizer::statusMap() const { auto result = RootMinimizerAdapter::statusMap(); - result["Edm"] = StringUtils::scientific(rootMinimizer()->Edm()); + result["Edm"] = mumufit::StringUtils::scientific(rootMinimizer()->Edm()); result["CovMatrixStatus"] = covmatrixStatusDescription()[rootMinimizer()->CovMatrixStatus()]; result["functionCalls"] = std::to_string(rootMinimizer()->NCalls()); return result; diff --git a/Fit/RootAdapter/RootMinimizerAdapter.cpp b/Fit/RootAdapter/RootMinimizerAdapter.cpp index 9ac9058a685..77f4a99e84b 100644 --- a/Fit/RootAdapter/RootMinimizerAdapter.cpp +++ b/Fit/RootAdapter/RootMinimizerAdapter.cpp @@ -103,7 +103,7 @@ std::map<std::string, std::string> RootMinimizerAdapter::statusMap() const else result["ProvidesError"] = "Doesn't provide error calculation"; - result["MinValue"] = StringUtils::scientific(minValue()); + result["MinValue"] = mumufit::StringUtils::scientific(minValue()); return result; } diff --git a/Fit/Tools/StringUtils.cpp b/Fit/Tools/StringUtils.cpp index 3a8e874b851..521be585a4d 100644 --- a/Fit/Tools/StringUtils.cpp +++ b/Fit/Tools/StringUtils.cpp @@ -16,6 +16,8 @@ #include <boost/algorithm/string.hpp> #include <regex> +namespace mumufit { + //! Returns true if text matches pattern with wildcards '*' and '?'. bool StringUtils::matchesPattern(const std::string& text, const std::string& wildcardPattern) { @@ -45,14 +47,6 @@ bool StringUtils::matchesPattern(const std::string& text, const std::string& wil return std::regex_match(text, pattern); } -//! Returns string right-padded with blanks. -std::string StringUtils::padRight(const std::string& name, size_t length) -{ - std::string result = name; - result.resize(length, ' '); - return result; -} - //! Returns token vector obtained by splitting string at delimiters. std::vector<std::string> StringUtils::split(const std::string& text, const std::string& delimiter) { @@ -61,25 +55,6 @@ std::vector<std::string> StringUtils::split(const std::string& text, const std:: return tokens; } -void StringUtils::replaceItemsFromString(std::string& text, const std::vector<std::string>& items, - const std::string& replacement) -{ - for (size_t i = 0; i < items.size(); ++i) - boost::replace_all(text, items[i], replacement); -} - -std::string StringUtils::join(const std::vector<std::string>& joinable, const std::string& joint) -{ - std::string result; - size_t n = joinable.size(); - if (n == 0) - return result; - for (size_t i = 0; i < n - 1; ++i) - result += joinable[i] + joint; - result += joinable[n - 1]; - return result; -} - std::string StringUtils::removeSubstring(const std::string& text, const std::string& substr) { std::string result = text; @@ -94,3 +69,5 @@ std::string StringUtils::to_lower(std::string text) boost::to_lower(text); return text; } + +} // namespace mumufit diff --git a/Fit/Tools/StringUtils.h b/Fit/Tools/StringUtils.h index f9c0ad1a2f3..53bc1715878 100644 --- a/Fit/Tools/StringUtils.h +++ b/Fit/Tools/StringUtils.h @@ -20,6 +20,8 @@ #include <string> #include <vector> +namespace mumufit { + //! Utility functions to analyze or modify strings. namespace StringUtils @@ -28,18 +30,9 @@ namespace StringUtils //! Returns true if text matches pattern with wildcards '*' and '?'. bool matchesPattern(const std::string& text, const std::string& wildcardPattern); -std::string padRight(const std::string& name, size_t length); - //! Split string into vector of string using delimeter. std::vector<std::string> split(const std::string& text, const std::string& delimeter); -//! Replaces all occurences of items from string text with delimiter -void replaceItemsFromString(std::string& text, const std::vector<std::string>& items, - const std::string& replacement = ""); - -//! Returns string obtain by joining vector elements -std::string join(const std::vector<std::string>& joinable, const std::string& joint); - //! Removes multiple occurences of given substring from a string and returns result. std::string removeSubstring(const std::string& text, const std::string& substr); @@ -49,13 +42,15 @@ template <typename T> std::string scientific(const T value, int n = 10); //! Returns new string which is lower case of text. std::string to_lower(std::string text); -} // namespace StringUtils - -template <typename T> std::string StringUtils::scientific(const T value, int n) +template <typename T> std::string scientific(const T value, int n) { std::ostringstream out; out << std::scientific << std::setprecision(n) << value; return out.str(); } +} // namespace StringUtils + +} // namespace mumufit + #endif // BORNAGAIN_FIT_TOOLS_STRINGUTILS_H diff --git a/Param/Base/ParameterPool.cpp b/Param/Base/ParameterPool.cpp index bc4696521d6..79cc6a5827f 100644 --- a/Param/Base/ParameterPool.cpp +++ b/Param/Base/ParameterPool.cpp @@ -102,7 +102,7 @@ std::vector<RealParameter*> ParameterPool::getMatchedParameters(const std::strin std::vector<RealParameter*> result; // loop over all parameters in the pool for (auto* par : m_params) - if (StringUtils::matchesPattern(par->getName(), pattern)) + if (mumufit::StringUtils::matchesPattern(par->getName(), pattern)) result.push_back(par); if (result.empty()) report_find_matched_parameters_error(pattern); diff --git a/Tests/Functional/GUI/Translate/GUITranslationTest.cpp b/Tests/Functional/GUI/Translate/GUITranslationTest.cpp index e2766b20d50..2fa8fa3b4c4 100644 --- a/Tests/Functional/GUI/Translate/GUITranslationTest.cpp +++ b/Tests/Functional/GUI/Translate/GUITranslationTest.cpp @@ -14,7 +14,7 @@ #include "Tests/Functional/GUI/Translate/GUITranslationTest.h" #include "Core/Simulation/SimulationFactory.h" -#include "Fit/Tools/StringUtils.h" +#include "Base/Utils/StringUtils.h" #include "GUI/coregui/Models/ApplicationModels.h" #include "GUI/coregui/Models/DocumentModel.h" #include "GUI/coregui/Models/FitParameterHelper.h" diff --git a/Tests/UnitTests/Fit/StringUtilsTest.cpp b/Tests/UnitTests/Fit/StringUtilsTest.cpp index 0ff23cc6e95..c5041ce9c62 100644 --- a/Tests/UnitTests/Fit/StringUtilsTest.cpp +++ b/Tests/UnitTests/Fit/StringUtilsTest.cpp @@ -8,12 +8,12 @@ class StringUtilsTest : public ::testing::Test TEST_F(StringUtilsTest, removeSubstring) { std::string target("one two threeone five one"); - std::string result = StringUtils::removeSubstring(target, "one"); + std::string result = mumufit::StringUtils::removeSubstring(target, "one"); EXPECT_EQ(result, " two three five "); } TEST_F(StringUtilsTest, toLower) { std::string target("QyQz"); - EXPECT_EQ(StringUtils::to_lower(target), "qyqz"); + EXPECT_EQ(mumufit::StringUtils::to_lower(target), "qyqz"); } diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 6550ddb09db..7dd19a86dc3 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -1487,6 +1487,50 @@ Returns a string of blanks with given width. By default the width equals standar "; +// File: namespaceStringUtils.xml +%feature("docstring") StringUtils::matchesPattern "bool StringUtils::matchesPattern(const std::string &text, const std::string &wildcardPattern) + +Returns true if text matches pattern with wildcards '*' and '?'. +"; + +%feature("docstring") StringUtils::padRight "std::string StringUtils::padRight(const std::string &name, size_t length) + +Returns string right-padded with blanks. +"; + +%feature("docstring") StringUtils::split "std::vector< std::string > StringUtils::split(const std::string &text, const std::string &delimeter) + +Split string into vector of string using delimeter. + +Returns token vector obtained by splitting string at delimiters. +"; + +%feature("docstring") StringUtils::replaceItemsFromString "void StringUtils::replaceItemsFromString(std::string &text, const std::vector< std::string > &items, const std::string &replacement=\"\") + +Replaces all occurences of items from string text with delimiter. +"; + +%feature("docstring") StringUtils::join "std::string StringUtils::join(const std::vector< std::string > &joinable, const std::string &joint) + +Returns string obtain by joining vector elements. +"; + +%feature("docstring") StringUtils::removeSubstring "std::string StringUtils::removeSubstring(const std::string &text, const std::string &substr) + +Removes multiple occurences of given substring from a string and returns result. +"; + +%feature("docstring") StringUtils::scientific "std::string StringUtils::scientific(const T value, int n=10) + +Returns scientific string representing given value of any numeric type. +"; + +%feature("docstring") StringUtils::to_lower "std::string StringUtils::to_lower(std::string text) + +Returns new string which is lower case of text. +"; + + // File: namespaceSysUtils.xml %feature("docstring") SysUtils::getCurrentDateAndTime "std::string SysUtils::getCurrentDateAndTime() "; @@ -1701,6 +1745,12 @@ Template function to create an integrator object // File: PythonCore_8h.xml +// File: StringUtils_8cpp.xml + + +// File: StringUtils_8h.xml + + // File: SysUtils_8cpp.xml diff --git a/auto/Wrap/doxygenFit.i b/auto/Wrap/doxygenFit.i index 6808adacdbe..56c64cc7544 100644 --- a/auto/Wrap/doxygenFit.i +++ b/auto/Wrap/doxygenFit.i @@ -1435,74 +1435,62 @@ Returns horizontal line of 80 characters length with section name in it. "; -// File: namespaceNumeric.xml -%feature("docstring") Numeric::GetAbsoluteDifference "double Numeric::GetAbsoluteDifference(double a, double b) +// File: namespacemumufit.xml -Returns the absolute value of the difference between a and b. -"; -%feature("docstring") Numeric::GetRelativeDifference "double Numeric::GetRelativeDifference(double a, double b) +// File: namespacemumufit_1_1StringUtils.xml +%feature("docstring") mumufit::StringUtils::matchesPattern "bool mumufit::StringUtils::matchesPattern(const std::string &text, const std::string &wildcardPattern) -Returns the safe relative difference, which is 2(|a-b|)/(|a|+|b|) except in special cases. -"; - -%feature("docstring") Numeric::GetLogDifference "double Numeric::GetLogDifference(double a, double b) - -Returns the difference of the logarithm; input values are truncated at the minimum positive value +Returns true if text matches pattern with wildcards '*' and '?'. "; +%feature("docstring") mumufit::StringUtils::split "std::vector< std::string > mumufit::StringUtils::split(const std::string &text, const std::string &delimeter) -// File: namespaceROOT.xml - - -// File: namespaceROOT_1_1Math.xml +Split string into vector of string using delimeter. +Returns token vector obtained by splitting string at delimiters. +"; -// File: namespaceROOT_1_1Minuit2.xml +%feature("docstring") mumufit::StringUtils::removeSubstring "std::string mumufit::StringUtils::removeSubstring(const std::string &text, const std::string &substr) +Removes multiple occurences of given substring from a string and returns result. +"; -// File: namespaceStringUtils.xml -%feature("docstring") StringUtils::matchesPattern "bool StringUtils::matchesPattern(const std::string &text, const std::string &wildcardPattern) +%feature("docstring") mumufit::StringUtils::scientific "std::string mumufit::StringUtils::scientific(const T value, int n=10) -Returns true if text matches pattern with wildcards '*' and '?'. +Returns scientific string representing given value of any numeric type. "; -%feature("docstring") StringUtils::padRight "std::string StringUtils::padRight(const std::string &name, size_t length) +%feature("docstring") mumufit::StringUtils::to_lower "std::string mumufit::StringUtils::to_lower(std::string text) -Returns string right-padded with blanks. +Returns new string which is lower case of text. "; -%feature("docstring") StringUtils::split "std::vector< std::string > StringUtils::split(const std::string &text, const std::string &delimeter) -Split string into vector of string using delimeter. +// File: namespaceNumeric.xml +%feature("docstring") Numeric::GetAbsoluteDifference "double Numeric::GetAbsoluteDifference(double a, double b) -Returns token vector obtained by splitting string at delimiters. +Returns the absolute value of the difference between a and b. "; -%feature("docstring") StringUtils::replaceItemsFromString "void StringUtils::replaceItemsFromString(std::string &text, const std::vector< std::string > &items, const std::string &replacement=\"\") +%feature("docstring") Numeric::GetRelativeDifference "double Numeric::GetRelativeDifference(double a, double b) -Replaces all occurences of items from string text with delimiter. +Returns the safe relative difference, which is 2(|a-b|)/(|a|+|b|) except in special cases. "; -%feature("docstring") StringUtils::join "std::string StringUtils::join(const std::vector< std::string > &joinable, const std::string &joint) +%feature("docstring") Numeric::GetLogDifference "double Numeric::GetLogDifference(double a, double b) -Returns string obtain by joining vector elements. +Returns the difference of the logarithm; input values are truncated at the minimum positive value "; -%feature("docstring") StringUtils::removeSubstring "std::string StringUtils::removeSubstring(const std::string &text, const std::string &substr) -Removes multiple occurences of given substring from a string and returns result. -"; +// File: namespaceROOT.xml -%feature("docstring") StringUtils::scientific "std::string StringUtils::scientific(const T value, int n=10) -Returns scientific string representing given value of any numeric type. -"; +// File: namespaceROOT_1_1Math.xml -%feature("docstring") StringUtils::to_lower "std::string StringUtils::to_lower(std::string text) -Returns new string which is lower case of text. -"; +// File: namespaceROOT_1_1Minuit2.xml // File: FitOptions_8cpp.xml -- GitLab