Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Kernel::BoundedValidator< TYPE > Class Template Referencefinal

BoundedValidator is a validator that requires the values to be between upper or lower bounds, or both. More...

#include <Kernel/BoundedValidator.h>

Inheritance diagram for Mantid::Kernel::BoundedValidator< TYPE >:

Public Member Functions

 BoundedValidator () noexcept
 No-arg Constructor.
 
 BoundedValidator (const TYPE &lowerBound, const TYPE &upperBound, bool exclusive=false) noexcept
 Constructor.
 
void clearBounds () noexcept
 Clear both bounds (lower and upper) at the same time.
 
void clearLower () noexcept
 Clear lower bound value.
 
void clearUpper () noexcept
 Clear upper bound value.
 
IValidator_sptr clone () const override
 Clone the current state.
 
bool hasLower () const noexcept
 Return if it has a lower bound.
 
bool hasUpper () const noexcept
 Return if it has a lower bound.
 
bool isLowerExclusive () const noexcept
 Check if lower bound is exclusive.
 
bool isUpperExclusive () const noexcept
 Check if upper bound is exclusive.
 
const TYPE & lower () const noexcept
 Return the lower bound value.
 
void setBounds (const TYPE &lower, const TYPE &upper) noexcept
 Set both bounds (lower and upper) at the same time.
 
void setError (const std::string &value)
 
void setError (const TYPE &value)
 Set the allowed error.
 
void setExclusive (const bool exclusive) noexcept
 Set both the upper and lower bounds to be exclusive.
 
void setLower (const TYPE &value) noexcept
 Set lower bound value.
 
void setLowerExclusive (const bool exclusive) noexcept
 Set the lower bound to be exclusive.
 
void setUpper (const TYPE &value) noexcept
 Set upper bound value.
 
void setUpperExclusive (const bool exclusive) noexcept
 Set the upper bound to be exclusive.
 
const TYPE & upper () const noexcept
 Return the upper bound value.
 

Private Member Functions

std::string checkValidity (const TYPE &value) const override
 Checks that the value is within any upper and lower limits.
 
double errorAdjustment (const double &boundingValue, const int boundID) const
 
int errorAdjustment (const int &boundingValue, const int boundID) const
 
TYPE errorAdjustment (const TYPE &boundingValue, const int boundID) const
 

Private Attributes

TYPE m_error
 the allowed error
 
bool m_hasError
 Has an error set true/false.
 
bool m_hasLowerBound
 Has a lower bound set true/false.
 
bool m_hasUpperBound
 Has a upper bound set true/false.
 
TYPE m_lowerBound
 the lower bound
 
bool m_lowerExclusive
 Lower bound is exclusive.
 
TYPE m_upperBound
 the upper bound
 
bool m_upperExclusive
 Upper bound is exclusive.
 

Detailed Description

template<class TYPE>
class Mantid::Kernel::BoundedValidator< TYPE >

BoundedValidator is a validator that requires the values to be between upper or lower bounds, or both.

It offers both inclusive or exclusive bounds. By default the validator uses inclusive bounds.

Author
Nick Draper, Tessella Support Services plc
Date
28/11/2007

Definition at line 32 of file BoundedValidator.h.

Constructor & Destructor Documentation

◆ BoundedValidator() [1/2]

template<class TYPE >
Mantid::Kernel::BoundedValidator< TYPE >::BoundedValidator ( )
inlinenoexcept

No-arg Constructor.

Definition at line 35 of file BoundedValidator.h.

◆ BoundedValidator() [2/2]

template<class TYPE >
Mantid::Kernel::BoundedValidator< TYPE >::BoundedValidator ( const TYPE &  lowerBound,
const TYPE &  upperBound,
bool  exclusive = false 
)
inlinenoexcept

Constructor.

Parameters
lowerBound:: The lower bounding value
upperBound:: The upper bounding value
exclusive:: make bounds exclusive (default inclusive)

Definition at line 44 of file BoundedValidator.h.

Member Function Documentation

◆ checkValidity()

template<class TYPE >
std::string Mantid::Kernel::BoundedValidator< TYPE >::checkValidity ( const TYPE &  value) const
inlineoverrideprivate

◆ clearBounds()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::clearBounds ( )
inlinenoexcept

Clear both bounds (lower and upper) at the same time.

Definition at line 101 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::clearLower(), and Mantid::Kernel::BoundedValidator< TYPE >::clearUpper().

◆ clearLower()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::clearLower ( )
inlinenoexcept

◆ clearUpper()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::clearUpper ( )
inlinenoexcept

◆ clone()

template<class TYPE >
IValidator_sptr Mantid::Kernel::BoundedValidator< TYPE >::clone ( ) const
inlineoverride

Clone the current state.

Definition at line 113 of file BoundedValidator.h.

◆ errorAdjustment() [1/3]

double Mantid::Kernel::BoundedValidator< double >::errorAdjustment ( const double &  boundingValue,
const int  boundID 
) const
inlineprivate

Definition at line 177 of file BoundedValidator.h.

◆ errorAdjustment() [2/3]

int Mantid::Kernel::BoundedValidator< int >::errorAdjustment ( const int &  boundingValue,
const int  boundID 
) const
inlineprivate

Definition at line 182 of file BoundedValidator.h.

◆ errorAdjustment() [3/3]

template<class TYPE >
TYPE Mantid::Kernel::BoundedValidator< TYPE >::errorAdjustment ( const TYPE &  boundingValue,
const int  boundID 
) const
inlineprivate

◆ hasLower()

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::hasLower ( ) const
inlinenoexcept

Return if it has a lower bound.

Definition at line 49 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_hasLowerBound.

◆ hasUpper()

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::hasUpper ( ) const
inlinenoexcept

Return if it has a lower bound.

Definition at line 51 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_hasUpperBound.

◆ isLowerExclusive()

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::isLowerExclusive ( ) const
inlinenoexcept

Check if lower bound is exclusive.

Definition at line 57 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_lowerExclusive.

◆ isUpperExclusive()

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::isUpperExclusive ( ) const
inlinenoexcept

Check if upper bound is exclusive.

Definition at line 59 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_upperExclusive.

◆ lower()

template<class TYPE >
const TYPE & Mantid::Kernel::BoundedValidator< TYPE >::lower ( ) const
inlinenoexcept

Return the lower bound value.

Definition at line 53 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_lowerBound.

Referenced by Mantid::Kernel::BoundedValidator< TYPE >::setBounds().

◆ setBounds()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setBounds ( const TYPE &  lower,
const TYPE &  upper 
)
inlinenoexcept

◆ setError() [1/2]

void Mantid::Kernel::BoundedValidator< std::string >::setError ( const std::string &  value)
inline

Definition at line 172 of file BoundedValidator.h.

References value.

◆ setError() [2/2]

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setError ( const TYPE &  value)
inline

◆ setExclusive()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setExclusive ( const bool  exclusive)
inlinenoexcept

Set both the upper and lower bounds to be exclusive.

Definition at line 66 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::setLowerExclusive(), and Mantid::Kernel::BoundedValidator< TYPE >::setUpperExclusive().

◆ setLower()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setLower ( const TYPE &  value)
inlinenoexcept

◆ setLowerExclusive()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setLowerExclusive ( const bool  exclusive)
inlinenoexcept

Set the lower bound to be exclusive.

Definition at line 61 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_lowerExclusive.

Referenced by Mantid::Kernel::BoundedValidator< TYPE >::setExclusive().

◆ setUpper()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setUpper ( const TYPE &  value)
inlinenoexcept

◆ setUpperExclusive()

template<class TYPE >
void Mantid::Kernel::BoundedValidator< TYPE >::setUpperExclusive ( const bool  exclusive)
inlinenoexcept

Set the upper bound to be exclusive.

Definition at line 63 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_upperExclusive.

Referenced by Mantid::Kernel::BoundedValidator< TYPE >::setExclusive().

◆ upper()

template<class TYPE >
const TYPE & Mantid::Kernel::BoundedValidator< TYPE >::upper ( ) const
inlinenoexcept

Return the upper bound value.

Definition at line 55 of file BoundedValidator.h.

References Mantid::Kernel::BoundedValidator< TYPE >::m_upperBound.

Referenced by Mantid::Kernel::BoundedValidator< TYPE >::setBounds().

Member Data Documentation

◆ m_error

template<class TYPE >
TYPE Mantid::Kernel::BoundedValidator< TYPE >::m_error
private

◆ m_hasError

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::m_hasError
private

◆ m_hasLowerBound

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::m_hasLowerBound
private

◆ m_hasUpperBound

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::m_hasUpperBound
private

◆ m_lowerBound

template<class TYPE >
TYPE Mantid::Kernel::BoundedValidator< TYPE >::m_lowerBound
private

◆ m_lowerExclusive

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::m_lowerExclusive
private

◆ m_upperBound

template<class TYPE >
TYPE Mantid::Kernel::BoundedValidator< TYPE >::m_upperBound
private

◆ m_upperExclusive

template<class TYPE >
bool Mantid::Kernel::BoundedValidator< TYPE >::m_upperExclusive
private

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