From 651af50f6f73013fde9741e13279e06da85a3d8c Mon Sep 17 00:00:00 2001 From: Roman Tolchenov <roman.tolchenov@stfc.ac.uk> Date: Mon, 12 Oct 2015 10:56:26 +0100 Subject: [PATCH] Re #11035. Split workspace validators into files. --- Framework/API/CMakeLists.txt | 42 +- .../API/inc/MantidAPI/CommonBinsValidator.h | 52 +++ .../API/inc/MantidAPI/HistogramValidator.h | 55 +++ .../inc/MantidAPI/IncreasingAxisValidator.h | 50 +++ .../API/inc/MantidAPI/InstrumentValidator.h | 57 +++ .../inc/MantidAPI/MatrixWorkspaceValidator.h | 43 ++ .../API/inc/MantidAPI/NumericAxisValidator.h | 54 +++ .../API/inc/MantidAPI/RawCountValidator.h | 54 +++ Framework/API/inc/MantidAPI/SampleValidator.h | 51 +++ .../API/inc/MantidAPI/SpectraAxisValidator.h | 53 +++ .../inc/MantidAPI/WorkspaceUnitValidator.h | 54 +++ .../API/inc/MantidAPI/WorkspaceValidators.h | 409 ------------------ Framework/API/src/CommonBinsValidator.cpp | 27 ++ Framework/API/src/HistogramValidator.cpp | 41 ++ Framework/API/src/IncreasingAxisValidator.cpp | 33 ++ Framework/API/src/InstrumentValidator.cpp | 56 +++ Framework/API/src/NumericAxisValidator.cpp | 30 ++ Framework/API/src/RawCountValidator.cpp | 39 ++ Framework/API/src/SampleValidator.cpp | 54 +++ Framework/API/src/SpectraAxisValidator.cpp | 30 ++ Framework/API/src/WorkspaceUnitValidator.cpp | 56 +++ Framework/API/src/WorkspaceValidators.cpp | 107 ----- Framework/API/test/CommonBinsValidatorTest.h | 27 ++ Framework/API/test/HistogramValidatorTest.h | 27 ++ Framework/API/test/InstrumentValidatorTest.h | 27 ++ .../API/test/MatrixWorkspaceValidatorTest.h | 27 ++ Framework/API/test/NumericAxisValidatorTest.h | 27 ++ Framework/API/test/RawCountValidatorTest.h | 27 ++ Framework/API/test/SampleValidatorTest.h | 27 ++ Framework/API/test/SpectraAxisValidatorTest.h | 27 ++ .../API/test/WorkspaceUnitValidatorTest.h | 27 ++ 31 files changed, 1166 insertions(+), 524 deletions(-) create mode 100644 Framework/API/inc/MantidAPI/CommonBinsValidator.h create mode 100644 Framework/API/inc/MantidAPI/HistogramValidator.h create mode 100644 Framework/API/inc/MantidAPI/IncreasingAxisValidator.h create mode 100644 Framework/API/inc/MantidAPI/InstrumentValidator.h create mode 100644 Framework/API/inc/MantidAPI/MatrixWorkspaceValidator.h create mode 100644 Framework/API/inc/MantidAPI/NumericAxisValidator.h create mode 100644 Framework/API/inc/MantidAPI/RawCountValidator.h create mode 100644 Framework/API/inc/MantidAPI/SampleValidator.h create mode 100644 Framework/API/inc/MantidAPI/SpectraAxisValidator.h create mode 100644 Framework/API/inc/MantidAPI/WorkspaceUnitValidator.h delete mode 100644 Framework/API/inc/MantidAPI/WorkspaceValidators.h create mode 100644 Framework/API/src/CommonBinsValidator.cpp create mode 100644 Framework/API/src/HistogramValidator.cpp create mode 100644 Framework/API/src/IncreasingAxisValidator.cpp create mode 100644 Framework/API/src/InstrumentValidator.cpp create mode 100644 Framework/API/src/NumericAxisValidator.cpp create mode 100644 Framework/API/src/RawCountValidator.cpp create mode 100644 Framework/API/src/SampleValidator.cpp create mode 100644 Framework/API/src/SpectraAxisValidator.cpp create mode 100644 Framework/API/src/WorkspaceUnitValidator.cpp delete mode 100644 Framework/API/src/WorkspaceValidators.cpp create mode 100644 Framework/API/test/CommonBinsValidatorTest.h create mode 100644 Framework/API/test/HistogramValidatorTest.h create mode 100644 Framework/API/test/InstrumentValidatorTest.h create mode 100644 Framework/API/test/MatrixWorkspaceValidatorTest.h create mode 100644 Framework/API/test/NumericAxisValidatorTest.h create mode 100644 Framework/API/test/RawCountValidatorTest.h create mode 100644 Framework/API/test/SampleValidatorTest.h create mode 100644 Framework/API/test/SpectraAxisValidatorTest.h create mode 100644 Framework/API/test/WorkspaceUnitValidatorTest.h diff --git a/Framework/API/CMakeLists.txt b/Framework/API/CMakeLists.txt index cbaec9de9b5..cf55421199a 100644 --- a/Framework/API/CMakeLists.txt +++ b/Framework/API/CMakeLists.txt @@ -18,6 +18,7 @@ set ( SRC_FILES src/ChopperModel.cpp src/Column.cpp src/ColumnFactory.cpp + src/CommonBinsValidator.cpp src/CompositeCatalog.cpp src/CompositeDomainMD.cpp src/CompositeFunction.cpp @@ -45,6 +46,7 @@ set ( SRC_FILES src/FunctionValues.cpp src/GridDomain.cpp src/GridDomain1D.cpp + src/HistogramValidator.cpp src/HistoryItem.cpp src/HistoryView.cpp src/IDomainCreator.cpp @@ -74,7 +76,9 @@ set ( SRC_FILES src/ImplicitFunctionFactory.cpp src/ImplicitFunctionParameterParserFactory.cpp src/ImplicitFunctionParserFactory.cpp + src/IncreasingAxisValidator.cpp src/InstrumentDataService.cpp + src/InstrumentValidator.cpp src/JointDomain.cpp src/LatticeDomain.cpp src/LinearScale.cpp @@ -92,10 +96,11 @@ set ( SRC_FILES src/MultiPeriodGroupWorker.cpp src/MultipleExperimentInfos.cpp src/MultipleFileProperty.cpp + src/NotebookBuilder.cpp + src/NotebookWriter.cpp src/NullCoordTransform.cpp - src/NotebookBuilder.cpp - src/NotebookWriter.cpp src/NumericAxis.cpp + src/NumericAxisValidator.cpp src/ParamFunction.cpp src/ParameterReference.cpp src/ParameterTie.cpp @@ -104,17 +109,20 @@ set ( SRC_FILES src/Projection.cpp src/PropertyManagerDataService.cpp src/PropertyNexus.cpp + src/RawCountValidator.cpp src/RefAxis.cpp src/RemoteJobManagerFactory.cpp src/Run.cpp src/Sample.cpp src/SampleEnvironment.cpp src/SampleShapeValidator.cpp + src/SampleValidator.cpp src/ScopedWorkspace.cpp src/ScriptBuilder.cpp src/ScriptRepository.cpp src/ScriptRepositoryFactory.cpp src/SpectraAxis.cpp + src/SpectraAxisValidator.cpp src/SpectrumDetectorMapping.cpp src/TableRow.cpp src/TextAxis.cpp @@ -125,7 +133,7 @@ set ( SRC_FILES src/WorkspaceHistory.cpp src/WorkspaceOpOverloads.cpp src/WorkspaceProperty.cpp - src/WorkspaceValidators.cpp + src/WorkspaceUnitValidator.cpp ) set ( SRC_UNITY_IGNORE_FILES src/CompositeFunction.cpp @@ -158,6 +166,7 @@ set ( INC_FILES inc/MantidAPI/ChopperModel.h inc/MantidAPI/Column.h inc/MantidAPI/ColumnFactory.h + inc/MantidAPI/CommonBinsValidator.h inc/MantidAPI/CompositeCatalog.h inc/MantidAPI/CompositeDomain.h inc/MantidAPI/CompositeDomainMD.h @@ -189,6 +198,7 @@ set ( INC_FILES inc/MantidAPI/FunctionValues.h inc/MantidAPI/GridDomain.h inc/MantidAPI/GridDomain1D.h + inc/MantidAPI/HistogramValidator.h inc/MantidAPI/HistoryItem.h inc/MantidAPI/HistoryView.h inc/MantidAPI/IAlgorithm.h @@ -242,7 +252,9 @@ set ( INC_FILES inc/MantidAPI/ImplicitFunctionParameterParserFactory.h inc/MantidAPI/ImplicitFunctionParser.h inc/MantidAPI/ImplicitFunctionParserFactory.h + inc/MantidAPI/IncreasingAxisValidator.h inc/MantidAPI/InstrumentDataService.h + inc/MantidAPI/InstrumentValidator.h inc/MantidAPI/Jacobian.h inc/MantidAPI/JointDomain.h inc/MantidAPI/LatticeDomain.h @@ -253,8 +265,9 @@ set ( INC_FILES inc/MantidAPI/MDGeometry.h inc/MantidAPI/MatrixWSIndexCalculator.h inc/MantidAPI/MatrixWorkspace.h - inc/MantidAPI/MatrixWorkspace_fwd.h inc/MantidAPI/MatrixWorkspaceMDIterator.h + inc/MantidAPI/MatrixWorkspaceValidator.h + inc/MantidAPI/MatrixWorkspace_fwd.h inc/MantidAPI/MemoryManager.h inc/MantidAPI/ModeratorModel.h inc/MantidAPI/MultiDomainFunction.h @@ -262,10 +275,11 @@ set ( INC_FILES inc/MantidAPI/MultiPeriodGroupWorker.h inc/MantidAPI/MultipleExperimentInfos.h inc/MantidAPI/MultipleFileProperty.h - inc/MantidAPI/NotebookBuilder.h - inc/MantidAPI/NotebookWriter.h + inc/MantidAPI/NotebookBuilder.h + inc/MantidAPI/NotebookWriter.h inc/MantidAPI/NullCoordTransform.h inc/MantidAPI/NumericAxis.h + inc/MantidAPI/NumericAxisValidator.h inc/MantidAPI/ParamFunction.h inc/MantidAPI/ParameterReference.h inc/MantidAPI/ParameterTie.h @@ -274,12 +288,14 @@ set ( INC_FILES inc/MantidAPI/Projection.h inc/MantidAPI/PropertyManagerDataService.h inc/MantidAPI/PropertyNexus.h + inc/MantidAPI/RawCountValidator.h inc/MantidAPI/RefAxis.h inc/MantidAPI/RemoteJobManagerFactory.h inc/MantidAPI/Run.h inc/MantidAPI/Sample.h inc/MantidAPI/SampleEnvironment.h inc/MantidAPI/SampleShapeValidator.h + inc/MantidAPI/SampleValidator.h inc/MantidAPI/ScopedWorkspace.h inc/MantidAPI/ScriptBuilder.h inc/MantidAPI/ScriptRepository.h @@ -287,6 +303,7 @@ set ( INC_FILES inc/MantidAPI/SingleValueParameter.h inc/MantidAPI/SingleValueParameterParser.h inc/MantidAPI/SpectraAxis.h + inc/MantidAPI/SpectraAxisValidator.h inc/MantidAPI/SpectrumDetectorMapping.h inc/MantidAPI/TableRow.h inc/MantidAPI/TextAxis.h @@ -294,14 +311,14 @@ set ( INC_FILES inc/MantidAPI/VectorParameter.h inc/MantidAPI/VectorParameterParser.h inc/MantidAPI/Workspace.h - inc/MantidAPI/Workspace_fwd.h inc/MantidAPI/WorkspaceFactory.h inc/MantidAPI/WorkspaceGroup.h inc/MantidAPI/WorkspaceGroup_fwd.h inc/MantidAPI/WorkspaceHistory.h inc/MantidAPI/WorkspaceOpOverloads.h inc/MantidAPI/WorkspaceProperty.h - inc/MantidAPI/WorkspaceValidators.h + inc/MantidAPI/WorkspaceUnitValidator.h + inc/MantidAPI/Workspace_fwd.h ) set ( TEST_FILES @@ -317,6 +334,7 @@ set ( TEST_FILES AsynchronousTest.h BinEdgeAxisTest.h BoxControllerTest.h + CommonBinsValidatorTest.h CompositeFunctionTest.h CoordTransformTest.h CostFunctionFactoryTest.h @@ -337,6 +355,7 @@ set ( TEST_FILES FunctionPropertyTest.h FunctionTest.h FunctionValuesTest.h + HistogramValidatorTest.h HistoryItemTest.h HistoryViewTest.h IEventListTest.h @@ -352,11 +371,13 @@ set ( TEST_FILES ImplicitFunctionParserFactoryTest.h IncreasingAxisValidatorTest.h InstrumentDataServiceTest.h + InstrumentValidatorTest.h LatticeDomainTest.h LiveListenerFactoryTest.h LogManagerTest.h MDGeometryTest.h MatrixWorkspaceMDIteratorTest.h + MatrixWorkspaceValidatorTest.h MemoryManagerTest.h ModeratorModelTest.h MultiDomainFunctionTest.h @@ -367,6 +388,7 @@ set ( TEST_FILES NotebookBuilderTest.h NotebookWriterTest.h NumericAxisTest.h + NumericAxisValidatorTest.h ParamFunctionAttributeHolderTest.h ParameterReferenceTest.h ParameterTieTest.h @@ -374,14 +396,17 @@ set ( TEST_FILES ProjectionTest.h PropertyManagerDataServiceTest.h PropertyNexusTest.h + RawCountValidatorTest.h RemoteJobManagerFactoryTest.h RunTest.h SampleEnvironmentTest.h SampleShapeValidatorTest.h SampleTest.h + SampleValidatorTest.h ScopedWorkspaceTest.h ScriptBuilderTest.h SpectraAxisTest.h + SpectraAxisValidatorTest.h SpectrumDetectorMappingTest.h TextAxisTest.h VectorParameterParserTest.h @@ -392,6 +417,7 @@ set ( TEST_FILES WorkspaceHistoryTest.h WorkspaceOpOverloadsTest.h WorkspacePropertyTest.h + WorkspaceUnitValidatorTest.h ) set ( GMOCK_TEST_FILES diff --git a/Framework/API/inc/MantidAPI/CommonBinsValidator.h b/Framework/API/inc/MantidAPI/CommonBinsValidator.h new file mode 100644 index 00000000000..fb979e1b574 --- /dev/null +++ b/Framework/API/inc/MantidAPI/CommonBinsValidator.h @@ -0,0 +1,52 @@ +#ifndef MANTID_API_COMMONBINSVALIDATOR_H_ +#define MANTID_API_COMMONBINSVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which provides a <I>TENTATIVE</I> check that a workspace + contains common bins in each spectrum. + For efficiency reasons, it only checks that the first and last spectra have + common bins, so it is important to carry out a full check within the + algorithm itself. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL CommonBinsValidator : public MatrixWorkspaceValidator { +public: + /// Gets the type of the validator + std::string getType() const { return "commonbins"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; +}; + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_COMMONBINSVALIDATOR_H_ */ \ No newline at end of file diff --git a/Framework/API/inc/MantidAPI/HistogramValidator.h b/Framework/API/inc/MantidAPI/HistogramValidator.h new file mode 100644 index 00000000000..e27522e1f21 --- /dev/null +++ b/Framework/API/inc/MantidAPI/HistogramValidator.h @@ -0,0 +1,55 @@ +#ifndef MANTID_API_HISTOGRAMVALIDATOR_H_ +#define MANTID_API_HISTOGRAMVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks that a workspace contains histogram data (the + default) or point data as required. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL HistogramValidator : public MatrixWorkspaceValidator { +public: + explicit HistogramValidator(const bool &mustBeHistogram = true); + + /// Gets the type of the validator + std::string getType() const { return "histogram"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + + /// A flag indicating whether this validator requires that the workspace be a + /// histogram (true) or not + const bool m_mustBeHistogram; +}; + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_HISTOGRAMVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/IncreasingAxisValidator.h b/Framework/API/inc/MantidAPI/IncreasingAxisValidator.h new file mode 100644 index 00000000000..fd7e413c668 --- /dev/null +++ b/Framework/API/inc/MantidAPI/IncreasingAxisValidator.h @@ -0,0 +1,50 @@ +#ifndef MANTID_API_INCREASINGAXISVALIDATOR_H_ +#define MANTID_API_INCREASINGAXISVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks that the X axis of a workspace is increasing from + left to right. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL IncreasingAxisValidator : public MatrixWorkspaceValidator { +public: + /// Get the type of the validator + std::string getType() const { return "IncreasingAxis"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_INCREASINGAXISVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/InstrumentValidator.h b/Framework/API/inc/MantidAPI/InstrumentValidator.h new file mode 100644 index 00000000000..e6277e1a20a --- /dev/null +++ b/Framework/API/inc/MantidAPI/InstrumentValidator.h @@ -0,0 +1,57 @@ +#ifndef MANTID_API_INSTRUMENTVALIDATOR_H_ +#define MANTID_API_INSTRUMENTVALIDATOR_H_ + +#include "MantidAPI/DllConfig.h" +#include "MantidKernel/TypedValidator.h" + +namespace Mantid { +namespace API { + +class ExperimentInfo; + +/** + A validator which checks that a workspace has a valid instrument. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL InstrumentValidator + : public Kernel::TypedValidator<boost::shared_ptr<ExperimentInfo>> { +public: + /// Enumeration describing requirements + enum Requirements { SourcePosition = 0x1, SamplePosition = 0x2 }; + + // The default is historical so I don't break a lot of user code + InstrumentValidator(const unsigned int flags = SamplePosition); + std::string getType() const; + Kernel::IValidator_sptr clone() const; + std::string + checkValidity(const boost::shared_ptr<ExperimentInfo> &value) const; + +private: + unsigned int m_requires; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_INSTRUMENTVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/MatrixWorkspaceValidator.h b/Framework/API/inc/MantidAPI/MatrixWorkspaceValidator.h new file mode 100644 index 00000000000..9d8c052b5be --- /dev/null +++ b/Framework/API/inc/MantidAPI/MatrixWorkspaceValidator.h @@ -0,0 +1,43 @@ +#ifndef MANTID_API_MATRIXWORKSPACEVALIDATOR_H_ +#define MANTID_API_MATRIXWORKSPACEVALIDATOR_H_ + +#include "MantidAPI/DllConfig.h" +#include "MantidAPI/MatrixWorkspace_fwd.h" +#include "MantidKernel/TypedValidator.h" + +namespace Mantid { +namespace API { + +/** + An interface for those validators that require the MatrixWorkspace interface + + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL MatrixWorkspaceValidator + : public Kernel::TypedValidator<MatrixWorkspace_sptr> {}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_MATRIXWORKSPACEVALIDATOR_H_ */ \ No newline at end of file diff --git a/Framework/API/inc/MantidAPI/NumericAxisValidator.h b/Framework/API/inc/MantidAPI/NumericAxisValidator.h new file mode 100644 index 00000000000..3b8f2fb7974 --- /dev/null +++ b/Framework/API/inc/MantidAPI/NumericAxisValidator.h @@ -0,0 +1,54 @@ +#ifndef MANTID_API_NUMERICAXISVALIDATOR_H_ +#define MANTID_API_NUMERICAXISVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks whether the input workspace has the Numeric data in + the axis. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL NumericAxisValidator : public MatrixWorkspaceValidator { +public: + explicit NumericAxisValidator(const int &axisNumber = 1); + + /// Gets the type of the validator + std::string getType() const { return "numericaaxis"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + /// Axis number to check on, defaults to 1 + const int m_axisNumber; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_NUMERICAXISVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/RawCountValidator.h b/Framework/API/inc/MantidAPI/RawCountValidator.h new file mode 100644 index 00000000000..d7de38a8a06 --- /dev/null +++ b/Framework/API/inc/MantidAPI/RawCountValidator.h @@ -0,0 +1,54 @@ +#ifndef MANTID_API_RAWCOUNTVALIDATOR_H_ +#define MANTID_API_RAWCOUNTVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** A validator which checks that a workspace contains raw counts in its bins. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL RawCountValidator : public MatrixWorkspaceValidator { +public: + explicit RawCountValidator(const bool &mustNotBeDistribution = true); + + /// Gets the type of the validator + std::string getType() const { return "rawcount"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + + /// A flag indicating whether this validator requires that the workspace must + /// be a distribution (false) or not (true, the default) + const bool m_mustNotBeDistribution; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_RAWCOUNTVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/SampleValidator.h b/Framework/API/inc/MantidAPI/SampleValidator.h new file mode 100644 index 00000000000..a0ee557d14f --- /dev/null +++ b/Framework/API/inc/MantidAPI/SampleValidator.h @@ -0,0 +1,51 @@ +#ifndef MANTID_API_SAMPLEVALIDATOR_H_ +#define MANTID_API_SAMPLEVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks that sample has the required properties. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL SampleValidator : public MatrixWorkspaceValidator { +public: + /// Enumeration describing requirements + enum Requirements { Shape = 0x1, Material = 0x2 }; + + SampleValidator(const unsigned int flags = (Shape | Material)); + std::string getType() const; + Kernel::IValidator_sptr clone() const; + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + +private: + unsigned int m_requires; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_SAMPLEVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/SpectraAxisValidator.h b/Framework/API/inc/MantidAPI/SpectraAxisValidator.h new file mode 100644 index 00000000000..bb96d2e5a3c --- /dev/null +++ b/Framework/API/inc/MantidAPI/SpectraAxisValidator.h @@ -0,0 +1,53 @@ +#ifndef MANTID_API_SPECTRAAXISVALIDATOR_H_ +#define MANTID_API_SPECTRAAXISVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks whether the input workspace has the Spectra number + in the axis. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL SpectraAxisValidator : public MatrixWorkspaceValidator { +public: + explicit SpectraAxisValidator(const int &axisNumber = 1); + + /// Gets the type of the validator + std::string getType() const { return "spectraaxis"; } + /// Clone the current validator + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + /// Axis number to check on, defaults to 1 + const int m_axisNumber; +}; + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_SPECTRAAXISVALIDATOR_H_ */ diff --git a/Framework/API/inc/MantidAPI/WorkspaceUnitValidator.h b/Framework/API/inc/MantidAPI/WorkspaceUnitValidator.h new file mode 100644 index 00000000000..81527ff4b54 --- /dev/null +++ b/Framework/API/inc/MantidAPI/WorkspaceUnitValidator.h @@ -0,0 +1,54 @@ +#ifndef MANTID_API_WORKSPACEUNITVALIDATOR_H_ +#define MANTID_API_WORKSPACEUNITVALIDATOR_H_ + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +namespace Mantid { +namespace API { + +/** + A validator which checks that the unit of the workspace referred to + by a WorkspaceProperty is the expected one. + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + 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 MANTID_API_DLL WorkspaceUnitValidator : public MatrixWorkspaceValidator { +public: + explicit WorkspaceUnitValidator(const std::string &unitID = ""); + /// Gets the type of the validator + std::string getType() const { return "workspaceunit"; } + /// Clone the current state + Kernel::IValidator_sptr clone() const; + +private: + /// Check for validity. + std::string checkValidity(const MatrixWorkspace_sptr &value) const; + + /// The name of the required unit + const std::string m_unitID; +}; + + +} // namespace API +} // namespace Mantid + +#endif /* MANTID_API_WORKSPACEUNITVALIDATOR_H_ */ \ No newline at end of file diff --git a/Framework/API/inc/MantidAPI/WorkspaceValidators.h b/Framework/API/inc/MantidAPI/WorkspaceValidators.h deleted file mode 100644 index f6bf5308cb4..00000000000 --- a/Framework/API/inc/MantidAPI/WorkspaceValidators.h +++ /dev/null @@ -1,409 +0,0 @@ -#ifndef MANTID_API_WORKSPACEVALIDATORS_H_ -#define MANTID_API_WORKSPACEVALIDATORS_H_ - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#include "MantidAPI/MatrixWorkspace.h" -#include "MantidKernel/TypedValidator.h" -#include "MantidKernel/CompositeValidator.h" -#include <numeric> -#include <vector> - -namespace Mantid { -namespace API { - -//=============================================================================================== -/** A validator for workspaces which can contain a number of individual - validators, - all of which must pass for the overall validator to do so. - - @author Russell Taylor, Tessella Support Services plc - @date 16/09/2008 - - Copyright © 2008-2010 ISIS Rutherford Appleton Laboratory, NScD Oak - Ridge National Laboratory & European Spallation Source - - This file is part of Mantid. - - Mantid is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - Mantid is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - 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> -*/ - -//============================================================================================== -/** - * An interface for those validators that require the MatrixWorkspace interface - */ -class MatrixWorkspaceValidator - : public Kernel::TypedValidator<MatrixWorkspace_sptr> {}; - -//=============================================================================================== -/** A validator which checks that the unit of the workspace referred to - * by a WorkspaceProperty is the expected one. - * - * @author Russell Taylor, Tessella Support Services plc - * @date 16/09/2008 - */ -class DLLExport WorkspaceUnitValidator : public MatrixWorkspaceValidator { -public: - /** Constructor - * @param unitID :: The name of the unit that the workspace must have. If - * left empty, - * the validator will simply check that the workspace is not - * unitless. - */ - explicit WorkspaceUnitValidator(const std::string &unitID = "") - : MatrixWorkspaceValidator(), m_unitID(unitID) {} - - /// Gets the type of the validator - std::string getType() const { return "workspaceunit"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<WorkspaceUnitValidator>(*this); - } - -private: - /** Checks that the units of the workspace data are declared match any - *required units - * - * @param value :: The workspace to test - * @return A user level description of the error or "" for no error - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - // This effectively checks for single-valued workspaces - if (value->axes() == 0) - return "A single valued workspace has no unit, which is required for " - "this algorithm"; - - Kernel::Unit_const_sptr unit = value->getAxis(0)->unit(); - // If m_unitID is empty it means that the workspace must have units, which - // can be anything - if (m_unitID.empty()) { - return (unit && (!boost::dynamic_pointer_cast<const Kernel::Units::Empty>( - unit)) - ? "" - : "The workspace must have units"); - } - // now check if the units of the workspace is correct - else { - if ((!unit) || (unit->unitID().compare(m_unitID))) { - return "The workspace must have units of " + - m_unitID; //+ "; its unit is: " + unit->caption(); - } else - return ""; - } - } - - /// The name of the required unit - const std::string m_unitID; -}; - -//=============================================================================================== -/** A validator which checks that a workspace contains histogram data (the - *default) - * or point data as required. - * - * @author Russell Taylor, Tessella Support Services plc - * @date 16/09/2008 - */ -class DLLExport HistogramValidator : public MatrixWorkspaceValidator { -public: - /** Constructor - * @param mustBeHistogram :: Flag indicating whether the check is that a - * workspace should - * contain histogram data (true, default) or shouldn't - * (false). - */ - explicit HistogramValidator(const bool &mustBeHistogram = true) - : MatrixWorkspaceValidator(), m_mustBeHistogram(mustBeHistogram) {} - - /// Gets the type of the validator - std::string getType() const { return "histogram"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<HistogramValidator>(*this); - } - -private: - /** Checks if the workspace contains a histogram when it shouldn't and - * vice-versa - * @param value :: The workspace to test - * @return A user level description if a problem exists or "" - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - if (m_mustBeHistogram) { - if (value->isHistogramData()) - return ""; - else - return "The workspace must contain histogram data"; - } else { - if (!value->isHistogramData()) - return ""; - else - return "The workspace must not contain histogram data"; - } - } - - /// A flag indicating whether this validator requires that the workspace be a - /// histogram (true) or not - const bool m_mustBeHistogram; -}; - -//=============================================================================================== -/** A validator which checks that a workspace contains raw counts in its bins - * - * @author Russell Taylor, Tessella Support Services plc - * @date 16/09/2008 - */ -class DLLExport RawCountValidator : public MatrixWorkspaceValidator { -public: - /** Constructor - * @param mustNotBeDistribution :: Flag indicating whether the check is that - * a workspace should - * not be a distribution (true, default) or - * should be (false). - */ - RawCountValidator(const bool &mustNotBeDistribution = true) - : m_mustNotBeDistribution(mustNotBeDistribution) {} - - /// Gets the type of the validator - std::string getType() const { return "rawcount"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<RawCountValidator>(*this); - } - -private: - /** Checks if the workspace must be a distribution but isn't and vice-versa - * @param value :: The workspace to test - * @return A user level description of any problem that exists or "" no - * problem - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - if (m_mustNotBeDistribution) { - if (!value->isDistribution()) - return ""; - else - return "A workspace containing numbers of counts is required here"; - } else { - if (value->isDistribution()) - return ""; - else - return "A workspace of numbers of counts is not allowed here"; - } - } - - /// A flag indicating whether this validator requires that the workspace must - /// be a distribution (false) or not (true, the default) - const bool m_mustNotBeDistribution; -}; - -//=============================================================================================== -/** A validator which provides a <I>TENTATIVE</I> check that a workspace - *contains - * common bins in each spectrum. - * For efficiency reasons, it only checks that the first and last spectra have - * common bins, so it is important to carry out a full check within the - *algorithm - * itself. - * - * @author Russell Taylor, Tessella Support Services plc - * @date 18/09/2008 - */ -class DLLExport CommonBinsValidator : public MatrixWorkspaceValidator { -public: - /// Gets the type of the validator - std::string getType() const { return "commonbins"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<CommonBinsValidator>(*this); - } - -private: - /** Checks that the bin boundaries of each histogram in the workspace are the - * same - * @param value :: The workspace to test - * @return A message for users saying that bins are different, otherwise "" - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - if (!value) - return "Enter an existing workspace"; - if (value->isCommonBins()) - return ""; - else - return "The workspace must have common bin boundaries for all histograms"; - } -}; -//=============================================================================================== -/** A validator which checks whether the input workspace has the Spectra number - * in the axis. - * @author Michael Whitty, STFC - * @date 15/09/2010 - */ -class DLLExport SpectraAxisValidator : public MatrixWorkspaceValidator { -public: - /** Class constructor with parameter. - * @param axisNumber :: set the axis number to validate - */ - SpectraAxisValidator(const int &axisNumber = 1) : m_axisNumber(axisNumber) {} - - /// Gets the type of the validator - std::string getType() const { return "spectraaxis"; } - /// Clone the current validator - Kernel::IValidator_sptr clone() const { - return boost::make_shared<SpectraAxisValidator>(*this); - } - -private: - /** Checks that the axis stated - * @param value :: The workspace to test - * @return A message for users with negative results, otherwise "" - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - Mantid::API::Axis *axis = value->getAxis(m_axisNumber); - if (axis->isSpectra()) - return ""; - else - return "A workspace with axis being Spectra Number is required here."; - } - const int m_axisNumber; ///< axis number to check on, defaults to 1 -}; -//=============================================================================================== -/** A validator which checks whether the input workspace has the Numeric data in - * the axis. - * @author Michael Whitty, STFC - * @date 15/09/2010 - */ -class DLLExport NumericAxisValidator : public MatrixWorkspaceValidator { -public: - /** Class constructor with parameter. - * @param axisNumber :: set the axis number to validate - */ - NumericAxisValidator(const int &axisNumber = 1) : m_axisNumber(axisNumber) {} - - /// Gets the type of the validator - std::string getType() const { return "numericaaxis"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<NumericAxisValidator>(*this); - } - -private: - /** Checks that the axis stated - * @param value :: The workspace to test - * @return A message for users with negative results, otherwise "" - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - Mantid::API::Axis *axis = value->getAxis(m_axisNumber); - if (axis->isNumeric()) - return ""; - else - return "A workspace with axis being a Numeric Axis is required here."; - } - const int m_axisNumber; ///< axis number to check on, defaults to 1 -}; - -//=============================================================================================== -/** A validator which checks that a workspace has a valid instrument - * or point data as required. - * - * @author Russell Taylor, Tessella - * @date 17/12/2010 - */ -class DLLExport InstrumentValidator - : public Kernel::TypedValidator<boost::shared_ptr<ExperimentInfo>> { -public: - /// Enumeration describing requirements - enum Requirements { SourcePosition = 0x1, SamplePosition = 0x2 }; - - // The default is historical so I don't break a lot of user code - InstrumentValidator(const unsigned int flags = SamplePosition); - std::string getType() const; - Kernel::IValidator_sptr clone() const; - std::string - checkValidity(const boost::shared_ptr<ExperimentInfo> &value) const; - -private: - unsigned int m_requires; -}; - -//============================================================================== -/** - @class SampleShapeValidator - - A validator which checks that sample has the required properties - */ -class DLLExport SampleValidator : public MatrixWorkspaceValidator { -public: - /// Enumeration describing requirements - enum Requirements { Shape = 0x1, Material = 0x2 }; - - SampleValidator(const unsigned int flags = (Shape | Material)); - std::string getType() const; - Kernel::IValidator_sptr clone() const; - std::string checkValidity(const MatrixWorkspace_sptr &value) const; - -private: - unsigned int m_requires; -}; - -//============================================================================== -/** - @class IncreasingAxisValidator - - A validator which checks that the X axis of a workspace is increasing from - left to right. - - @author Arturs Bekasovs [arturs.bekasovs@stfc.ac.uk] - @date 08/07/2013 - - TODO: Move out to the different file. - */ -class DLLExport IncreasingAxisValidator : public MatrixWorkspaceValidator { -public: - /// Get the type of the validator - std::string getType() const { return "IncreasingAxis"; } - /// Clone the current state - Kernel::IValidator_sptr clone() const { - return boost::make_shared<IncreasingAxisValidator>(*this); - } - -private: - /** - * Checks that X axis is in the right direction. - * - * @param value The workspace to check - * @return "" if is valid, otherwise a user level description of a problem - */ - std::string checkValidity(const MatrixWorkspace_sptr &value) const { - // 0 for X axis - Axis *xAxis = value->getAxis(0); - - // Left-most axis value should be less than the right-most, if ws has - // more than one X axis value - if (xAxis->length() > 1 && - xAxis->getValue(0) >= xAxis->getValue(xAxis->length() - 1)) - return "X axis of the workspace should be increasing from left to " - "right"; - else - return ""; - } -}; - -} // namespace API -} // namespace Mantid - -#endif /* MANTID_API_WORKSPACEVALIDATORS_H_ */ diff --git a/Framework/API/src/CommonBinsValidator.cpp b/Framework/API/src/CommonBinsValidator.cpp new file mode 100644 index 00000000000..0692db8c014 --- /dev/null +++ b/Framework/API/src/CommonBinsValidator.cpp @@ -0,0 +1,27 @@ +#include "MantidAPI/CommonBinsValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/// Clone the current state +Kernel::IValidator_sptr CommonBinsValidator::clone() const { + return boost::make_shared<CommonBinsValidator>(*this); +} + +/** Checks that the bin boundaries of each histogram in the workspace are the + * same + * @param value :: The workspace to test + * @return A message for users saying that bins are different, otherwise "" + */ +std::string CommonBinsValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + if (!value) + return "Enter an existing workspace"; + if (value->isCommonBins()) + return ""; + else + return "The workspace must have common bin boundaries for all histograms"; +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/HistogramValidator.cpp b/Framework/API/src/HistogramValidator.cpp new file mode 100644 index 00000000000..817ff4e05a4 --- /dev/null +++ b/Framework/API/src/HistogramValidator.cpp @@ -0,0 +1,41 @@ +#include "MantidAPI/HistogramValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/** Constructor + * + * @param mustBeHistogram :: Flag indicating whether the check is that a + * workspace should contain histogram data (true, default) or shouldn't + * (false). + */ +HistogramValidator::HistogramValidator(const bool &mustBeHistogram) + : MatrixWorkspaceValidator(), m_mustBeHistogram(mustBeHistogram) {} + +/// Clone the current state +Kernel::IValidator_sptr HistogramValidator::clone() const { + return boost::make_shared<HistogramValidator>(*this); +} + +/** Checks if the workspace contains a histogram when it shouldn't and + * vice-versa + * @param value :: The workspace to test + * @return A user level description if a problem exists or "" + */ +std::string HistogramValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + if (m_mustBeHistogram) { + if (value->isHistogramData()) + return ""; + else + return "The workspace must contain histogram data"; + } else { + if (!value->isHistogramData()) + return ""; + else + return "The workspace must not contain histogram data"; + } +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/IncreasingAxisValidator.cpp b/Framework/API/src/IncreasingAxisValidator.cpp new file mode 100644 index 00000000000..cd147c9c89a --- /dev/null +++ b/Framework/API/src/IncreasingAxisValidator.cpp @@ -0,0 +1,33 @@ +#include "MantidAPI/IncreasingAxisValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/// Clone the current state +Kernel::IValidator_sptr IncreasingAxisValidator::clone() const { + return boost::make_shared<IncreasingAxisValidator>(*this); +} + +/** + * Checks that X axis is in the right direction. + * + * @param value The workspace to check + * @return "" if is valid, otherwise a user level description of a problem + */ +std::string IncreasingAxisValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + // 0 for X axis + Axis *xAxis = value->getAxis(0); + + // Left-most axis value should be less than the right-most, if ws has + // more than one X axis value + if (xAxis->length() > 1 && + xAxis->getValue(0) >= xAxis->getValue(xAxis->length() - 1)) + return "X axis of the workspace should be increasing from left to " + "right"; + else + return ""; +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/InstrumentValidator.cpp b/Framework/API/src/InstrumentValidator.cpp new file mode 100644 index 00000000000..a8fc0b0e146 --- /dev/null +++ b/Framework/API/src/InstrumentValidator.cpp @@ -0,0 +1,56 @@ +#include "MantidAPI/InstrumentValidator.h" +#include "MantidAPI/ExperimentInfo.h" +#include "MantidKernel/Strings.h" + +namespace Mantid { +namespace API { +using Kernel::Strings::join; + +/** + * Construct a validator with requirements (default = SamplePosition) + * @param flags A combination of flags to specify requirements + */ +InstrumentValidator::InstrumentValidator(const unsigned int flags) + : m_requires(flags) {} + +/** + * @return A string type identifier for the object + */ +std::string InstrumentValidator::getType() const { return "Instrument"; } + +/** + * @return A copy of the current state of the object + */ +Kernel::IValidator_sptr InstrumentValidator::clone() const { + return boost::make_shared<InstrumentValidator>(*this); +} + +/** Checks that the workspace has an instrument defined + * @param value :: The workspace to test + * @return A user-level description if a problem exists or "" + */ +std::string InstrumentValidator::checkValidity( + const boost::shared_ptr<ExperimentInfo> &value) const { + const auto inst = value->getInstrument(); + if (!inst) + return "The workspace must have an instrument defined"; + + std::list<std::string> missing; + if ((m_requires & SourcePosition) && !inst->getSource()) { + missing.emplace_back("source"); + } + if ((m_requires & SamplePosition) && !inst->getSample()) { + missing.emplace_back("sample holder"); + } + + if (missing.empty()) + return ""; + else { + return "The instrument is missing the following " + "components: " + + join(missing.begin(), missing.end(), ","); + } +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/NumericAxisValidator.cpp b/Framework/API/src/NumericAxisValidator.cpp new file mode 100644 index 00000000000..6ad6af287b4 --- /dev/null +++ b/Framework/API/src/NumericAxisValidator.cpp @@ -0,0 +1,30 @@ +#include "MantidAPI/NumericAxisValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/** Class constructor with parameter. + * @param axisNumber :: set the axis number to validate + */ +NumericAxisValidator::NumericAxisValidator(const int &axisNumber) : m_axisNumber(axisNumber) {} + +/// Clone the current state +Kernel::IValidator_sptr NumericAxisValidator::clone() const { + return boost::make_shared<NumericAxisValidator>(*this); +} + +/** Checks that the axis stated +* @param value :: The workspace to test +* @return A message for users with negative results, otherwise "" +*/ +std::string NumericAxisValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + Mantid::API::Axis *axis = value->getAxis(m_axisNumber); + if (axis->isNumeric()) + return ""; + else + return "A workspace with axis being a Numeric Axis is required here."; +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/RawCountValidator.cpp b/Framework/API/src/RawCountValidator.cpp new file mode 100644 index 00000000000..71c3fa06fdd --- /dev/null +++ b/Framework/API/src/RawCountValidator.cpp @@ -0,0 +1,39 @@ +#include "MantidAPI/RawCountValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/** Constructor + * @param mustNotBeDistribution :: Flag indicating whether the check is that + * a workspace should not be a distribution (true, default) or should be (false). + */ +RawCountValidator::RawCountValidator(const bool &mustNotBeDistribution) + : m_mustNotBeDistribution(mustNotBeDistribution) {} + +/// Clone the current state +Kernel::IValidator_sptr RawCountValidator::clone() const { + return boost::make_shared<RawCountValidator>(*this); +} + +/** Checks if the workspace must be a distribution but isn't and vice-versa + * @param value :: The workspace to test + * @return A user level description of any problem that exists or "" no + * problem + */ +std::string RawCountValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + if (m_mustNotBeDistribution) { + if (!value->isDistribution()) + return ""; + else + return "A workspace containing numbers of counts is required here"; + } else { + if (value->isDistribution()) + return ""; + else + return "A workspace of numbers of counts is not allowed here"; + } +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/SampleValidator.cpp b/Framework/API/src/SampleValidator.cpp new file mode 100644 index 00000000000..6e85c719da2 --- /dev/null +++ b/Framework/API/src/SampleValidator.cpp @@ -0,0 +1,54 @@ +#include "MantidAPI/SampleValidator.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidKernel/Strings.h" + +namespace Mantid { +namespace API { +using Kernel::Strings::join; + +/** + * Construct a validator with a set of requirements + * @param flags A combination of SampleValidator::Requirements flags. Defaults + * to requiring both a shape and material + */ +SampleValidator::SampleValidator(const unsigned int flags) + : m_requires(flags) {} + +/** + * @return A string type identifier for the object + */ +std::string SampleValidator::getType() const { return "Sample"; } + +/** + * @return A copy of the current state of the object + */ +Kernel::IValidator_sptr SampleValidator::clone() const { + return boost::make_shared<SampleValidator>(*this); +} + +/** + * Check if the workspace satisfies the validation requirements + * @param value A pointer to a MatrixWorkspace object + * @return An empty string if the requirements are satisfied otherwise + * a string containing a message indicating the problem(s) + */ +std::string +SampleValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + const auto &shape = value->sample().getShape(); + std::list<std::string> missing; + if ((m_requires & Shape) && !shape.hasValidShape()) + missing.emplace_back("shape"); + const auto &material = shape.material(); + if ((m_requires & Material) && material.name().empty()) + missing.emplace_back("material"); + + if (missing.empty()) + return ""; + else { + return "The sample is missing the following properties: " + + join(missing.begin(), missing.end(), ","); + } +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/SpectraAxisValidator.cpp b/Framework/API/src/SpectraAxisValidator.cpp new file mode 100644 index 00000000000..6af7226a117 --- /dev/null +++ b/Framework/API/src/SpectraAxisValidator.cpp @@ -0,0 +1,30 @@ +#include "MantidAPI/SpectraAxisValidator.h" +#include "MantidAPI/MatrixWorkspace.h" + +namespace Mantid { +namespace API { + +/** Class constructor with parameter. + * @param axisNumber :: set the axis number to validate + */ +SpectraAxisValidator::SpectraAxisValidator(const int &axisNumber) : m_axisNumber(axisNumber) {} + +/// Clone the current validator +Kernel::IValidator_sptr SpectraAxisValidator::clone() const { + return boost::make_shared<SpectraAxisValidator>(*this); +} + +/** Checks that the axis stated +* @param value :: The workspace to test +* @return A message for users with negative results, otherwise "" +*/ +std::string SpectraAxisValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + Mantid::API::Axis *axis = value->getAxis(m_axisNumber); + if (axis->isSpectra()) + return ""; + else + return "A workspace with axis being Spectra Number is required here."; +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/WorkspaceUnitValidator.cpp b/Framework/API/src/WorkspaceUnitValidator.cpp new file mode 100644 index 00000000000..f6fdf18c7f0 --- /dev/null +++ b/Framework/API/src/WorkspaceUnitValidator.cpp @@ -0,0 +1,56 @@ +#include "MantidAPI/WorkspaceUnitValidator.h" +#include "MantidAPI/MatrixWorkspace.h" +#include "MantidKernel/Unit.h" + +namespace Mantid { +namespace API { + +/** Constructor + * + * @param unitID :: The name of the unit that the workspace must have. If + * left empty, the validator will simply check that the workspace is not + * unitless. + */ +WorkspaceUnitValidator::WorkspaceUnitValidator(const std::string &unitID) + : MatrixWorkspaceValidator(), m_unitID(unitID) {} + +/** + * Clone the current state + */ +Kernel::IValidator_sptr WorkspaceUnitValidator::clone() const { + return boost::make_shared<WorkspaceUnitValidator>(*this); +} + +/** Checks that the units of the workspace data are declared match any + * required units + * + * @param value :: The workspace to test + * @return A user level description of the error or "" for no error + */ +std::string WorkspaceUnitValidator::checkValidity(const MatrixWorkspace_sptr &value) const { + // This effectively checks for single-valued workspaces + if (value->axes() == 0) + return "A single valued workspace has no unit, which is required for " + "this algorithm"; + + Kernel::Unit_const_sptr unit = value->getAxis(0)->unit(); + // If m_unitID is empty it means that the workspace must have units, which + // can be anything + if (m_unitID.empty()) { + return (unit && (!boost::dynamic_pointer_cast<const Kernel::Units::Empty>( + unit)) + ? "" + : "The workspace must have units"); + } + // now check if the units of the workspace is correct + else { + if ((!unit) || (unit->unitID().compare(m_unitID))) { + return "The workspace must have units of " + + m_unitID; //+ "; its unit is: " + unit->caption(); + } else + return ""; + } +} + +} // namespace API +} // namespace Mantid diff --git a/Framework/API/src/WorkspaceValidators.cpp b/Framework/API/src/WorkspaceValidators.cpp deleted file mode 100644 index d6d6efa3460..00000000000 --- a/Framework/API/src/WorkspaceValidators.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "MantidAPI/WorkspaceValidators.h" - -namespace Mantid { -using Kernel::Strings::join; - -namespace API { - -//------------------------------------------------------------------------------ -// InstrumentValidator -//------------------------------------------------------------------------------ -/** - * Construct a validator with requirements (default = SamplePosition) - * @param flags A combination of flags to specify requirements - */ -InstrumentValidator::InstrumentValidator(const unsigned int flags) - : m_requires(flags) {} - -/** - * @return A string type identifier for the object - */ -std::string InstrumentValidator::getType() const { return "Instrument"; } - -/** - * @return A copy of the current state of the object - */ -Kernel::IValidator_sptr InstrumentValidator::clone() const { - return boost::make_shared<InstrumentValidator>(*this); -} - -/** Checks that the workspace has an instrument defined - * @param value :: The workspace to test - * @return A user-level description if a problem exists or "" - */ -std::string InstrumentValidator::checkValidity( - const boost::shared_ptr<ExperimentInfo> &value) const { - const auto inst = value->getInstrument(); - if (!inst) - return "The workspace must have an instrument defined"; - - std::list<std::string> missing; - if ((m_requires & SourcePosition) && !inst->getSource()) { - missing.emplace_back("source"); - } - if ((m_requires & SamplePosition) && !inst->getSample()) { - missing.emplace_back("sample holder"); - } - - if (missing.empty()) - return ""; - else { - return "The instrument is missing the following " - "components: " + - join(missing.begin(), missing.end(), ","); - } -} - -//------------------------------------------------------------------------------ -// SampleValidator -//------------------------------------------------------------------------------ -/** - * Construct a validator with a set of requirements - * @param flags A combination of SampleValidator::Requirements flags. Defaults - * to requiring both a shape and material - */ -SampleValidator::SampleValidator(const unsigned int flags) - : m_requires(flags) {} - -/** - * @return A string type identifier for the object - */ -std::string SampleValidator::getType() const { return "Sample"; } - -/** - * @return A copy of the current state of the object - */ -Kernel::IValidator_sptr SampleValidator::clone() const { - return boost::make_shared<SampleValidator>(*this); -} - -/** - * Check if the workspace satisfies the validation requirements - * @param value A pointer to a MatrixWorkspace object - * @return An empty string if the requirements are satisfied otherwise - * a string containing a message indicating the problem(s) - */ -std::string -SampleValidator::checkValidity(const MatrixWorkspace_sptr &value) const { - const auto &shape = value->sample().getShape(); - std::list<std::string> missing; - if ((m_requires & Shape) && !shape.hasValidShape()) - missing.emplace_back("shape"); - const auto &material = shape.material(); - if ((m_requires & Material) && material.name().empty()) - missing.emplace_back("material"); - - if (missing.empty()) - return ""; - else { - return "The sample is missing the following properties: " + - join(missing.begin(), missing.end(), ","); - } -} -} -} diff --git a/Framework/API/test/CommonBinsValidatorTest.h b/Framework/API/test/CommonBinsValidatorTest.h new file mode 100644 index 00000000000..6b6bec0f7f8 --- /dev/null +++ b/Framework/API/test/CommonBinsValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_COMMONBINSVALIDATORTEST_H_ +#define MANTID_API_COMMONBINSVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/CommonBinsValidator.h" + +using Mantid::API::CommonBinsValidator; + +class CommonBinsValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static CommonBinsValidatorTest *createSuite() { return new CommonBinsValidatorTest(); } + static void destroySuite( CommonBinsValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_COMMONBINSVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/HistogramValidatorTest.h b/Framework/API/test/HistogramValidatorTest.h new file mode 100644 index 00000000000..d8914567bc7 --- /dev/null +++ b/Framework/API/test/HistogramValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_HISTOGRAMVALIDATORTEST_H_ +#define MANTID_API_HISTOGRAMVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/HistogramValidator.h" + +using Mantid::API::HistogramValidator; + +class HistogramValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static HistogramValidatorTest *createSuite() { return new HistogramValidatorTest(); } + static void destroySuite( HistogramValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_HISTOGRAMVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/InstrumentValidatorTest.h b/Framework/API/test/InstrumentValidatorTest.h new file mode 100644 index 00000000000..7c9894a5e5a --- /dev/null +++ b/Framework/API/test/InstrumentValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_INSTRUMENTVALIDATORTEST_H_ +#define MANTID_API_INSTRUMENTVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/InstrumentValidator.h" + +using Mantid::API::InstrumentValidator; + +class InstrumentValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static InstrumentValidatorTest *createSuite() { return new InstrumentValidatorTest(); } + static void destroySuite( InstrumentValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_INSTRUMENTVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/MatrixWorkspaceValidatorTest.h b/Framework/API/test/MatrixWorkspaceValidatorTest.h new file mode 100644 index 00000000000..1f16a48247f --- /dev/null +++ b/Framework/API/test/MatrixWorkspaceValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_MATRIXWORKSPACEVALIDATORTEST_H_ +#define MANTID_API_MATRIXWORKSPACEVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/MatrixWorkspaceValidator.h" + +using Mantid::API::MatrixWorkspaceValidator; + +class MatrixWorkspaceValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static MatrixWorkspaceValidatorTest *createSuite() { return new MatrixWorkspaceValidatorTest(); } + static void destroySuite( MatrixWorkspaceValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_MATRIXWORKSPACEVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/NumericAxisValidatorTest.h b/Framework/API/test/NumericAxisValidatorTest.h new file mode 100644 index 00000000000..3634e8ece0a --- /dev/null +++ b/Framework/API/test/NumericAxisValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_NUMERICAXISVALIDATORTEST_H_ +#define MANTID_API_NUMERICAXISVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/NumericAxisValidator.h" + +using Mantid::API::NumericAxisValidator; + +class NumericAxisValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static NumericAxisValidatorTest *createSuite() { return new NumericAxisValidatorTest(); } + static void destroySuite( NumericAxisValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_NUMERICAXISVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/RawCountValidatorTest.h b/Framework/API/test/RawCountValidatorTest.h new file mode 100644 index 00000000000..e4221089bb8 --- /dev/null +++ b/Framework/API/test/RawCountValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_RAWCOUNTVALIDATORTEST_H_ +#define MANTID_API_RAWCOUNTVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/RawCountValidator.h" + +using Mantid::API::RawCountValidator; + +class RawCountValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static RawCountValidatorTest *createSuite() { return new RawCountValidatorTest(); } + static void destroySuite( RawCountValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_RAWCOUNTVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/SampleValidatorTest.h b/Framework/API/test/SampleValidatorTest.h new file mode 100644 index 00000000000..0ae6e9fe1b1 --- /dev/null +++ b/Framework/API/test/SampleValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_SAMPLEVALIDATORTEST_H_ +#define MANTID_API_SAMPLEVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/SampleValidator.h" + +using Mantid::API::SampleValidator; + +class SampleValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static SampleValidatorTest *createSuite() { return new SampleValidatorTest(); } + static void destroySuite( SampleValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_SAMPLEVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/SpectraAxisValidatorTest.h b/Framework/API/test/SpectraAxisValidatorTest.h new file mode 100644 index 00000000000..70f35471f72 --- /dev/null +++ b/Framework/API/test/SpectraAxisValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_SPECTRAAXISVALIDATORTEST_H_ +#define MANTID_API_SPECTRAAXISVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/SpectraAxisValidator.h" + +using Mantid::API::SpectraAxisValidator; + +class SpectraAxisValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static SpectraAxisValidatorTest *createSuite() { return new SpectraAxisValidatorTest(); } + static void destroySuite( SpectraAxisValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_SPECTRAAXISVALIDATORTEST_H_ */ \ No newline at end of file diff --git a/Framework/API/test/WorkspaceUnitValidatorTest.h b/Framework/API/test/WorkspaceUnitValidatorTest.h new file mode 100644 index 00000000000..3e3d13b23be --- /dev/null +++ b/Framework/API/test/WorkspaceUnitValidatorTest.h @@ -0,0 +1,27 @@ +#ifndef MANTID_API_WORKSPACEUNITVALIDATORTEST_H_ +#define MANTID_API_WORKSPACEUNITVALIDATORTEST_H_ + +#include <cxxtest/TestSuite.h> + +#include "MantidAPI/WorkspaceUnitValidator.h" + +using Mantid::API::WorkspaceUnitValidator; + +class WorkspaceUnitValidatorTest : public CxxTest::TestSuite { +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static WorkspaceUnitValidatorTest *createSuite() { return new WorkspaceUnitValidatorTest(); } + static void destroySuite( WorkspaceUnitValidatorTest *suite ) { delete suite; } + + + void test_Something() + { + TS_FAIL( "You forgot to write a test!"); + } + + +}; + + +#endif /* MANTID_API_WORKSPACEUNITVALIDATORTEST_H_ */ \ No newline at end of file -- GitLab