Mantid
Loading...
Searching...
No Matches
IAlgorithmRuntimeProps.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 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 "DllOption.h"
11
12namespace MantidQt::API {
14public:
16 virtual ~IAlgorithmRuntimeProps() = default;
17
19
20 // Trying to compare properties downcasts to string types, which results in a bad_cast for sptr types
21 // so you will need to manually call getProperty(name) and cast to type T before comparing
22 virtual bool operator==(const Mantid::Kernel::IPropertyManager &) = delete;
23
24 template <typename T> void setProperty(const std::string &name, const T &value) {
25 if (!existsProperty(name)) {
26 declareProperty(name, value);
27 } else {
29 }
30 }
31
32 virtual void setPropertyValue(const std::string &, const std::string &) override = 0;
33 virtual TypedValue getProperty(const std::string &name) const noexcept override = 0;
34};
35
36} // namespace MantidQt::API
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
double value
The value of the point.
Definition: FitMW.cpp:51
virtual void setPropertyValue(const std::string &, const std::string &) override=0
Sets property value from a string.
virtual bool operator==(const Mantid::Kernel::IPropertyManager &)=delete
void setProperty(const std::string &name, const T &value)
virtual TypedValue getProperty(const std::string &name) const noexcept override=0
Get the value of a property.
Interface to PropertyManager.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
virtual std::vector< std::string > getDeclaredPropertyNames() const noexcept=0
Get the list of managed property names.
Utility class that enables the getProperty() method to effectively be templated on the return type.