Mantid
Loading...
Searching...
No Matches
AlgorithmProperty.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 "MantidAPI/DllConfig.h"
13
14#include <memory>
15
16namespace Mantid {
17namespace API {
18//-------------------------------------------------------------------------
19// Forward declarations
20//-------------------------------------------------------------------------
21class IAlgorithm;
22
23#ifdef _WIN32
24#pragma warning(push)
25// Disable 'multiple assignment operators specified' warning for this class
26// - it's not an accident that we have more than one
27#pragma warning(disable : 4522)
28#endif
29
39class MANTID_API_DLL AlgorithmProperty : public Kernel::PropertyWithValue<std::shared_ptr<IAlgorithm>> {
40public:
42 using HeldType = std::shared_ptr<IAlgorithm>;
43
45 AlgorithmProperty(const std::string &propName,
47 unsigned int direction = Kernel::Direction::Input);
48
50 // Unhide base class member that would be hidden by implicitly declared
51 // assignment operator
52 using Kernel::PropertyWithValue<HeldType>::operator=;
53
55 inline AlgorithmProperty *clone() const override { return new AlgorithmProperty(*this); }
56
59 throw Kernel::Exception::NotImplementedError("+= operator is not implemented for AlgorithmProperty.");
60 }
62 std::string value() const override;
64 Json::Value valueAsJson() const override;
66 std::string getDefault() const override;
68 std::string setValue(const std::string &value) override;
70 std::string setValueFromJson(const Json::Value &value) override;
71
72private:
73 std::string setBaseValue(const HeldType &algm);
74
75 // Cached string as value() can be called frequently
76 std::string m_algmStr;
77};
78
79#ifdef _WIN32
80#pragma warning(pop) // Re-enable the warning about multiple assignment operators
81#endif
82
83} // namespace API
84} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
Define an algorithm property that can be used to supply an algorithm object to a subsequent algorithm...
std::shared_ptr< IAlgorithm > HeldType
Typedef the held type.
AlgorithmProperty * clone() const override
'Virtual copy constructor'
AlgorithmProperty & operator+=(Kernel::Property const *) override
Add the value of another property. Doesn't make sense here.
AlgorithmProperty(const AlgorithmProperty &)=default
Marks code as not implemented yet.
Definition Exception.h:138
NullValidator is a validator that doesn't.
The concrete, templated class for properties.
Base class for properties.
Definition Property.h:94
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition IValidator.h:26
Helper class which provides the Collimation Length for SANS instruments.