Mantid
|
Attribute is a non-fitting parameter. More...
#include <IFunction.h>
Public Member Functions | |
template<typename... Ts> | |
void | apply (AttributeLambdaVisitor< Ts... > &v) |
Apply a lambda visitor. More... | |
template<typename T > | |
T | apply (AttributeVisitor< T > &v) |
Apply an attribute visitor. More... | |
template<typename T > | |
T | apply (ConstAttributeVisitor< T > &v) const |
Apply a const attribute visitor. More... | |
bool | asBool () const |
Returns bool value if attribute is a bool, throws exception otherwise. More... | |
double | asDouble () const |
Returns double value if attribute is a double, throws exception otherwise. More... | |
int | asInt () const |
Returns int value if attribute is a int, throws exception otherwise. More... | |
std::string | asQuotedString () const |
Returns a string value that is guarenteed to be quoted for use in places where the string is used as the displayed value. More... | |
std::string | asString () const |
Returns string value if attribute is a string, throws exception otherwise. More... | |
std::string | asUnquotedString () const |
Returns a string value that is guarenteed to be unquoted. More... | |
std::vector< double > | asVector () const |
Returns vector<double> if attribute is vector<double>, throws exception otherwise. More... | |
Attribute () | |
Create empty string attribute. More... | |
Attribute (const bool &b) | |
Create bool attribute. More... | |
Attribute (const char *c) | |
Create string attribute. More... | |
Attribute (const double &d) | |
Create double attribute. More... | |
Attribute (const int &i) | |
Create int attribute. More... | |
Attribute (const std::string &str, bool quoteValue=false) | |
Create string attribute. More... | |
Attribute (const std::vector< double > &v) | |
Create vector attribute. More... | |
void | evaluateValidator () const |
Evaluates the validator associated with this attribute. Returns error as a string. More... | |
template<typename T > | |
void | evaluateValidator (T &inputData) const |
Evaluates the validator associated with this attribute with regards to input value. Returns error as a string. More... | |
void | fromString (const std::string &str) |
Set value from a string. More... | |
Kernel::IValidator_sptr | getValidator () |
Return a clone of the attribute validator;. More... | |
bool | isEmpty () const |
Check if a string attribute is empty. More... | |
void | setBool (const bool &) |
Sets new value if attribute is a bool. More... | |
void | setDouble (const double &) |
Sets new value if attribute is a double. More... | |
void | setInt (const int &) |
Sets new value if attribute is a int. More... | |
void | setString (const std::string &str) |
Sets new value if attribute is a string. More... | |
void | setValidator (const Kernel::IValidator_sptr &validator) const |
Set validator to enforce limits on attribute value. More... | |
template<typename T > | |
void | setValue (const T &v) |
void | setVector (const std::vector< double > &) |
Sets new value if attribute is a vector. More... | |
std::string | type () const |
Returns type of the attribute. More... | |
std::string | value () const |
Returns the attribute value as a string. More... | |
Private Attributes | |
boost::variant< std::string, int, double, bool, std::vector< double > > | m_data |
The data holder as boost variant. More... | |
bool | m_quoteValue = false |
Flag indicating if the string value should be returned quoted. More... | |
Kernel::IValidator_sptr | m_validator |
Associated Validator. More... | |
Attribute is a non-fitting parameter.
It can be one of the types: std::string, int, or double Examples: file name, polinomial order
Definition at line 282 of file IFunction.h.
|
inlineexplicit |
Create empty string attribute.
Definition at line 285 of file IFunction.h.
|
inlineexplicit |
Create string attribute.
Definition at line 287 of file IFunction.h.
|
inlineexplicit |
Create int attribute.
Definition at line 289 of file IFunction.h.
|
inlineexplicit |
Create double attribute.
Definition at line 291 of file IFunction.h.
References Mantid::Geometry::d.
|
inlineexplicit |
Create bool attribute.
Definition at line 293 of file IFunction.h.
|
inlineexplicit |
Create string attribute.
Definition at line 295 of file IFunction.h.
|
inlineexplicit |
Create vector attribute.
Definition at line 297 of file IFunction.h.
|
inline |
|
inline |
Apply an attribute visitor.
Definition at line 300 of file IFunction.h.
References m_data.
Referenced by MantidQt::MantidWidgets::FunctionTreeView::addAttributeProperty(), MantidQt::MantidWidgets::PropertyHandler::initAttributes(), MantidQt::MantidWidgets::PropertyHandler::setAttribute(), MantidQt::MantidWidgets::FunctionTreeView::setAttributeToFunction(), and type().
|
inline |
bool Mantid::API::IFunction::Attribute::asBool | ( | ) | const |
Returns bool value if attribute is a bool, throws exception otherwise.
Return the attribute as a bool if it is a bool.
Definition at line 752 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::CrystalFieldMagnetisationBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldMomentBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldSusceptibilityBase::function1D(), Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), Mantid::CurveFitting::Functions::BSpline::resetKnots(), Mantid::CurveFitting::Functions::BSpline::setAttribute(), Mantid::CurveFitting::Functions::Convolution::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::updateSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSpectrum(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::updateTargetFunction().
double Mantid::API::IFunction::Attribute::asDouble | ( | ) | const |
Returns double value if attribute is a double, throws exception otherwise.
Return the attribute as a double if it is a double.
Definition at line 739 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::CrystalFieldFunction::calcExcitations(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::calcExcitations(), Mantid::CurveFitting::Functions::BSpline::derivative1D(), Mantid::CurveFitting::Functions::BSpline::function1D(), Mantid::CurveFitting::Functions::ChudleyElliotSQE::function1D(), Mantid::CurveFitting::Functions::CriticalPeakRelaxationRate::function1D(), Mantid::CurveFitting::Functions::CrystalFieldHeatCapacityBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldMagnetisationBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldMomentBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldSusceptibilityBase::function1D(), Mantid::CurveFitting::Functions::FickDiffusionSQE::function1D(), Mantid::CurveFitting::Functions::HallRossSQE::function1D(), Mantid::CurveFitting::Functions::InelasticDiffRotDiscreteCircle::function1D(), Mantid::CurveFitting::Functions::InelasticDiffSphere::function1D(), Mantid::CurveFitting::Functions::InelasticIsoRotDiff::function1D(), Mantid::CurveFitting::Functions::TeixeiraWaterSQE::function1D(), Mantid::CurveFitting::Functions::CrystalFieldPeaks::functionGeneral(), Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), Mantid::CurveFitting::Functions::ElasticDiffRotDiscreteCircle::HeightPrefactor(), Mantid::CurveFitting::Functions::ElasticDiffSphere::HeightPrefactor(), Mantid::CurveFitting::Functions::ElasticIsoRotDiff::HeightPrefactor(), Mantid::CurveFitting::Functions::BSpline::resetKnots(), Mantid::CurveFitting::Functions::Chebyshev::setAttribute(), Mantid::CurveFitting::Functions::CubicSpline::setAttribute(), Mantid::CurveFitting::Functions::DynamicKuboToyabe::setAttribute(), Mantid::CurveFitting::Functions::FullprofPolynomial::setAttribute(), MantidQt::MantidWidgets::PropertyHandler::setAttribute(), Mantid::CurveFitting::Functions::CubicSpline::setupInput(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::updateSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSpectrum(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::updateTargetFunction().
int Mantid::API::IFunction::Attribute::asInt | ( | ) | const |
Returns int value if attribute is a int, throws exception otherwise.
Return the attribute as an int if it is a int.
Definition at line 726 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::BSpline::derivative1D(), Mantid::CurveFitting::Functions::CubicSpline::derivative1D(), Mantid::CurveFitting::Functions::CubicSpline::function1D(), Mantid::CurveFitting::Functions::InelasticDiffRotDiscreteCircle::function1D(), Mantid::CurveFitting::Functions::InelasticDiffSphere::function1D(), Mantid::CurveFitting::Functions::InelasticIsoRotDiff::function1D(), Mantid::FrameworkTestHelpers::MultiDomainFunctionTest_Function::function1D(), Mantid::FrameworkTestHelpers::MultiDomainFunctionTest_Function::functionDeriv1D(), Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), Mantid::CurveFitting::Functions::ElasticDiffRotDiscreteCircle::HeightPrefactor(), Mantid::CurveFitting::Functions::Chebyshev::setAttribute(), Mantid::CurveFitting::Functions::CubicSpline::setAttribute(), Mantid::CurveFitting::Functions::FullprofPolynomial::setAttribute(), Mantid::CurveFitting::Functions::Polynomial::setAttribute(), Mantid::CurveFitting::Functions::ReflectivityMulf::setAttribute(), Mantid::CurveFitting::Functions::FunctionQDepends::setAttribute(), MantidQt::MantidWidgets::PropertyHandler::setAttribute(), MantidQt::MantidWidgets::ConvolutionFunctionModel::setPrefix(), Mantid::CurveFitting::Functions::TabulatedFunction::setupData(), and Mantid::CurveFitting::Functions::CubicSpline::setXAttribute().
std::string Mantid::API::IFunction::Attribute::asQuotedString | ( | ) | const |
Returns a string value that is guarenteed to be quoted for use in places where the string is used as the displayed value.
Return the attribute as a quoted string if it is a string.
Definition at line 676 of file IFunction.cpp.
References m_data.
std::string Mantid::API::IFunction::Attribute::asString | ( | ) | const |
Returns string value if attribute is a string, throws exception otherwise.
Return the attribute as a string if it is a string.
Definition at line 660 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::CrystalFieldPeaksBase::calculateEigenSystem(), Mantid::CurveFitting::Functions::CrystalFieldMagnetisationBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldMomentBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldSusceptibilityBase::function1D(), Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), Mantid::MDAlgorithms::UserFunctionMD::setAttribute(), Mantid::CurveFitting::Functions::PawleyParameterFunction::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldControl::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldPeaksBase::setAttribute(), MantidQt::MantidWidgets::PropertyHandler::setAttribute(), Mantid::API::MultiDomainFunction::setLocalAttribute(), MantidQt::MantidWidgets::ConvolutionFunctionModel::setPrefix(), Mantid::CurveFitting::Functions::TabulatedFunction::setupData(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::updateSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSpectrum(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::updateTargetFunction().
std::string Mantid::API::IFunction::Attribute::asUnquotedString | ( | ) | const |
Returns a string value that is guarenteed to be unquoted.
Return the attribute as an unquoted string if it is a string.
Definition at line 702 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), and Mantid::CurveFitting::Functions::CrystalFieldControl::setAttribute().
std::vector< double > Mantid::API::IFunction::Attribute::asVector | ( | ) | const |
Returns vector<double> if attribute is vector<double>, throws exception otherwise.
Return the attribute as a bool if it is a vector.
Definition at line 765 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldControl::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::CrystalFieldSpectrum::buildTargetFunction(), Mantid::CurveFitting::Functions::CrystalFieldControl::cacheAttributes(), Mantid::CurveFitting::Functions::CrystalFieldMagnetisationBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldMomentBase::function1D(), Mantid::CurveFitting::Functions::CrystalFieldSusceptibilityBase::function1D(), Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), Mantid::CurveFitting::Functions::BSpline::resetKnots(), Mantid::CurveFitting::Functions::BSpline::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldControl::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::updateTargetFunction().
void Mantid::API::IFunction::Attribute::evaluateValidator | ( | ) | const |
Evaluates the validator associated with this attribute. Returns error as a string.
Evaluates the validator associated with this attribute.
Definition at line 984 of file IFunction.cpp.
References m_data.
Referenced by Mantid::API::IFunction::declareAttribute().
|
inline |
Evaluates the validator associated with this attribute with regards to input value. Returns error as a string.
Definition at line 311 of file IFunction.h.
References m_validator.
void Mantid::API::IFunction::Attribute::fromString | ( | const std::string & | str | ) |
Set value from a string.
Throws exception if the string has wrong format
str | :: String representation of the new value |
Definition at line 971 of file IFunction.cpp.
References m_validator, and tmp.
Referenced by Mantid::API::FunctionFactoryImpl::createSimple(), and MantidQt::MantidWidgets::PropertyHandler::setAttribute().
|
inline |
Return a clone of the attribute validator;.
Definition at line 317 of file IFunction.h.
References m_validator.
Referenced by MantidQt::MantidWidgets::PropertyHandler::initAttributes(), Mantid::CurveFitting::Functions::BSpline::resetValidators(), and MantidQt::MantidWidgets::PropertyHandler::setAttribute().
bool Mantid::API::IFunction::Attribute::isEmpty | ( | ) | const |
Check if a string attribute is empty.
Definition at line 858 of file IFunction.cpp.
References m_data.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::hasBackground().
void Mantid::API::IFunction::Attribute::setBool | ( | const bool & | b | ) |
Sets new value if attribute is a bool.
Sets new value if attribute is an bool.
If the type is wrong throws an exception
b | :: The new value |
Definition at line 827 of file IFunction.cpp.
References m_data.
void Mantid::API::IFunction::Attribute::setDouble | ( | const double & | d | ) |
Sets new value if attribute is a double.
If the type is wrong throws an exception
d | :: The new value |
Definition at line 795 of file IFunction.cpp.
References Mantid::Geometry::d, and m_data.
void Mantid::API::IFunction::Attribute::setInt | ( | const int & | i | ) |
Sets new value if attribute is a int.
Sets new value if attribute is an int.
If the type is wrong throws an exception
i | :: The new value |
Definition at line 811 of file IFunction.cpp.
References m_data.
void Mantid::API::IFunction::Attribute::setString | ( | const std::string & | str | ) |
Sets new value if attribute is a string.
If the type is wrong throws an exception
str | :: The new value |
Definition at line 779 of file IFunction.cpp.
References m_data.
Referenced by Mantid::API::IFunction::setAttributeValue().
void Mantid::API::IFunction::Attribute::setValidator | ( | const Kernel::IValidator_sptr & | validator | ) | const |
Set validator to enforce limits on attribute value.
validator | :: shared ptr to validator object |
Definition at line 979 of file IFunction.cpp.
References m_validator.
Referenced by Mantid::API::IFunction::declareAttribute().
|
inline |
Definition at line 354 of file IFunction.h.
References m_data.
void Mantid::API::IFunction::Attribute::setVector | ( | const std::vector< double > & | v | ) |
Sets new value if attribute is a vector.
If the type is wrong throws an exception
v | :: The new value |
Definition at line 844 of file IFunction.cpp.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::setAttribute().
std::string Mantid::API::IFunction::Attribute::type | ( | ) | const |
Returns type of the attribute.
Definition at line 608 of file IFunction.cpp.
Referenced by Mantid::PythonInterface::IFunctionAdapter::getAttributeValue(), and MantidQt::MantidWidgets::PropertyHandler::setAttribute().
std::string Mantid::API::IFunction::Attribute::value | ( | ) | const |
Returns the attribute value as a string.
Definition at line 652 of file IFunction.cpp.
References tmp.
Referenced by Mantid::API::IFunction::writeToString(), Mantid::API::CompositeFunction::writeToString(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::writeToString().
|
mutableprivate |
The data holder as boost variant.
Definition at line 364 of file IFunction.h.
|
private |
Flag indicating if the string value should be returned quoted.
Definition at line 366 of file IFunction.h.
|
mutableprivate |
Associated Validator.
Definition at line 368 of file IFunction.h.