31 void addValue(
const size_t index,
const ElemType &
value);
32 std::string toXMLString()
const override;
33 Derived &assignFrom(
const Derived &other);
36 bool isValid()
const override;
37 ElemType &operator[](
int index);
38 const ElemType *getPointerToStart();
39 size_t getSize()
const;
40 ElemType &at(
size_t index);
64template <
typename Derived,
typename ElemType>
66 if (other.getSize() != this->getSize()) {
67 throw std::runtime_error(
"Cannot assign between VectorParameters where the "
68 "size of the vectors are different.");
71 this->m_isValid = other.m_isValid;
72 for (
size_t i = 0; i < other.getSize(); i++) {
73 this->m_arry[i] = other.m_arry[i];
76 return *(
dynamic_cast<Derived *
>(
this));
84template <
typename Derived,
typename ElemType>
86 if (other.m_isValid != this->m_isValid) {
89 if (other.getSize() != this->getSize()) {
92 for (
size_t i = 0; i < other.getSize(); i++) {
93 if (this->m_arry[i] != other.m_arry[i]) {
105template <
typename Derived,
typename ElemType>
107 return !(*
this == other);
114template <
typename Derived,
typename ElemType>
119template <
typename Derived,
typename ElemType>
123 m_isValid = other.m_isValid;
124 m_arry =
new ElemType[other.getSize()];
125 for (
size_t i = 0; i < other.getSize(); i++) {
126 this->m_arry[i] = other.m_arry[i];
132template <
typename Derived,
typename ElemType>
141template <
typename Derived,
typename ElemType>
143 m_arry =
new ElemType[size];
156template <
typename Derived,
typename ElemType>
167 throw std::runtime_error(
"Cannot serialize VectorParameter if it is not valid!");
169 std::string valueXMLtext;
170 for (
size_t i = 0; i <
m_size; i++) {
177 return this->parameterXMLTemplate(valueXMLtext);
186 return m_arry[
index];
211 return m_arry[
index];
221#define DECLARE_VECTOR_PARAMETER(classname, type_) \
222 class classname : public Mantid::API::VectorParameter<classname, type_> { \
224 using SuperType = Mantid::API::VectorParameter<classname, type_>; \
225 static std::string parameterName() { return #classname; } \
226 classname() : SuperType() {} \
227 classname(size_t index) : SuperType(index) {} \
228 std::string getName() const override { return #classname; } \
229 classname *clone() const override { return new classname(*this); } \
size_t m_size
Maximum size of the store.
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Abstract parameter type for use with IImplicitFunctions.
VectorParameter is abstract type implementing curiously recurring template pattern to implement commo...
VectorParameter()
Default constructor.
bool isValid() const override
bool operator==(const Derived &other) const
ElemType & at(size_t index)
~VectorParameter() override
Destructor.
std::string toXMLString() const override
VectorParameter< Derived, ElemType > & operator=(const VectorParameter< Derived, ElemType > &other)
bool operator!=(const Derived &other) const
Derived & assignFrom(const Derived &other)
const ElemType * getPointerToStart()
Derived & operator=(const Derived &other)
void addValue(const size_t index, const ElemType &value)
ElemType & operator[](int index)
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
Default ElementTraits SFINAE Typetraits are used to provide the correct formatting based on the eleme...