Mantid
Loading...
Searching...
No Matches
Axis.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 +
7#include "MantidAPI/Axis.h"
9#include "MantidKernel/Unit.h"
11
12namespace Mantid::API {
13
14using std::size_t;
15
17Axis::Axis() : m_title(), m_unit(Mantid::Kernel::UnitFactory::Instance().create("Empty")) {}
18
20const std::string &Axis::title() const { return m_title; }
21
23std::string &Axis::title() { return m_title; }
24
28const Kernel::Unit_sptr &Axis::unit() const { return m_unit; }
29
39const Kernel::Unit_sptr &Axis::setUnit(const std::string &unitName) {
41 return unit();
42}
43
51double Axis::getValue(const std::size_t &index, const std::size_t &verticalIndex) const {
52 return (*this)(index, verticalIndex);
53}
54
60specnum_t Axis::spectraNo(const std::size_t &index) const {
62 throw std::domain_error("Cannot call spectraNo() on a non-spectra axis.");
63}
64
65} // namespace Mantid::API
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
const std::string & title() const
Returns the user-defined title for this axis.
Definition: Axis.cpp:20
virtual const std::shared_ptr< Kernel::Unit > & setUnit(const std::string &unitName)
Set the unit on the Axis.
Definition: Axis.cpp:39
virtual specnum_t spectraNo(const std::size_t &index) const
Get the spectrum number.
Definition: Axis.cpp:60
std::shared_ptr< Kernel::Unit > m_unit
The unit for this axis.
Definition: Axis.h:97
std::string m_title
The user-defined title for this axis.
Definition: Axis.h:95
const std::shared_ptr< Kernel::Unit > & unit() const
The unit for this axis.
Definition: Axis.cpp:28
double getValue(const std::size_t &index, const std::size_t &verticalIndex=0) const
Gets the value at the specified index.
Definition: Axis.cpp:51
Axis()
Constructor.
Definition: Axis.cpp:17
Manage the lifetime of a class intended to be a singleton.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
std::shared_ptr< Unit > Unit_sptr
Shared pointer to the Unit base class.
Definition: Unit.h:229
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16