66template <
typename Derived,
typename ElemType>
68 if (other.getSize() != this->getSize()) {
69 throw std::runtime_error(
"Cannot assign between VectorParameters where the "
70 "size of the vectors are different.");
73 this->m_isValid = other.m_isValid;
74 for (
size_t i = 0; i < other.getSize(); i++) {
75 this->m_arry[i] = other.m_arry[i];
78 return *(
dynamic_cast<Derived *
>(
this));
86template <
typename Derived,
typename ElemType>
88 if (other.m_isValid != this->m_isValid) {
91 if (other.getSize() != this->getSize()) {
94 for (
size_t i = 0; i < other.getSize(); i++) {
95 if (this->m_arry[i] != other.m_arry[i]) {
107template <
typename Derived,
typename ElemType>
109 return !(*
this == other);
116template <
typename Derived,
typename ElemType>
121template <
typename Derived,
typename ElemType>
125 m_isValid = other.m_isValid;
126 m_arry =
new ElemType[other.getSize()];
127 for (
size_t i = 0; i < other.getSize(); i++) {
128 this->m_arry[i] = other.m_arry[i];
134template <
typename Derived,
typename ElemType>
143template <
typename Derived,
typename ElemType>
145 m_arry =
new ElemType[size];
158template <
typename Derived,
typename ElemType>
169 throw std::runtime_error(
"Cannot serialize VectorParameter if it is not valid!");
171 std::string valueXMLtext;
172 for (
size_t i = 0; i <
m_size; i++) {
179 return this->parameterXMLTemplate(valueXMLtext);
188 return m_arry[
index];
213 return m_arry[
index];
223#define DECLARE_VECTOR_PARAMETER(classname, type_) \
224 class classname : public Mantid::API::VectorParameter<classname, type_> { \
226 using SuperType = Mantid::API::VectorParameter<classname, type_>; \
227 static std::string parameterName() { return #classname; } \
228 classname() : SuperType() {} \
229 classname(size_t index) : SuperType(index) {} \
230 std::string getName() const override { return #classname; } \
231 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
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.
Default ElementTraits SFINAE Typetraits are used to provide the correct formatting based on the eleme...