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"
12#include "PropertyWithValue.h"
13#include <string>
14#include <vector>
15
16namespace Mantid {
17namespace Kernel {
27template <typename T> class MANTID_KERNEL_DLL ArrayProperty : public PropertyWithValue<std::vector<T>> {
28public:
29 ArrayProperty(const std::string &name, std::vector<T> vec, const IValidator_sptr &validator = nullptr,
30 const unsigned int direction = Direction::Input);
31 ArrayProperty(const std::string &name, const IValidator_sptr &validator,
32 const unsigned int direction = Direction::Input);
33 ArrayProperty(const std::string &name, const unsigned int direction = Direction::Input);
34 ArrayProperty(const std::string &name, const std::string &values, const IValidator_sptr &validator = nullptr,
35 const unsigned int direction = Direction::Input);
36
38
39 ArrayProperty<T> *clone() const override;
40
41 // Unhide the base class assignment operator
42 using PropertyWithValue<std::vector<T>>::operator=;
43
44 // May want to add specialisation to the class later, e.g. setting just one
45 // element of the vector
46
47private:
48 // This method is a workaround for the C4661 compiler warning in visual
49 // studio. This allows the template declaration and definition to be separated
50 // in different files. See stack overflow article for a more detailed
51 // explanation:
52 // https://stackoverflow.com/questions/44160467/warning-c4661no-suitable-definition-provided-for-explicit-template-instantiatio
53 // https://stackoverflow.com/questions/33517902/how-to-export-a-class-derived-from-an-explicitly-instantiated-template-in-visual
54 void visualStudioC4661Workaround();
55};
56
57template <> MANTID_KERNEL_DLL void ArrayProperty<int>::visualStudioC4661Workaround();
58
59} // namespace Kernel
60} // namespace Mantid
std::string name
Definition Run.cpp:60
std::vector< T > const * vec
Support for a property that holds an array of values.
The concrete, templated class for properties.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Helper class which provides the Collimation Length for SANS instruments.