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

A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the expected one. More...

#include <WorkspaceUnitValidator.h>

Inheritance diagram for Mantid::API::WorkspaceUnitValidator:
Mantid::API::MatrixWorkspaceValidator

Public Member Functions

Kernel::IValidator_sptr clone () const override
 Clone the current state. More...
 
std::string getType () const
 Gets the type of the validator. More...
 
 WorkspaceUnitValidator (std::string unitID="")
 Constructor. More...
 

Private Member Functions

std::string checkValidity (const MatrixWorkspace_sptr &value) const override
 Check for validity. More...
 

Private Attributes

const std::string m_unitID
 The name of the required unit. More...
 

Detailed Description

A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the expected one.

Definition at line 18 of file WorkspaceUnitValidator.h.

Constructor & Destructor Documentation

◆ WorkspaceUnitValidator()

Mantid::API::WorkspaceUnitValidator::WorkspaceUnitValidator ( std::string  unitID = "")
explicit

Constructor.

Parameters
unitID:: The name of the unit that the workspace must have. If left empty, the validator will simply check that the workspace is not unitless.

Definition at line 22 of file WorkspaceUnitValidator.cpp.

Member Function Documentation

◆ checkValidity()

std::string Mantid::API::WorkspaceUnitValidator::checkValidity ( const MatrixWorkspace_sptr value) const
overrideprivate

Check for validity.

Checks that the units of the workspace data are declared match any required units.

Parameters
value:: The workspace to test
Returns
A user level description of the error or "" for no error

Definition at line 38 of file WorkspaceUnitValidator.cpp.

References m_unitID, and value.

◆ clone()

Kernel::IValidator_sptr Mantid::API::WorkspaceUnitValidator::clone ( ) const
override

Clone the current state.

Definition at line 28 of file WorkspaceUnitValidator.cpp.

◆ getType()

std::string Mantid::API::WorkspaceUnitValidator::getType ( ) const
inline

Gets the type of the validator.

Definition at line 22 of file WorkspaceUnitValidator.h.

Member Data Documentation

◆ m_unitID

const std::string Mantid::API::WorkspaceUnitValidator::m_unitID
private

The name of the required unit.

Definition at line 31 of file WorkspaceUnitValidator.h.

Referenced by checkValidity().


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