Mantid
Loading...
Searching...
No Matches
MandatoryValidator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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"
11#include <memory>
12#include <vector>
13
14namespace Mantid {
15namespace Kernel {
16namespace Detail {
18template <typename T> MANTID_KERNEL_DLL bool checkIsEmpty(const T &);
19
21template <typename T> bool checkIsEmpty(const std::vector<T> &value) { return value.empty(); }
22
24template <typename T> struct IsEmpty {
30 static bool check(const T &value) { return checkIsEmpty(value); }
31};
32} // namespace Detail
33
44template <typename TYPE> class MandatoryValidator : public TypedValidator<TYPE> {
45public:
46 IValidator_sptr clone() const override { return std::make_shared<MandatoryValidator>(); }
47
48private:
54 std::string checkValidity(const TYPE &value) const override {
56 return "A value must be entered for this parameter";
57 else
58 return "";
59 }
60};
61
62} // namespace Kernel
63} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
Validator to check that a property is not left empty.
IValidator_sptr clone() const override
std::string checkValidity(const TYPE &value) const override
Check if a value has been provided.
MANTID_KERNEL_DLL bool checkIsEmpty(const T &)
Forward declare checking function.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Helper class which provides the Collimation Length for SANS instruments.
Defines the concept of emptiness.
static bool check(const T &value)
Returns true if the value is considered empty.