Mantid
Loading...
Searching...
No Matches
HistogramValidator.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9
10namespace Mantid::API {
11
18HistogramValidator::HistogramValidator(const bool &mustBeHistogram)
19 : MatrixWorkspaceValidator(), m_mustBeHistogram(mustBeHistogram) {}
20
22Kernel::IValidator_sptr HistogramValidator::clone() const { return std::make_shared<HistogramValidator>(*this); }
23
31 if (value->isHistogramData())
32 return "";
33 else
34 return "The workspace must contain histogram data";
35 } else {
36 if (!value->isHistogramData())
37 return "";
38 else
39 return "The workspace must not contain histogram data";
40 }
41}
42
43} // namespace Mantid::API
double value
The value of the point.
Definition: FitMW.cpp:51
Kernel::IValidator_sptr clone() const override
Clone the current state.
std::string checkValidity(const MatrixWorkspace_sptr &value) const override
Check for validity.
HistogramValidator(const bool &mustBeHistogram=true)
Constructor.
const bool m_mustBeHistogram
A flag indicating whether this validator requires that the workspace be a histogram (true) or not.
An interface for those validators that require the MatrixWorkspace interface.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26