Mantid
Loading...
Searching...
No Matches
ArrayProperty.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
8
9// PropertyWithValue Definition
11#include "MantidKernel/PropertyWithValue.tcc"
12
13namespace Mantid::Kernel {
21template <typename T>
22ArrayProperty<T>::ArrayProperty(const std::string &name, std::vector<T> vec, const IValidator_sptr &validator,
23 const unsigned int direction)
24 : PropertyWithValue<std::vector<T>>(name, std::move(vec), validator, direction) {}
25
34template <typename T>
35ArrayProperty<T>::ArrayProperty(const std::string &name, const IValidator_sptr &validator, const unsigned int direction)
36 : PropertyWithValue<std::vector<T>>(name, std::vector<T>(), validator, direction) {}
37
45template <typename T>
46ArrayProperty<T>::ArrayProperty(const std::string &name, const unsigned int direction)
47 : PropertyWithValue<std::vector<T>>(name, std::vector<T>(), IValidator_sptr(new NullValidator), direction) {}
48
64template <typename T>
65ArrayProperty<T>::ArrayProperty(const std::string &name, const std::string &values, const IValidator_sptr &validator,
66 const unsigned int direction)
67 : PropertyWithValue<std::vector<T>>(name, std::vector<T>(), values, validator, direction) {}
68
69template <typename T>
71
73template <typename T> ArrayProperty<T> *ArrayProperty<T>::clone() const { return new ArrayProperty<T>(*this); }
74
78template <typename T> std::string ArrayProperty<T>::value() const {
79 // Implemented this method for documentation reasons. Just calls base class
80 // method.
82}
83
89template <typename T> std::string ArrayProperty<T>::setValue(const std::string &value) {
90 // Implemented this method for documentation reasons. Just calls base class
91 // method.
92 return PropertyWithValue<std::vector<T>>::setValue(value);
93}
94
95template <typename T> void ArrayProperty<T>::visualStudioC4661Workaround() {}
96
98// export macro not needed for int32_t due to explicit specialization in header.
99template class ArrayProperty<int32_t>;
100
102template class DLLExport ArrayProperty<int64_t>;
104template class DLLExport ArrayProperty<bool>;
105template class DLLExport ArrayProperty<float>;
106template class DLLExport ArrayProperty<double>;
108
116
117#if defined(_WIN32) || defined(__clang__) && defined(__APPLE__)
118template class DLLExport ArrayProperty<long>;
122#endif
123
125
126template <> MANTID_KERNEL_DLL void ArrayProperty<int>::visualStudioC4661Workaround() {}
127
128} // namespace Mantid::Kernel
double value
The value of the point.
Definition: FitMW.cpp:51
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53
Support for a property that holds an array of values.
Definition: ArrayProperty.h:28
std::string setValue(const std::string &value) override
Sets the values stored in the ArrayProperty from a string representation.
ArrayProperty< T > * clone() const override
'Virtual copy constructor'
std::string value() const override
Returns the values stored in the ArrayProperty.
ArrayProperty(const std::string &name, std::vector< T > vec, const IValidator_sptr &validator=IValidator_sptr(new NullValidator), const unsigned int direction=Direction::Input)
Constructor.
NullValidator is a validator that doesn't.
Definition: NullValidator.h:20
The concrete, templated class for properties.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26
STL namespace.