Mantid
Loading...
Searching...
No Matches
MandatoryValidator.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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//------------------------------------------
8// Includes
9//------------------------------------------
11#include "MantidKernel/DllConfig.h"
14#include <cmath>
15
16namespace Mantid::Kernel::Detail {
22template <> MANTID_KERNEL_DLL bool checkIsEmpty(const std::string &value) { return value.empty(); }
28template <> MANTID_KERNEL_DLL bool checkIsEmpty(const double &value) {
29 return std::fabs(value - Mantid::EMPTY_DBL()) < 1e-08;
30}
36template <> MANTID_KERNEL_DLL bool checkIsEmpty(const int &value) { return (value == Mantid::EMPTY_INT()); }
42template <> MANTID_KERNEL_DLL bool checkIsEmpty(const long &value) {
43 // 32 bit for Windows and Clang, 64 bit for GCC
44 return (value == Mantid::EMPTY_LONG());
45}
46#if defined(_WIN32) || defined(__clang__) && defined(__APPLE__)
52template <> MANTID_KERNEL_DLL bool checkIsEmpty(const int64_t &value) { return (value == Mantid::EMPTY_INT64()); }
53#endif
59template <> MANTID_KERNEL_DLL bool checkIsEmpty(const OptionalBool &value) {
60 return (value.getValue() == OptionalBool::Unset);
61}
62} // namespace Mantid::Kernel::Detail
double value
The value of the point.
Definition FitMW.cpp:51
OptionalBool : Tri-state bool.
MANTID_KERNEL_DLL bool checkIsEmpty(const T &)
Forward declare checking function.
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
Definition EmptyValues.h:24
constexpr long EMPTY_LONG() noexcept
Returns what we consider an "empty" long within a property.
Definition EmptyValues.h:30
constexpr int64_t EMPTY_INT64() noexcept
Returns what we consider an "empty" int64_t within a property.
Definition EmptyValues.h:36
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42