Mantid
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Mantid::Kernel::EnabledWhenProperty Class Reference

#include <EnabledWhenProperty.h>

Inheritance diagram for Mantid::Kernel::EnabledWhenProperty:
Mantid::Kernel::IPropertySettings Mantid::Kernel::VisibleWhenProperty Mantid::MDAlgorithms::DisabledProperty

Classes

struct  ComparisonDetails
 Struct which holds details for comparison between two EnabledWhenPropertyObjects. More...
 
struct  PropertyDetails
 Struct which holds associated property details for comparison. More...
 

Public Member Functions

virtual bool checkComparison (const IPropertyManager *algo) const
 Checks two EnabledWhenProperty objects match the logic operator specified and returns the result of both of them. More...
 
virtual bool checkCriterion (const IPropertyManager *algo) const
 Checks that the specified property matches the criteria given. More...
 
IPropertySettingsclone () const override
 Make a copy of the present type of validator. More...
 
 EnabledWhenProperty (const EnabledWhenProperty &conditionOne, const EnabledWhenProperty &conditionTwo, eLogicOperator logicOperator)
 Constructs a EnabledWhenProperty object which copies two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator. More...
 
 EnabledWhenProperty (const EnabledWhenProperty &other)
 Copy constructor. More...
 
 EnabledWhenProperty (const std::string &otherPropName, const ePropertyCriterion when, const std::string &value="")
 Constructs a EnabledWhenProperty object which checks the property with name given and if it matches the criteria enables it. More...
 
 EnabledWhenProperty (std::shared_ptr< EnabledWhenProperty > &&conditionOne, std::shared_ptr< EnabledWhenProperty > &&conditionTwo, eLogicOperator logicOperator)
 Constructs a EnabledWhenProperty object which takes ownership of two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator. More...
 
bool isEnabled (const IPropertyManager *algo) const override
 Return true/false based on whether the other property satisfies the criterion. More...
 
bool isVisible (const IPropertyManager *algo) const override
 Return true always. More...
 
void modify_allowed_values (Property *const)
 Stub function to satisfy the interface. More...
 
- Public Member Functions inherited from Mantid::Kernel::IPropertySettings
virtual void applyChanges (const IPropertyManager *, Property *const)
 The function user have to overload it in their custom code to modify the property according to the changes to other properties. More...
 
virtual IPropertySettingsclone () const =0
 Make a copy of the present type of IPropertySettings. More...
 
 IPropertySettings ()=default
 Constructor. More...
 
virtual bool isConditionChanged (const IPropertyManager *algo, const std::string &changedPropName="") const
 to verify if the properties, this one depends on have changed or other special condition occurs which needs the framework to react to More...
 
virtual bool isEnabled (const IPropertyManager *algo) const
 Is the property to be shown as "enabled" in the GUI. More...
 
virtual bool isVisible (const IPropertyManager *algo) const
 Is the property to be shown in the GUI? Default true. More...
 
virtual ~IPropertySettings ()=default
 Destructor. More...
 

Protected Member Functions

 EnabledWhenProperty ()=default
 Protected Constructor for derived classes to skip setting up the comparator in the base class as they will handle it. More...
 
std::string getPropertyValue (const IPropertyManager *algo) const
 Checks the algorithm and property are both valid and attempts to get the value associated with the property. More...
 
- Protected Member Functions inherited from Mantid::Kernel::IPropertySettings
 IPropertySettings (const IPropertySettings &)=default
 

Protected Attributes

std::shared_ptr< PropertyDetailsm_propertyDetails = nullptr
 Holds the various details used within the comparison. More...
 

Private Attributes

std::shared_ptr< ComparisonDetails< EnabledWhenProperty > > m_comparisonDetails = nullptr
 Holds an object containing details of multiple comparisons. More...
 

Detailed Description

Definition at line 62 of file EnabledWhenProperty.h.

Constructor & Destructor Documentation

◆ EnabledWhenProperty() [1/5]

Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty ( const std::string &  otherPropName,
const ePropertyCriterion  when,
const std::string &  value = "" 
)

Constructs a EnabledWhenProperty object which checks the property with name given and if it matches the criteria enables it.

Constructor.

Parameters
otherPropName:: Name of the OTHER property that we will check.
when:: Criterion to evaluate
value:: For the IS_EQUAL_TO or IS_NOT_EQUAL_TO condition, the value (as string) to check for

Definition at line 28 of file EnabledWhenProperty.cpp.

◆ EnabledWhenProperty() [2/5]

Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty ( const EnabledWhenProperty conditionOne,
const EnabledWhenProperty conditionTwo,
eLogicOperator  logicOperator 
)

Constructs a EnabledWhenProperty object which copies two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator.

Multiple conditions constructor - takes two enable when property objects and returns the product of of the with the specified logic operator.

Parameters
conditionOne:: First EnabledWhenProperty object to use
conditionTwo:: Second EnabledWhenProperty object to use
logicOperator:: The logic operator to apply across both conditions

Definition at line 42 of file EnabledWhenProperty.cpp.

◆ EnabledWhenProperty() [3/5]

Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty ( std::shared_ptr< EnabledWhenProperty > &&  conditionOne,
std::shared_ptr< EnabledWhenProperty > &&  conditionTwo,
eLogicOperator  logicOperator 
)

Constructs a EnabledWhenProperty object which takes ownership of two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator.

Multiple conditions constructor - takes two shared pointers to EnabledWhenProperty objects and returns the product of them with the specified logic operator.

Parameters
conditionOne:: First EnabledWhenProperty object to use
conditionTwo:: Second EnabledWhenProperty object to use
logicOperator:: The logic operator to apply across both conditions

Definition at line 60 of file EnabledWhenProperty.cpp.

◆ EnabledWhenProperty() [4/5]

Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty ( const EnabledWhenProperty other)

Copy constructor.

Definition at line 67 of file EnabledWhenProperty.cpp.

◆ EnabledWhenProperty() [5/5]

Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty ( )
protecteddefault

Protected Constructor for derived classes to skip setting up the comparator in the base class as they will handle it.

Referenced by clone().

Member Function Documentation

◆ checkComparison()

bool Mantid::Kernel::EnabledWhenProperty::checkComparison ( const IPropertyManager algo) const
virtual

Checks two EnabledWhenProperty objects match the logic operator specified and returns the result of both of them.

Checks if the user specified combination of enabled criterion returns a true or false value.

Parameters
algo:: The algorithm containing the property to check
Returns
:: true if user specified combination was true, else false.
Exceptions
:If any problems was found

Reimplemented in Mantid::Kernel::VisibleWhenProperty.

Definition at line 78 of file EnabledWhenProperty.cpp.

References Mantid::Kernel::AND, m_comparisonDetails, Mantid::Kernel::OR, and Mantid::Kernel::XOR.

Referenced by isEnabled().

◆ checkCriterion()

bool Mantid::Kernel::EnabledWhenProperty::checkCriterion ( const IPropertyManager algo) const
virtual

Checks that the specified property matches the criteria given.

Does the validator fulfill the criterion based on the other property values?

Parameters
algo:: The pointer to the algorithm to check the property values of
Returns
:: True if the criteria are met else false
Exceptions
:Throws on any problems (e.g. property missing from algorithm)

Reimplemented in Mantid::MDAlgorithms::DisabledProperty.

Definition at line 105 of file EnabledWhenProperty.cpp.

References Mantid::Kernel::IPropertyManager::getPointerToProperty(), getPropertyValue(), Mantid::Kernel::IS_DEFAULT, Mantid::Kernel::IS_EQUAL_TO, Mantid::Kernel::IS_MORE_OR_EQ, Mantid::Kernel::IS_NOT_DEFAULT, Mantid::Kernel::IS_NOT_EQUAL_TO, and m_propertyDetails.

Referenced by isEnabled(), and Mantid::Kernel::VisibleWhenProperty::isVisible().

◆ clone()

IPropertySettings * Mantid::Kernel::EnabledWhenProperty::clone ( ) const
overridevirtual

Make a copy of the present type of validator.

Clones the current EnabledWhenProperty object and returns a pointer to the new object.

The caller is responsible for deleting this pointer when finished

Returns
Pointer to cloned EnabledWhenProperty object

Implements Mantid::Kernel::IPropertySettings.

Reimplemented in Mantid::Kernel::VisibleWhenProperty.

Definition at line 204 of file EnabledWhenProperty.cpp.

References EnabledWhenProperty().

◆ getPropertyValue()

std::string Mantid::Kernel::EnabledWhenProperty::getPropertyValue ( const IPropertyManager algo) const
protected

Checks the algorithm and property are both valid and attempts to get the value associated with the property.

Checks the algorithm given is in a valid state and the property exists then proceeds to try to get the value associated.

Parameters
algo:: The pointer to the algorithm to process
Returns
:: The value contained by said property
Exceptions
:Throws if anything is wrong with the property or algorithm

Definition at line 146 of file EnabledWhenProperty.cpp.

References Mantid::Kernel::IPropertyManager::getPointerToProperty(), m_propertyDetails, and Mantid::Kernel::Property::value().

Referenced by checkCriterion().

◆ isEnabled()

bool Mantid::Kernel::EnabledWhenProperty::isEnabled ( const IPropertyManager algo) const
overridevirtual

Return true/false based on whether the other property satisfies the criterion.

Returns whether the property should be enabled or disabled based on the property conditions.

Parameters
algo:: The algorithm containing the property
Returns
:: True if enabled when conditions matched, else false
Exceptions
:Throws on any error (e.g. missing property)

Reimplemented from Mantid::Kernel::IPropertySettings.

Reimplemented in Mantid::Kernel::VisibleWhenProperty.

Definition at line 170 of file EnabledWhenProperty.cpp.

References checkComparison(), checkCriterion(), m_comparisonDetails, and m_propertyDetails.

◆ isVisible()

bool Mantid::Kernel::EnabledWhenProperty::isVisible ( const IPropertyManager algo) const
overridevirtual

Return true always.

Always returns true as EnabledWhenProperty always sets the visibility on while altering whether the property is Enabled or disabled.

Parameters
algo:: Pointer to the algorithm containing the property
Returns
:: True always

Reimplemented from Mantid::Kernel::IPropertySettings.

Reimplemented in Mantid::Kernel::VisibleWhenProperty.

Definition at line 188 of file EnabledWhenProperty.cpp.

References UNUSED_ARG.

◆ modify_allowed_values()

void Mantid::Kernel::EnabledWhenProperty::modify_allowed_values ( Property * const  )

Stub function to satisfy the interface.

Does nothing in this case and put here to satisfy the interface.

Definition at line 195 of file EnabledWhenProperty.cpp.

Member Data Documentation

◆ m_comparisonDetails

std::shared_ptr<ComparisonDetails<EnabledWhenProperty> > Mantid::Kernel::EnabledWhenProperty::m_comparisonDetails = nullptr
private

Holds an object containing details of multiple comparisons.

Definition at line 136 of file EnabledWhenProperty.h.

Referenced by checkComparison(), and isEnabled().

◆ m_propertyDetails

std::shared_ptr<PropertyDetails> Mantid::Kernel::EnabledWhenProperty::m_propertyDetails = nullptr
protected

Holds the various details used within the comparison.

Definition at line 132 of file EnabledWhenProperty.h.

Referenced by checkCriterion(), getPropertyValue(), isEnabled(), and Mantid::Kernel::VisibleWhenProperty::isVisible().


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