Mantid
Loading...
Searching...
No Matches
MDFrameValidator.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#include <memory>
10#include <utility>
11
13
14namespace Mantid::API {
15
20MDFrameValidator::MDFrameValidator(std::string frameName) : m_frameID{std::move(frameName)} {}
21
25Kernel::IValidator_sptr MDFrameValidator::clone() const { return std::make_shared<MDFrameValidator>(*this); }
26
33
34 for (size_t index = 0; index < workspace->getNumDims(); ++index) {
35 const auto dimension = workspace->getDimension(index);
36 if (dimension->getMDFrame().name() != m_frameID)
37 return "MDWorkspace must be in the " + m_frameID + " frame.";
38 }
39
40 return "";
41}
42
43} // namespace Mantid::API
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
MDFrameValidator(std::string frameName)
Constructor.
const std::string m_frameID
The name of the required frame.
std::string checkValidity(const IMDWorkspace_sptr &workspace) const override
Check for validity.
Kernel::IValidator_sptr clone() const override
Clone the current state.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26
STL namespace.