From 3fa4446aefb0c7612d86f2ff17474b8d43e2d26c Mon Sep 17 00:00:00 2001 From: Edward Brown <edward.brown@stfc.ac.uk> Date: Tue, 5 Sep 2017 11:02:16 +0100 Subject: [PATCH] Re #20302: Renamed DataProcessorPreprocessingAlgorithm. - Renamed to PreprocessingAlgorithm. --- .../source/interfaces/DataProcessorWidget.rst | 2 +- .../ReflDataProcessorPresenter.cpp | 2 +- .../ReflDataProcessorPresenter.h | 2 +- ...flGenericDataProcessorPresenterFactory.cpp | 6 ++-- qt/widgets/common/CMakeLists.txt | 6 ++-- .../DataProcessorPreprocessMap.h | 6 ++-- .../DataProcessorProcessingAlgorithmBase.h | 2 +- .../Common/DataProcessorUI/GenerateNotebook.h | 12 +++---- .../GenericDataProcessorPresenter.h | 10 +++--- ...ngAlgorithm.h => PreprocessingAlgorithm.h} | 14 ++++---- .../Common/DataProcessorUI/TreeData.h | 2 +- .../DataProcessorPreprocessMap.cpp | 4 +-- .../src/DataProcessorUI/GenerateNotebook.cpp | 10 +++--- .../GenericDataProcessorPresenter.cpp | 12 +++---- ...gorithm.cpp => PreprocessingAlgorithm.cpp} | 20 ++++++------ .../DataProcessorPreprocessMapTest.h | 4 +-- .../DataProcessorUI/GenerateNotebookTest.h | 18 +++++------ .../GenericDataProcessorPresenterTest.h | 12 +++---- ...thmTest.h => PreprocessingAlgorithmTest.h} | 32 +++++++++---------- 19 files changed, 88 insertions(+), 88 deletions(-) rename qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/{DataProcessorPreprocessingAlgorithm.h => PreprocessingAlgorithm.h} (86%) rename qt/widgets/common/src/DataProcessorUI/{DataProcessorPreprocessingAlgorithm.cpp => PreprocessingAlgorithm.cpp} (73%) rename qt/widgets/common/test/DataProcessorUI/{DataProcessorPreprocessingAlgorithmTest.h => PreprocessingAlgorithmTest.h} (65%) diff --git a/docs/source/interfaces/DataProcessorWidget.rst b/docs/source/interfaces/DataProcessorWidget.rst index 606260b27c1..33881e24f09 100644 --- a/docs/source/interfaces/DataProcessorWidget.rst +++ b/docs/source/interfaces/DataProcessorWidget.rst @@ -390,7 +390,7 @@ Then in the implementation, the following should be enough: const std::string &loader) : GenericDataProcessorPresenter( whitelist, - std::map<std::string, DataProcessorPreprocessingAlgorithm>(), + std::map<std::string, PreprocessingAlgorithm>(), processor, PostprocessingAlgorithm(), std::map<std::string, std::string>(), loader) {} diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp index 5a9cbcd0ccd..2e7ed368f4e 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp @@ -30,7 +30,7 @@ namespace CustomInterfaces { */ ReflDataProcessorPresenter::ReflDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, const std::map<QString, QString> &postprocessMap, const QString &loader) diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h index 48e2f80136b..142aac78862 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h @@ -45,7 +45,7 @@ public: // Constructor ReflDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> & + const std::map<QString, PreprocessingAlgorithm> & preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp index 8418c8bfb9c..1ff1740e64d 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp @@ -84,16 +84,16 @@ ReflGenericDataProcessorPresenterFactory::create() { // Pre-processing instructions as a map: // Keys are the column names // Values are the pre-processing algorithms that will be applied to columns - std::map<QString, DataProcessorPreprocessingAlgorithm> preprocessMap = { + std::map<QString, PreprocessingAlgorithm> preprocessMap = { /* 'Plus' will be applied to column 'Run(s)'*/ {"Run(s)", - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( "Plus", "TOF_", std::set<QString>{"LHSWorkspace", "RHSWorkspace", "OutputWorkspace"})}, /* 'CreateTransmissionWorkspaceAuto' will be applied to column 'Transmission Run(s)'*/ {"Transmission Run(s)", - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<QString>{"FirstTransmissionRun", "SecondTransmissionRun", "OutputWorkspace"})}}; diff --git a/qt/widgets/common/CMakeLists.txt b/qt/widgets/common/CMakeLists.txt index 8f8b62ea3a7..998066db89f 100644 --- a/qt/widgets/common/CMakeLists.txt +++ b/qt/widgets/common/CMakeLists.txt @@ -67,7 +67,7 @@ src/DataProcessorUI/GenerateNotebook.cpp src/DataProcessorUI/OneLevelTreeManager.cpp src/DataProcessorUI/PostprocessingAlgorithm.cpp - src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp + src/DataProcessorUI/PreprocessingAlgorithm.cpp src/DataProcessorUI/DataProcessorPreprocessMap.cpp src/DataProcessorUI/DataProcessorProcessingAlgorithm.cpp src/DataProcessorUI/DataProcessorProcessingAlgorithmBase.cpp @@ -328,7 +328,7 @@ set ( INC_FILES inc/MantidQtWidgets/Common/DataProcessorUI/PlotGroupCommand.h inc/MantidQtWidgets/Common/DataProcessorUI/PlotRowCommand.h inc/MantidQtWidgets/Common/DataProcessorUI/PostprocessingAlgorithm.h - inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h + inc/MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPresenter.h inc/MantidQtWidgets/Common/DataProcessorUI/ProcessCommand.h @@ -444,7 +444,7 @@ set( TEST_FILES DataProcessorUI/GenerateNotebookTest.h DataProcessorUI/OneLevelTreeManagerTest.h DataProcessorUI/PostprocessingAlgorithmTest.h - DataProcessorUI/DataProcessorPreprocessingAlgorithmTest.h + DataProcessorUI/PreprocessingAlgorithmTest.h DataProcessorUI/DataProcessorPreprocessMapTest.h DataProcessorUI/DataProcessorProcessingAlgorithmBaseTest.h DataProcessorUI/DataProcessorProcessingAlgorithmTest.h diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h index f3811504d6f..e5466dfcc84 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h @@ -2,7 +2,7 @@ #define MANTIDQTMANTIDWIDGETS_DATAPROCESSORPREPROCESSMAP_H #include "MantidQtWidgets/Common/DllOption.h" -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" #include <map> #include <QString> @@ -47,11 +47,11 @@ public: void addElement(const QString &column, const QString &algorithm, const QString &prefix = "", const QString &blacklist = ""); // Returns a map where keys are columns and values pre-processing algorithms - std::map<QString, DataProcessorPreprocessingAlgorithm> asMap() const; + std::map<QString, PreprocessingAlgorithm> asMap() const; private: // A map where keys are columns and values pre-processing algorithms - std::map<QString, DataProcessorPreprocessingAlgorithm> m_map; + std::map<QString, PreprocessingAlgorithm> m_map; }; } } diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h index 7d688c42a03..d312cf58e12 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h @@ -16,7 +16,7 @@ namespace DataProcessor { DataProcessorProcessingAlgorithmBase defines shared code to be used by derived classes -(DataProcessorPreprocessingAlgorithm, DataProcessorProcessingAlgorithm and +(PreprocessingAlgorithm, DataProcessorProcessingAlgorithm and PostprocessingAlgorithm). Copyright © 2011-14 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenerateNotebook.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenerateNotebook.h index 53cbb59d0e4..2ce12d3d7ea 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenerateNotebook.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenerateNotebook.h @@ -30,7 +30,7 @@ #include "MantidKernel/System.h" #include "MantidQtWidgets/Common/DataProcessorUI/PostprocessingAlgorithm.h" -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorWhiteList.h" #include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" @@ -73,19 +73,19 @@ getReducedWorkspaceName(const RowData &data, boost::tuple<QString, QString> DLLExport reduceRowString( const RowData &data, const QString &instrument, const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const std::map<QString, QString> &preprocessOoptionsMap, const QString &processingOptions); boost::tuple<QString, QString> DLLExport loadWorkspaceString(const QString &runStr, const QString &instrument, - const DataProcessorPreprocessingAlgorithm &preprocessor, + const PreprocessingAlgorithm &preprocessor, const QString &options); QString DLLExport plusString(const QString &input_name, const QString &output_name, - const DataProcessorPreprocessingAlgorithm &preprocessor, + const PreprocessingAlgorithm &preprocessor, const QString &options); boost::tuple<QString, QString> DLLExport @@ -101,7 +101,7 @@ public: GenerateNotebook( QString name, const QString instrument, const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> & + const std::map<QString, PreprocessingAlgorithm> & preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, @@ -122,7 +122,7 @@ private: DataProcessorWhiteList m_whitelist; // The map indicating the columns that were pre-processed and their // corresponding pre-processing algorithms - std::map<QString, DataProcessorPreprocessingAlgorithm> m_preprocessMap; + std::map<QString, PreprocessingAlgorithm> m_preprocessMap; // The processing (reduction) algorithm DataProcessorProcessingAlgorithm m_processor; // The post-processing algorithm diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h index f5f9f6a227c..3a2efb88a49 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h @@ -10,7 +10,7 @@ #include "MantidQtWidgets/Common/DataProcessorUI/TwoLevelTreeManager.h" #include "MantidQtWidgets/Common/DataProcessorUI/PostprocessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessMap.h" -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPresenter.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorWhiteList.h" @@ -77,7 +77,7 @@ public: // Constructor: pre-processing and post-processing GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> & + const std::map<QString, PreprocessingAlgorithm> & preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, @@ -92,7 +92,7 @@ public: // Constructor: pre-processing, no post-processing GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> & + const std::map<QString, PreprocessingAlgorithm> & preprocessMap, const DataProcessorProcessingAlgorithm &processor); // Constructor: no pre-processing, no post-processing @@ -191,7 +191,7 @@ private: // The whitelist DataProcessorWhiteList m_whitelist; // The pre-processing instructions - std::map<QString, DataProcessorPreprocessingAlgorithm> m_preprocessMap; + std::map<QString, PreprocessingAlgorithm> m_preprocessMap; // The data processor algorithm DataProcessorProcessingAlgorithm m_processor; // Post-processing algorithm @@ -235,7 +235,7 @@ private: // prepare a run or list of runs for processing Mantid::API::Workspace_sptr prepareRunWorkspace(const QString &run, - const DataProcessorPreprocessingAlgorithm &alg, + const PreprocessingAlgorithm &alg, const std::map<std::string, std::string> &optionsMap); // add row(s) to the model void appendRow(); diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h similarity index 86% rename from qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h rename to qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h index 0d8fb02a1cc..3473c24bd99 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h @@ -8,9 +8,9 @@ namespace MantidQt { namespace MantidWidgets { namespace DataProcessor { -/** @class DataProcessorPreprocessingAlgorithm +/** @class PreprocessingAlgorithm -DataProcessorPreprocessingAlgorithm defines a pre-processor algorithm that will +PreprocessingAlgorithm defines a pre-processor algorithm that will be responsible for pre-processsing a specific column in a Data Processor UI. @@ -35,21 +35,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class EXPORT_OPT_MANTIDQT_COMMON DataProcessorPreprocessingAlgorithm +class EXPORT_OPT_MANTIDQT_COMMON PreprocessingAlgorithm : public DataProcessorProcessingAlgorithmBase { public: // Constructor - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( const QString &name, const QString &prefix = "", const std::set<QString> &blacklist = std::set<QString>()); // Delegating constructor - DataProcessorPreprocessingAlgorithm(const QString &name, + PreprocessingAlgorithm(const QString &name, const QString &prefix, const QString &blacklist); // Default constructor - DataProcessorPreprocessingAlgorithm(); + PreprocessingAlgorithm(); // Destructor - virtual ~DataProcessorPreprocessingAlgorithm(); + virtual ~PreprocessingAlgorithm(); // The name of the lhs input property QString lhsProperty() const; diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h index ce59624cc0d..a01cfefb5e0 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h @@ -28,7 +28,7 @@ #include "MantidKernel/System.h" #include "MantidQtWidgets/Common/DataProcessorUI/PostprocessingAlgorithm.h" -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorProcessingAlgorithm.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorWhiteList.h" #include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" diff --git a/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessMap.cpp b/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessMap.cpp index 3b783bcfbdc..526203ed65b 100644 --- a/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessMap.cpp +++ b/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessMap.cpp @@ -26,13 +26,13 @@ void DataProcessorPreprocessMap::addElement(const QString &column, const QString &blacklist) { m_map[column] = - DataProcessorPreprocessingAlgorithm(algorithm, prefix, blacklist); + PreprocessingAlgorithm(algorithm, prefix, blacklist); } /** Return a map where keys are columns and values pre-processing algorithms * @return :: Pre-processing instructions as a map */ -std::map<QString, DataProcessorPreprocessingAlgorithm> +std::map<QString, PreprocessingAlgorithm> DataProcessorPreprocessMap::asMap() const { return m_map; } diff --git a/qt/widgets/common/src/DataProcessorUI/GenerateNotebook.cpp b/qt/widgets/common/src/DataProcessorUI/GenerateNotebook.cpp index 4dda16fc60f..615a08c0d30 100644 --- a/qt/widgets/common/src/DataProcessorUI/GenerateNotebook.cpp +++ b/qt/widgets/common/src/DataProcessorUI/GenerateNotebook.cpp @@ -51,7 +51,7 @@ specified via the corresponding hinting line edit in the view GenerateNotebook::GenerateNotebook( QString name, const QString instrument, const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, const std::map<QString, QString> preprocessingOptionsMap, @@ -405,7 +405,7 @@ void addProperties(QStringList &algProperties, const Map &optionsMap) { boost::tuple<QString, QString> reduceRowString( const RowData &data, const QString &instrument, const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const std::map<QString, QString> &preprocessingOptionsMap, const QString &processingOptions) { @@ -443,7 +443,7 @@ boost::tuple<QString, QString> reduceRowString( // Some runs were given for pre-processing // The pre-processing alg - const DataProcessorPreprocessingAlgorithm preprocessor = + const PreprocessingAlgorithm preprocessor = preprocessMap.at(colName); // The pre-processing options const QString options = preprocessingOptionsMap.count(colName) > 0 @@ -534,7 +534,7 @@ boost::tuple<QString, QString> reduceRowString( */ boost::tuple<QString, QString> loadWorkspaceString(const QString &runStr, const QString &instrument, - const DataProcessorPreprocessingAlgorithm &preprocessor, + const PreprocessingAlgorithm &preprocessor, const QString &options) { auto runs = runStr.split(QRegExp("[+,]")); @@ -583,7 +583,7 @@ loadWorkspaceString(const QString &runStr, const QString &instrument, @return string of python code */ QString plusString(const QString &input_name, const QString &output_name, - const DataProcessorPreprocessingAlgorithm &preprocessor, + const PreprocessingAlgorithm &preprocessor, const QString &options) { QString plusString; diff --git a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp index 852e53f6381..d557772b4e4 100644 --- a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp +++ b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp @@ -117,7 +117,7 @@ namespace DataProcessor { */ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, const std::map<QString, QString> &postprocessMap, const QString &loader) @@ -183,7 +183,7 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor) : GenericDataProcessorPresenter( - whitelist, std::map<QString, DataProcessorPreprocessingAlgorithm>(), + whitelist, std::map<QString, PreprocessingAlgorithm>(), processor, postprocessor) {} /** @@ -193,7 +193,7 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist) : GenericDataProcessorPresenter( - whitelist, std::map<QString, DataProcessorPreprocessingAlgorithm>(), + whitelist, std::map<QString, PreprocessingAlgorithm>(), DataProcessorProcessingAlgorithm(), PostprocessingAlgorithm()) {} @@ -207,7 +207,7 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( */ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> &preprocessMap, + const std::map<QString, PreprocessingAlgorithm> &preprocessMap, const DataProcessorProcessingAlgorithm &processor) : GenericDataProcessorPresenter(whitelist, preprocessMap, processor, PostprocessingAlgorithm()) {} @@ -222,7 +222,7 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, const DataProcessorProcessingAlgorithm &processor) : GenericDataProcessorPresenter( - whitelist, std::map<QString, DataProcessorPreprocessingAlgorithm>(), + whitelist, std::map<QString, PreprocessingAlgorithm>(), processor, PostprocessingAlgorithm()) {} /** @@ -660,7 +660,7 @@ desired workspace */ Workspace_sptr GenericDataProcessorPresenter::prepareRunWorkspace( const QString &runStr, - const DataProcessorPreprocessingAlgorithm &preprocessor, + const PreprocessingAlgorithm &preprocessor, const std::map<std::string, std::string> &optionsMap) { auto const instrument = m_view->getProcessInstrument(); diff --git a/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp b/qt/widgets/common/src/DataProcessorUI/PreprocessingAlgorithm.cpp similarity index 73% rename from qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp rename to qt/widgets/common/src/DataProcessorUI/PreprocessingAlgorithm.cpp index 6eb658a0e40..6a1f3bb7efe 100644 --- a/qt/widgets/common/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp +++ b/qt/widgets/common/src/DataProcessorUI/PreprocessingAlgorithm.cpp @@ -1,4 +1,4 @@ -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" namespace MantidQt { namespace MantidWidgets { @@ -10,7 +10,7 @@ namespace DataProcessor { * @param blacklist : The list of properties we don't want to show * algorithm in the processed workspace's name */ -DataProcessorPreprocessingAlgorithm::DataProcessorPreprocessingAlgorithm( +PreprocessingAlgorithm::PreprocessingAlgorithm( const QString &name, const QString &prefix, const std::set<QString> &blacklist) : DataProcessorProcessingAlgorithmBase(name, blacklist), m_prefix(prefix) { @@ -42,36 +42,36 @@ DataProcessorPreprocessingAlgorithm::DataProcessorPreprocessingAlgorithm( * @param blacklist : The list of properties we don't want to show, as a string * algorithm in the processed workspace's name */ -DataProcessorPreprocessingAlgorithm::DataProcessorPreprocessingAlgorithm( +PreprocessingAlgorithm::PreprocessingAlgorithm( const QString &name, const QString &prefix, const QString &blacklist) - : DataProcessorPreprocessingAlgorithm(name, prefix, + : PreprocessingAlgorithm(name, prefix, convertStringToSet(blacklist)) {} /** Default constructor: do nothing */ -DataProcessorPreprocessingAlgorithm::DataProcessorPreprocessingAlgorithm() +PreprocessingAlgorithm::PreprocessingAlgorithm() : m_prefix(), m_lhs(), m_rhs(), m_outProperty() {} // Destructor -DataProcessorPreprocessingAlgorithm::~DataProcessorPreprocessingAlgorithm() {} +PreprocessingAlgorithm::~PreprocessingAlgorithm() {} // Returns the name of the lhs input property -QString DataProcessorPreprocessingAlgorithm::lhsProperty() const { +QString PreprocessingAlgorithm::lhsProperty() const { return m_lhs; } // Returns the name of the rhs input property -QString DataProcessorPreprocessingAlgorithm::rhsProperty() const { +QString PreprocessingAlgorithm::rhsProperty() const { return m_rhs; } // Returns the name of the output property -QString DataProcessorPreprocessingAlgorithm::outputProperty() const { +QString PreprocessingAlgorithm::outputProperty() const { return m_outProperty; } // Returns the prefix to add to the output property -QString DataProcessorPreprocessingAlgorithm::prefix() const { return m_prefix; } +QString PreprocessingAlgorithm::prefix() const { return m_prefix; } } } } diff --git a/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessMapTest.h b/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessMapTest.h index 56483410cec..b3a79fc9aa3 100644 --- a/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessMapTest.h +++ b/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessMapTest.h @@ -39,13 +39,13 @@ public: auto preprocessingInstructions = preprocessMap.asMap(); - DataProcessorPreprocessingAlgorithm algPlus = + PreprocessingAlgorithm algPlus = preprocessingInstructions["Runs"]; TS_ASSERT_EQUALS(algPlus.name(), "Plus"); TS_ASSERT_EQUALS(algPlus.prefix(), ""); TS_ASSERT_EQUALS(algPlus.blacklist(), std::set<QString>()); - DataProcessorPreprocessingAlgorithm algTrans = + PreprocessingAlgorithm algTrans = preprocessingInstructions["Transmission Runs"]; TS_ASSERT_EQUALS(algTrans.name(), "CreateTransmissionWorkspaceAuto"); TS_ASSERT_EQUALS(algTrans.prefix(), "TRANS_"); diff --git a/qt/widgets/common/test/DataProcessorUI/GenerateNotebookTest.h b/qt/widgets/common/test/DataProcessorUI/GenerateNotebookTest.h index ebc4f209dbb..7818e1e4af7 100644 --- a/qt/widgets/common/test/DataProcessorUI/GenerateNotebookTest.h +++ b/qt/widgets/common/test/DataProcessorUI/GenerateNotebookTest.h @@ -22,15 +22,15 @@ class GenerateNotebookTest : public CxxTest::TestSuite { private: // Creates a map with pre-processing instruction for reflectometry - std::map<QString, DataProcessorPreprocessingAlgorithm> + std::map<QString, PreprocessingAlgorithm> reflPreprocessMap(const QString &plusPrefix = "") { // Reflectometry pre-process map - return std::map<QString, DataProcessorPreprocessingAlgorithm>{ - {"Run(s)", DataProcessorPreprocessingAlgorithm("Plus", plusPrefix, + return std::map<QString, PreprocessingAlgorithm>{ + {"Run(s)", PreprocessingAlgorithm("Plus", plusPrefix, std::set<QString>())}, {"Transmission Run(s)", - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<QString>{"FirstTransmissionRun", "SecondTransmissionRun", "OutputWorkspace"})}}; @@ -139,7 +139,7 @@ public: auto notebook = Mantid::Kernel::make_unique<GenerateNotebook>( m_wsName, m_instrument, reflWhitelist(), - std::map<QString, DataProcessorPreprocessingAlgorithm>(), + std::map<QString, PreprocessingAlgorithm>(), reflProcessor(), reflPostprocessor(), std::map<QString, QString>(), "", ""); @@ -258,7 +258,7 @@ public: } void testLoadWorkspaceStringThreeRunsWithOptions() { - DataProcessorPreprocessingAlgorithm preprocessor("WeightedMean"); + PreprocessingAlgorithm preprocessor("WeightedMean"); auto output = loadWorkspaceString("RUN1+RUN2,RUN3", "INST_", preprocessor, "Property1 = 1, Property2 = 2"); auto outputLines = splitIntoLines(boost::get<0>(output)); @@ -330,8 +330,8 @@ public: whitelist.addElement("Options", "Options", ""); // Create a pre-process map - std::map<QString, DataProcessorPreprocessingAlgorithm> preprocessMap = { - {"Run", DataProcessorPreprocessingAlgorithm("Plus", "RUN_", + std::map<QString, PreprocessingAlgorithm> preprocessMap = { + {"Run", PreprocessingAlgorithm("Plus", "RUN_", std::set<QString>())}}; // Specify some pre-processing options std::map<QString, QString> userPreProcessingOptions = { @@ -370,7 +370,7 @@ public: // Reduce a run without pre-processing algorithm specified (i.e. empty // pre-process map) - std::map<QString, DataProcessorPreprocessingAlgorithm> emptyPreProcessMap; + std::map<QString, PreprocessingAlgorithm> emptyPreProcessMap; std::map<QString, QString> emptyPreProcessingOptions; const RowData data = {"12346", "1.5", "", "1.4", "2.9", diff --git a/qt/widgets/common/test/DataProcessorUI/GenericDataProcessorPresenterTest.h b/qt/widgets/common/test/DataProcessorUI/GenericDataProcessorPresenterTest.h index 5cf2fa0fd50..662aee02fe4 100644 --- a/qt/widgets/common/test/DataProcessorUI/GenericDataProcessorPresenterTest.h +++ b/qt/widgets/common/test/DataProcessorUI/GenericDataProcessorPresenterTest.h @@ -34,7 +34,7 @@ public: // Standard constructor GenericDataProcessorPresenterNoThread( const DataProcessorWhiteList &whitelist, - const std::map<QString, DataProcessorPreprocessingAlgorithm> & + const std::map<QString, PreprocessingAlgorithm> & preprocessMap, const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor, @@ -50,7 +50,7 @@ public: const DataProcessorProcessingAlgorithm &processor, const PostprocessingAlgorithm &postprocessor) : GenericDataProcessorPresenter( - whitelist, std::map<QString, DataProcessorPreprocessingAlgorithm>(), + whitelist, std::map<QString, PreprocessingAlgorithm>(), processor, postprocessor) {} // Destructor @@ -107,16 +107,16 @@ private: return whitelist; } - std::map<QString, DataProcessorPreprocessingAlgorithm> + std::map<QString, PreprocessingAlgorithm> createReflectometryPreprocessMap() { - return std::map<QString, DataProcessorPreprocessingAlgorithm>{ + return std::map<QString, PreprocessingAlgorithm>{ {"Run(s)", - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( "Plus", "TOF_", std::set<QString>{"LHSWorkspace", "RHSWorkspace", "OutputWorkspace"})}, {"Transmission Run(s)", - DataProcessorPreprocessingAlgorithm( + PreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<QString>{"FirstTransmissionRun", "SecondTransmissionRun", "OutputWorkspace"})}}; diff --git a/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessingAlgorithmTest.h b/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h similarity index 65% rename from qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessingAlgorithmTest.h rename to qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h index a84abbfc091..6364f47227e 100644 --- a/qt/widgets/common/test/DataProcessorUI/DataProcessorPreprocessingAlgorithmTest.h +++ b/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h @@ -6,7 +6,7 @@ #include <gtest/gtest.h> #include "MantidAPI/FrameworkManager.h" -#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h" +#include "MantidQtWidgets/Common/DataProcessorUI/PreprocessingAlgorithm.h" using namespace MantidQt::MantidWidgets; using namespace MantidQt::MantidWidgets::DataProcessor; @@ -16,51 +16,51 @@ using namespace testing; //===================================================================================== // Functional tests //===================================================================================== -class DataProcessorPreprocessingAlgorithmTest : public CxxTest::TestSuite { +class PreprocessingAlgorithmTest : public CxxTest::TestSuite { private: public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests - static DataProcessorPreprocessingAlgorithmTest *createSuite() { - return new DataProcessorPreprocessingAlgorithmTest(); + static PreprocessingAlgorithmTest *createSuite() { + return new PreprocessingAlgorithmTest(); } - static void destroySuite(DataProcessorPreprocessingAlgorithmTest *suite) { + static void destroySuite(PreprocessingAlgorithmTest *suite) { delete suite; } - DataProcessorPreprocessingAlgorithmTest() { FrameworkManager::Instance(); }; + PreprocessingAlgorithmTest() { FrameworkManager::Instance(); }; void test_invalid_algorithms() { // Algorithm with a single input ws property - TS_ASSERT_THROWS(DataProcessorPreprocessingAlgorithm("Rebin"), + TS_ASSERT_THROWS(PreprocessingAlgorithm("Rebin"), std::invalid_argument); // Algorithm with more than two input ws properties TS_ASSERT_THROWS( - DataProcessorPreprocessingAlgorithm("ReflectometryReductionOneAuto"), + PreprocessingAlgorithm("ReflectometryReductionOneAuto"), std::invalid_argument); // Algorithm with two input ws properties but no output ws properties - TS_ASSERT_THROWS(DataProcessorPreprocessingAlgorithm("ConjoinWorkspaces"), + TS_ASSERT_THROWS(PreprocessingAlgorithm("ConjoinWorkspaces"), std::invalid_argument); } void test_valid_algorithms() { // Minus - TS_ASSERT_THROWS_NOTHING(DataProcessorPreprocessingAlgorithm("Minus")); + TS_ASSERT_THROWS_NOTHING(PreprocessingAlgorithm("Minus")); // Multiply - TS_ASSERT_THROWS_NOTHING(DataProcessorPreprocessingAlgorithm("Multiply")); + TS_ASSERT_THROWS_NOTHING(PreprocessingAlgorithm("Multiply")); // Divide - TS_ASSERT_THROWS_NOTHING(DataProcessorPreprocessingAlgorithm("Divide")); + TS_ASSERT_THROWS_NOTHING(PreprocessingAlgorithm("Divide")); // Default: Plus - TS_ASSERT_THROWS_NOTHING(DataProcessorPreprocessingAlgorithm()); + TS_ASSERT_THROWS_NOTHING(PreprocessingAlgorithm()); // WeightedMean TS_ASSERT_THROWS_NOTHING( - DataProcessorPreprocessingAlgorithm("WeightedMean")); + PreprocessingAlgorithm("WeightedMean")); } void test_default() { // Default: no algorithm - auto plus = DataProcessorPreprocessingAlgorithm(); + auto plus = PreprocessingAlgorithm(); TS_ASSERT_EQUALS(plus.name(), ""); TS_ASSERT_EQUALS(plus.lhsProperty(), ""); TS_ASSERT_EQUALS(plus.rhsProperty(), ""); @@ -75,7 +75,7 @@ public: std::set<QString> blacklist = {"InputWorkspace1", "InputWorkspace2", "OutputWorkspace"}; auto mean = - DataProcessorPreprocessingAlgorithm("WeightedMean", "", blacklist); + PreprocessingAlgorithm("WeightedMean", "", blacklist); TS_ASSERT_EQUALS(mean.lhsProperty(), "InputWorkspace1"); TS_ASSERT_EQUALS(mean.rhsProperty(), "InputWorkspace2"); TS_ASSERT_EQUALS(mean.outputProperty(), "OutputWorkspace"); -- GitLab