Mantid
Loading...
Searching...
No Matches
SpectraAxisValidator.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
16SpectraAxisValidator::SpectraAxisValidator(const int &axisNumber) : m_axisNumber(axisNumber) {}
17
19Kernel::IValidator_sptr SpectraAxisValidator::clone() const { return std::make_shared<SpectraAxisValidator>(*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->isSpectra())
34 return "";
35 else
36 return "A workspace with axis being Spectra Number 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 isSpectra() const
Returns true is the axis is a Spectra axis.
Definition: Axis.h:50
SpectraAxisValidator(const int &axisNumber=1)
Class constructor with parameter.
Kernel::IValidator_sptr clone() const override
Clone the current validator.
std::string checkValidity(const MatrixWorkspace_sptr &value) const override
Check for validity.
const int m_axisNumber
Axis number to check on, defaults to 1.
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)