Mantid
Loading...
Searching...
No Matches
ArrayProperty.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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 "MantidKernel/DllConfig.h"
13#include "PropertyWithValue.h"
14#include <string>
15#include <vector>
16
17namespace Mantid {
18namespace Kernel {
28template <typename T> class DLLExport ArrayProperty : public PropertyWithValue<std::vector<T>> {
29public:
30 ArrayProperty(const std::string &name, std::vector<T> vec,
31 const IValidator_sptr &validator = IValidator_sptr(new NullValidator),
32 const unsigned int direction = Direction::Input);
33 ArrayProperty(const std::string &name, const IValidator_sptr &validator,
34 const unsigned int direction = Direction::Input);
35 ArrayProperty(const std::string &name, const unsigned int direction = Direction::Input);
36 ArrayProperty(const std::string &name, const std::string &values,
37 const IValidator_sptr &validator = IValidator_sptr(new NullValidator),
38 const unsigned int direction = Direction::Input);
39
41
42 ArrayProperty<T> *clone() const override;
43
44 // Unhide the base class assignment operator
45 using PropertyWithValue<std::vector<T>>::operator=;
46
47 std::string value() const override;
48
49 std::string setValue(const std::string &value) override;
50 // May want to add specialisation the the class later, e.g. setting just one
51 // element of the vector
52
53private:
54 // This method is a workaround for the C4661 compiler warning in visual
55 // studio. This allows the template declaration and definition to be separated
56 // in different files. See stack overflow article for a more detailed
57 // explanation:
58 // https://stackoverflow.com/questions/44160467/warning-c4661no-suitable-definition-provided-for-explicit-template-instantiatio
59 // https://stackoverflow.com/questions/33517902/how-to-export-a-class-derived-from-an-explicitly-instantiated-template-in-visual
60 void visualStudioC4661Workaround();
61};
62
63template <> MANTID_KERNEL_DLL void ArrayProperty<int>::visualStudioC4661Workaround();
64
65} // namespace Kernel
66} // namespace Mantid
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
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
Helper class which provides the Collimation Length for SANS instruments.