20template <
typename TYPE>
22 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(0)), m_hasArraySize(false), m_arraySizeMin(size_t(0)),
23 m_hasArraySizeMin(false), m_arraySizeMax(size_t(0)), m_hasArraySizeMax(false) {}
28template <
typename TYPE>
30 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(len)), m_hasArraySize(true), m_arraySizeMin(size_t(0)),
31 m_hasArraySizeMin(false), m_arraySizeMax(size_t(0)), m_hasArraySizeMax(false) {}
37template <
typename TYPE>
39 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(0)), m_hasArraySize(false),
40 m_arraySizeMin(size_t(lenmin)), m_hasArraySizeMin(true), m_arraySizeMax(size_t(lenmax)), m_hasArraySizeMax(true) {
89 this->m_hasArraySize =
true;
90 this->m_arraySize =
value;
91 this->clearLengthMax();
92 this->clearLengthMin();
100 this->m_hasArraySizeMin =
true;
101 this->m_arraySizeMin =
value;
109 this->m_hasArraySizeMax =
true;
110 this->m_arraySizeMax =
value;
119 this->m_hasArraySize =
false;
120 this->m_arraySize = size_t(0);
128 this->m_hasArraySizeMin =
false;
129 this->m_arraySizeMin = size_t(0);
137 this->m_hasArraySizeMax =
false;
138 this->m_arraySizeMax = size_t(0);
146 return std::make_shared<ArrayLengthValidator>(*
this);
155 if (this->hasLength() &&
value.size() != this->m_arraySize) {
156 return "Incorrect size";
158 if (this->hasMinLength() &&
value.size() < this->m_arraySizeMin) {
159 return "Array size too short";
161 if (this->hasMaxLength() &&
value.size() > this->m_arraySizeMax) {
162 return "Array size too long";
172template class MANTID_KERNEL_DLL TypedValidator<
std::vector<
double>>;
179#if defined(_WIN32) || defined(__clang__) && defined(__APPLE__)
double value
The value of the point.
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
ArrayLenghtValidator : Validate length of an array property.
void setLength(const size_t &value)
Set length.
~ArrayLengthValidator() override
Destructor.
void setLengthMax(const size_t &value)
Set length max.
IValidator_sptr clone() const override
Clone function.
void clearLength()
Clear the length.
ArrayLengthValidator()
No arg constructor.
std::string checkValidity(const std::vector< TYPE > &value) const override
Private function to check validity.
void clearLengthMax()
Clear maximum.
bool hasLength() const
Return if it has a length.
const size_t & getLength() const
Return the length.
const size_t & getMaxLength() const
Return the maximum length.
bool hasMaxLength() const
Return if it has a length.
bool hasMinLength() const
Return if it has a length.
void clearLengthMin()
Clear minimum.
void setLengthMin(const size_t &value)
Set length min.
const size_t & getMinLength() const
Return the minimum length.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.