14#include <boost/lexical_cast.hpp>
38 return watchedProp->
name() == changedPropName;
45 const std::string currentValue = currentProperty->
value();
46 const std::string watchedValue = watchedProperty->value();
49 if (newValue != currentValue) {
50 currentProperty->setValue(newValue);
55 g_log.
warning() <<
"`SetValueWhenProperty::applyChanges`: one of the properies '" << currentPropName <<
"' or '"
57 <<
" is not present on the algorithm.\n";
58 }
catch (
const std::runtime_error &e) {
61 g_log.
warning() <<
"`SetValueWhenProperty::applyChanges`: exception thrown within provided callback.\n"
62 <<
"If the callback was a Python `Callable`, the stack trace follows:\n"
63 <<
"-------------------------------------------------------------------------\n"
64 << e.what() <<
"\n-------------------------------------------------------------------------\n";
72 throw std::runtime_error(
"SetValueWhenProperty: circular dependency detected");
Exception for when an item is not found in a collection.
Interface to PropertyManager.
virtual Property * getPointerToProperty(const std::string &name) const =0
Get a pointer to property by name.
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
The Logger class is in charge of the publishing messages from the framework through various channels.
void warning(const std::string &msg)
Logs at warning level.
const std::string & name() const
Get the property's name.
virtual std::string value() const =0
Returns the value of the property as a string.
bool isConditionChanged(const IPropertyManager *algo, const std::string &changedPropName) const override
Return true when the property changed is the property that the current property's value depends on.
std::function< std::string(std::string, std::string)> m_changeCriterion
Callback to check and actually apply any required changes: this function returns a new string value f...
bool applyChanges(const Mantid::Kernel::IPropertyManager *algo, const std::string ¤tPropName) override
If a new value should be set, the change is applied here.
std::string m_watchedPropName
Name of the watched property, which is the property that the current property's value depends on.
IPropertySettings * clone() const override
Make a copy of the present type of IPropertySettings.
std::vector< std::string > dependsOn(const std::string &thisProp) const override
Other properties that this property depends on.
Logger g_log("DateAndTime")