Newer
Older
Gigg, Martyn Anthony
committed
#ifndef MANTID_API_ALGORITHMPROPERTY_H_
#define MANTID_API_ALGORITHMPROPERTY_H_
Gigg, Martyn Anthony
committed
#include "MantidAPI/DllConfig.h"
Gigg, Martyn Anthony
committed
#include "MantidKernel/PropertyWithValue.h"
#include "MantidKernel/NullValidator.h"
namespace Mantid {
namespace API {
//-------------------------------------------------------------------------
// Forward declarations
//-------------------------------------------------------------------------
class IAlgorithm;
Gigg, Martyn Anthony
committed
#ifdef _WIN32
// Disable 'multiple assignment operators specified' warning for this class
// - it's not an accident that we have more than one
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
Define an algorithm property that can be used to supply an algorithm object
to a subsequent algorithm. It is a specialized version of PropertyWithValue
where the type a pointer to an object implementing the
API::IAlgorithm interface.
@author Martyn Gigg, Tessella Plc
@date 24/03/2011
Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport AlgorithmProperty
: public Kernel::PropertyWithValue<boost::shared_ptr<IAlgorithm>> {
public:
/// Typedef the held type
typedef boost::shared_ptr<IAlgorithm> HeldType;
/// Constructor
AlgorithmProperty(const std::string &propName,
Kernel::IValidator_sptr validator =
Kernel::IValidator_sptr(new Kernel::NullValidator),
unsigned int direction = Kernel::Direction::Input);
/// Copy constructor
AlgorithmProperty(const AlgorithmProperty &rhs);
// Unhide base class members (at minimum, avoids Intel compiler warning)
using Kernel::PropertyWithValue<HeldType>::operator=;
/// Copy-Assignment operator
AlgorithmProperty &operator=(const AlgorithmProperty &rhs);
/// 'Virtual copy constructor'
inline AlgorithmProperty *clone() const override {
return new AlgorithmProperty(*this);
}
/// Add the value of another property. Doesn't make sense here.
AlgorithmProperty &operator+=(Kernel::Property const *) override {
throw Kernel::Exception::NotImplementedError(
"+= operator is not implemented for AlgorithmProperty.");
return *this;
}
/// Return the algorithm as string
std::string value() const override;
std::string getDefault() const override;
/// Sets the value of the algorithm
std::string setValue(const std::string &value) override;
private:
/// Default constructor
AlgorithmProperty();
/// The string used to create the underlying algorithm
std::string m_algStr;
};
#ifdef _WIN32
#pragma warning( \
pop) // Re-enable the warning about multiple assignment operators
Gigg, Martyn Anthony
committed
} // namespace Mantid
#endif /* MANTID_API_ALGORITHMPROPERTY_H_ */