Mantid
Loading...
Searching...
No Matches
NumericAxisValidator.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 +
8#include "MantidAPI/Axis.h"
10
11namespace Mantid::API {
12
16NumericAxisValidator::NumericAxisValidator(const int &axisNumber) : m_axisNumber(axisNumber) {}
17
19Kernel::IValidator_sptr NumericAxisValidator::clone() const { return std::make_shared<NumericAxisValidator>(*this); }
20
27 try {
28 axis = value->getAxis(m_axisNumber);
30 return "No axis at index " + std::to_string(m_axisNumber) + " available in the workspace";
31 }
32
33 if (axis->isNumeric())
34 return "";
35 else
36 return "A workspace with axis being a Numeric Axis is required here.";
37}
38
39} // namespace Mantid::API
double value
The value of the point.
Definition: FitMW.cpp:51
Class to represent the axis of a workspace.
Definition: Axis.h:30
virtual bool isNumeric() const
Returns true if the axis is numeric.
Definition: Axis.h:52
const int m_axisNumber
Axis number to check on, defaults to 1.
std::string checkValidity(const MatrixWorkspace_sptr &value) const override
Check for validity.
Kernel::IValidator_sptr clone() const override
Clone the current state.
NumericAxisValidator(const int &axisNumber=1)
Class constructor with parameter.
Exception for index errors.
Definition: Exception.h:284
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
std::string to_string(const wide_integer< Bits, Signed > &n)