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"
12
13#include <memory>
14
15namespace Mantid {
16namespace API {
17//-------------------------------------------------------------------------
18// Forward declarations
19//-------------------------------------------------------------------------
20class IAlgorithm;
21
22#ifdef _WIN32
23#pragma warning(push)
24// Disable 'multiple assignment operators specified' warning for this class
25// - it's not an accident that we have more than one
26#pragma warning(disable : 4522)
27#endif
28
38class MANTID_API_DLL AlgorithmProperty : public Kernel::PropertyWithValue<std::shared_ptr<IAlgorithm>> {
39public:
41 using HeldType = std::shared_ptr<IAlgorithm>;
42
44 AlgorithmProperty(const std::string &propName,
46 unsigned int direction = Kernel::Direction::Input);
47
49 // Unhide base class member that would be hidden by implicitly declared
50 // assignment operator
51 using Kernel::PropertyWithValue<HeldType>::operator=;
52
54 inline AlgorithmProperty *clone() const override { return new AlgorithmProperty(*this); }
55
58 throw Kernel::Exception::NotImplementedError("+= operator is not implemented for AlgorithmProperty.");
59 }
61 std::string value() const override;
63 Json::Value valueAsJson() const override;
65 std::string getDefault() const override;
67 std::string setValue(const std::string &value) override;
69 std::string setValueFromJson(const Json::Value &value) override;
70
71private:
72 std::string setBaseValue(const HeldType &algm);
73
74 // Cached string as value() can be called frequently
75 std::string m_algmStr;
76};
77
78#ifdef _WIN32
79#pragma warning(pop) // Re-enable the warning about multiple assignment operators
80#endif
81
82} // namespace API
83} // 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.
Definition: NullValidator.h:20
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.