Mantid
Loading...
Searching...
No Matches
FunctionModelDataset.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 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
9#include <stdexcept>
10#include <utility>
11
13
15 : m_workspaceName(std::move(workspaceName)), m_spectra(std::move(spectra)) {}
16
24 const auto numberOfSpectra = m_spectra.size().value;
25 if (numberOfSpectra == 0u)
26 throw std::runtime_error("There are no spectra in this Dataset.");
27 if (numberOfSpectra == 1u)
28 return QStringList(m_workspaceName);
29 else {
30 QStringList domainNames;
31 for (const auto &spectrum : m_spectra)
32 domainNames << m_workspaceName + " (" + QString::number(spectrum.value) + ")";
33 return domainNames;
34 }
35}
36
37} // namespace MantidQt::MantidWidgets
STL namespace.
QStringList domainNames() const
Returns the names given to each domain (i.e.
FunctionModelDataset(QString workspaceName, FunctionModelSpectra spectra)
IntImplementationType value
Definition: IndexTypes.h:26