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 // May want to add specialisation to the class later, e.g. setting just one
48 // element of the vector
49
50private:
51 // This method is a workaround for the C4661 compiler warning in visual
52 // studio. This allows the template declaration and definition to be separated
53 // in different files. See stack overflow article for a more detailed
54 // explanation:
55 // https://stackoverflow.com/questions/44160467/warning-c4661no-suitable-definition-provided-for-explicit-template-instantiatio
56 // https://stackoverflow.com/questions/33517902/how-to-export-a-class-derived-from-an-explicitly-instantiated-template-in-visual
57 void visualStudioC4661Workaround();
58};
59
60template <> MANTID_KERNEL_DLL void ArrayProperty<int>::visualStudioC4661Workaround();
61
62} // namespace Kernel
63} // namespace Mantid
std::string name
Definition Run.cpp:60
std::vector< T > const * vec
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition System.h:33
Support for a property that holds an array of values.
NullValidator is a validator that doesn't.
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.