Mantid
Loading...
Searching...
No Matches
EnabledWhenProperty.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidKernel/DllConfig.h"
11#include <memory>
12#include <string>
13
14namespace Mantid {
15namespace Kernel {
16
50// Forward decelerations
51class IPropertyManager;
52class Property;
53
54// Forward deceleration of structs defined at end of header
55
58
61
62class MANTID_KERNEL_DLL EnabledWhenProperty : public IPropertySettings {
63public:
66 EnabledWhenProperty(const std::string &otherPropName, const ePropertyCriterion when, const std::string &value = "");
67
71 EnabledWhenProperty(const EnabledWhenProperty &conditionOne, const EnabledWhenProperty &conditionTwo,
72 eLogicOperator logicOperator);
73
77 EnabledWhenProperty(std::shared_ptr<EnabledWhenProperty> &&conditionOne,
78 std::shared_ptr<EnabledWhenProperty> &&conditionTwo, eLogicOperator logicOperator);
79
82
85 virtual bool checkComparison(const IPropertyManager *algo) const;
86
88 virtual bool checkCriterion(const IPropertyManager *algo) const;
89
92 bool isEnabled(const IPropertyManager *algo) const override;
93
95 bool isVisible(const IPropertyManager *algo) const override;
96
98 std::vector<std::string> dependsOn(const std::string &thisProp) const override;
99
100#if 0 // *** DEBUG *** => this seems deprecated?
102 void modify_allowed_values(Property *const);
103#endif
104
106 IPropertySettings *clone() const override;
107
108protected:
112 const std::string otherPropName;
117 const std::string value;
118 };
119
122 template <typename WhenPropType> struct ComparisonDetails {
123 std::shared_ptr<WhenPropType> conditionOne;
124 std::shared_ptr<WhenPropType> conditionTwo;
126 };
127
131
134 std::string getPropertyValue(const IPropertyManager *algo) const;
135
137 std::shared_ptr<PropertyDetails> m_propertyDetails = nullptr;
138
139private:
141 std::shared_ptr<ComparisonDetails<EnabledWhenProperty>> m_comparisonDetails = nullptr;
142};
143
144} // namespace Kernel
145} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
EnabledWhenProperty()=default
Protected Constructor for derived classes to skip setting up the comparator in the base class as they...
Interface to PropertyManager.
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
ePropertyCriterion
Enum for use in EnabledWhenProperty.
eLogicOperator
Enum for use when combining two EnabledWhenPropertyItems.
Helper class which provides the Collimation Length for SANS instruments.
Struct which holds details for comparison between two EnabledWhenPropertyObjects.
Struct which holds associated property details for comparison.
const ePropertyCriterion criterion
Criterion to evaluate.
const std::string otherPropName
Name of the OTHER property that we will check.
const std::string value
For the IS_EQUAL_TO or IS_NOT_EQUAL_TO condition, the value (as string) to check for.