Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::API::TextAxis Class Reference

Class to represent a text axis of a workspace. More...

#include <TextAxis.h>

Inheritance diagram for Mantid::API::TextAxis:
Mantid::API::Axis

Public Member Functions

Axisclone (const MatrixWorkspace *const parentWorkspace) override
 Virtual constructor.
 
Axisclone (const std::size_t length, const MatrixWorkspace *const parentWorkspace) override
 Virtual constructor for axis of different length.
 
double getMax () const override
 returns max value defined on axis
 
double getMin () const override
 returns min value defined on axis
 
size_t indexOfValue (const double value) const override
 Returns the value that has been passed to it as a size_t.
 
bool isText () const override
 If this is a TextAxis, always return true for this class.
 
std::string label (const std::size_t &index) const override
 Get the label at the specified index.
 
std::size_t length () const override
 Get the length of the axis.
 
double operator() (const std::size_t &index, const std::size_t &verticalIndex=0) const override
 Get a value at the specified index.
 
bool operator== (const Axis &) const override
 Check if two axis defined as spectra or numeric axis are equivalent.
 
bool operator== (const TextAxis &) const
 Check if two TextAxis are equivalent.
 
void setLabel (const std::size_t &index, const std::string &lbl)
 Set the label at the given index.
 
void setValue (const std::size_t &index, const double &value) override
 Set the value at the specified index.
 
 TextAxis (const std::size_t &length)
 Constructor.
 
- Public Member Functions inherited from Mantid::API::Axis
 Axis ()
 Constructor.
 
double getValue (const std::size_t &index, const std::size_t &verticalIndex=0) const
 Gets the value at the specified index.
 
virtual bool isNumeric () const
 Returns true if the axis is numeric.
 
virtual bool isSpectra () const
 Returns true is the axis is a Spectra axis.
 
virtual const std::shared_ptr< Kernel::Unit > & setUnit (const std::string &unitName)
 Set the unit on the Axis.
 
virtual specnum_t spectraNo (const std::size_t &index) const
 Get the spectrum number.
 
std::string & title ()
 Returns a reference to the user-defined title for this axis.
 
const std::string & title () const
 Returns the user-defined title for this axis.
 
std::shared_ptr< Kernel::Unit > & unit ()
 The unit object for this workspace (non const version)
 
const std::shared_ptr< Kernel::Unit > & unit () const
 The unit for this axis.
 
virtual ~Axis ()=default
 

Private Member Functions

bool compareToTextAxis (const TextAxis &axis2) const
 

Private Attributes

std::vector< std::string > m_values
 A vector holding the axis values for the axis.
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::API::Axis
 Axis (const Axis &)=default
 
Axisoperator= (const Axis &)=default
 

Detailed Description

Class to represent a text axis of a workspace.

Author
Roman Tolchenov, Tessella plc
Date
06/07/2010

Definition at line 36 of file TextAxis.h.

Constructor & Destructor Documentation

◆ TextAxis()

Mantid::API::TextAxis::TextAxis ( const std::size_t &  length)

Constructor.

Parameters
lengththe size of the text axis

Definition at line 20 of file TextAxis.cpp.

References length(), and m_values.

Member Function Documentation

◆ clone() [1/2]

Axis * Mantid::API::TextAxis::clone ( const MatrixWorkspace *const  parentWorkspace)
overridevirtual

Virtual constructor.

Parameters
parentWorkspace:: The workspace is not used in this implementation
Returns
A pointer to a copy of the TextAxis on which the method is called

Implements Mantid::API::Axis.

Definition at line 26 of file TextAxis.cpp.

References UNUSED_ARG.

◆ clone() [2/2]

Axis * Mantid::API::TextAxis::clone ( const std::size_t  length,
const MatrixWorkspace *const  parentWorkspace 
)
overridevirtual

Virtual constructor for axis of different length.

Implements Mantid::API::Axis.

Definition at line 31 of file TextAxis.cpp.

References length(), and UNUSED_ARG.

◆ compareToTextAxis()

bool Mantid::API::TextAxis::compareToTextAxis ( const TextAxis axis2) const
private

Definition at line 83 of file TextAxis.cpp.

References length(), and m_values.

Referenced by operator==(), and operator==().

◆ getMax()

double Mantid::API::TextAxis::getMax ( ) const
overridevirtual

returns max value defined on axis

Implements Mantid::API::Axis.

Definition at line 132 of file TextAxis.cpp.

References getMin(), and m_values.

◆ getMin()

double Mantid::API::TextAxis::getMin ( ) const
overridevirtual

returns min value defined on axis

Implements Mantid::API::Axis.

Definition at line 123 of file TextAxis.cpp.

References m_values.

Referenced by getMax().

◆ indexOfValue()

size_t Mantid::API::TextAxis::indexOfValue ( const double  value) const
overridevirtual

Returns the value that has been passed to it as a size_t.

Implements Mantid::API::Axis.

Definition at line 68 of file TextAxis.cpp.

References Mantid::Kernel::VectorHelper::indexOfValueFromCenters(), length(), spectraNumbers, and value.

◆ isText()

bool Mantid::API::TextAxis::isText ( ) const
inlineoverridevirtual

If this is a TextAxis, always return true for this class.

Reimplemented from Mantid::API::Axis.

Definition at line 43 of file TextAxis.h.

◆ label()

std::string Mantid::API::TextAxis::label ( const std::size_t &  index) const
overridevirtual

Get the label at the specified index.

Returns a text label which shows the value at index and identifies the type of the axis.

Parameters
index:: The index of an axis value
Returns
The label

Implements Mantid::API::Axis.

Definition at line 107 of file TextAxis.cpp.

References index, and m_values.

Referenced by export_TextAxis().

◆ length()

std::size_t Mantid::API::TextAxis::length ( ) const
inlineoverridevirtual

◆ operator()()

double Mantid::API::TextAxis::operator() ( const std::size_t &  index,
const std::size_t &  verticalIndex = 0 
) const
overridevirtual

Get a value at the specified index.

Get the axis value at the position given.

Parameters
indexThe position along the axis for which the value is required
verticalIndexNeeded for the subclass (RefAxis) method, but ignored (and defaulted) here
Returns
The value of the axis as a double
Exceptions
IndexErrorIf the index requested is not in the range of this axis

Implements Mantid::API::Axis.

Definition at line 46 of file TextAxis.cpp.

References Mantid::EMPTY_DBL(), index, length(), and UNUSED_ARG.

◆ operator==() [1/2]

bool Mantid::API::TextAxis::operator== ( const Axis axis2) const
overridevirtual

Check if two axis defined as spectra or numeric axis are equivalent.

Parameters
axis2:: Reference to the axis to compare to
Returns
true if self and other axis are equal

Implements Mantid::API::Axis.

Definition at line 94 of file TextAxis.cpp.

References compareToTextAxis().

◆ operator==() [2/2]

bool Mantid::API::TextAxis::operator== ( const TextAxis axis2) const

Check if two TextAxis are equivalent.

Parameters
axis2:: Reference to the axis to compare to
Returns
true if self and other axis are equal

Definition at line 81 of file TextAxis.cpp.

References compareToTextAxis().

◆ setLabel()

void Mantid::API::TextAxis::setLabel ( const std::size_t &  index,
const std::string &  lbl 
)

◆ setValue()

void Mantid::API::TextAxis::setValue ( const std::size_t &  index,
const double &  value 
)
overridevirtual

Set the value at the specified index.

Sets the axis value at a given position.

Parameters
index:: The position along the axis for which to set the value
value:: The new value
Exceptions
IndexErrorIf the index requested is not in the range of this axis

Implements Mantid::API::Axis.

Definition at line 60 of file TextAxis.cpp.

References index, UNUSED_ARG, and value.

Member Data Documentation

◆ m_values

std::vector<std::string> Mantid::API::TextAxis::m_values
private

A vector holding the axis values for the axis.

Definition at line 63 of file TextAxis.h.

Referenced by compareToTextAxis(), getMax(), getMin(), label(), setLabel(), and TextAxis().


The documentation for this class was generated from the following files: