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
10#include "MantidKernel/System.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 void modify_allowed_values(Property *const);
99
101 IPropertySettings *clone() const override;
102
103protected:
107 const std::string otherPropName;
112 const std::string value;
113 };
114
117 template <typename WhenPropType> struct ComparisonDetails {
118 std::shared_ptr<WhenPropType> conditionOne;
119 std::shared_ptr<WhenPropType> conditionTwo;
121 };
122
126
129 std::string getPropertyValue(const IPropertyManager *algo) const;
130
132 std::shared_ptr<PropertyDetails> m_propertyDetails = nullptr;
133
134private:
136 std::shared_ptr<ComparisonDetails<EnabledWhenProperty>> m_comparisonDetails = nullptr;
137};
138
139} // namespace Kernel
140} // 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.
Base class for properties.
Definition: Property.h:94
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.