Skip to content

Commit

Permalink
Re #11035. Split workspace validators into files.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Oct 12, 2015
1 parent 2902120 commit 651af50
Show file tree
Hide file tree
Showing 31 changed files with 1,166 additions and 524 deletions.
42 changes: 34 additions & 8 deletions Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -253,19 +265,21 @@ 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
inc/MantidAPI/MultiPeriodGroupAlgorithm.h
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
Expand All @@ -274,34 +288,37 @@ 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
inc/MantidAPI/ScriptRepositoryFactory.h
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
inc/MantidAPI/TransformScaleFactory.h
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
Expand All @@ -317,6 +334,7 @@ set ( TEST_FILES
AsynchronousTest.h
BinEdgeAxisTest.h
BoxControllerTest.h
CommonBinsValidatorTest.h
CompositeFunctionTest.h
CoordTransformTest.h
CostFunctionFactoryTest.h
Expand All @@ -337,6 +355,7 @@ set ( TEST_FILES
FunctionPropertyTest.h
FunctionTest.h
FunctionValuesTest.h
HistogramValidatorTest.h
HistoryItemTest.h
HistoryViewTest.h
IEventListTest.h
Expand All @@ -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
Expand All @@ -367,21 +388,25 @@ set ( TEST_FILES
NotebookBuilderTest.h
NotebookWriterTest.h
NumericAxisTest.h
NumericAxisValidatorTest.h
ParamFunctionAttributeHolderTest.h
ParameterReferenceTest.h
ParameterTieTest.h
PeakFunctionIntegratorTest.h
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
Expand All @@ -392,6 +417,7 @@ set ( TEST_FILES
WorkspaceHistoryTest.h
WorkspaceOpOverloadsTest.h
WorkspacePropertyTest.h
WorkspaceUnitValidatorTest.h
)

set ( GMOCK_TEST_FILES
Expand Down
52 changes: 52 additions & 0 deletions Framework/API/inc/MantidAPI/CommonBinsValidator.h
Original file line number Diff line number Diff line change
@@ -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 &copy; 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_ */
55 changes: 55 additions & 0 deletions Framework/API/inc/MantidAPI/HistogramValidator.h
Original file line number Diff line number Diff line change
@@ -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 &copy; 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_ */
50 changes: 50 additions & 0 deletions Framework/API/inc/MantidAPI/IncreasingAxisValidator.h
Original file line number Diff line number Diff line change
@@ -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 &copy; 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_ */

0 comments on commit 651af50

Please sign in to comment.