rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
nullvalues.hh
Go to the documentation of this file.
1/*
2* This file is part of rasdaman community.
3*
4* Rasdaman community is free software: you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation, either version 3 of the License, or
7* (at your option) any later version.
8*
9* Rasdaman community is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16*
17* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18rasdaman GmbH.
19*
20* For more information please see <http://www.rasdaman.org>
21* or contact Peter Baumann via <baumann@rasdaman.com>.
22*/
23
24#ifndef _D_NULLVALUES_
25#define _D_NULLVALUES_
26
27#include "raslib/odmgtypes.hh"
28
29#include <vector>
30#include <string>
31#include <cmath>
32
37{
38public:
40 static const double_t unlimitedLow;
42 static const double_t unlimitedHigh;
43
44 r_Nullvalues() = default;
45 explicit r_Nullvalues(std::vector<std::pair<r_Double, r_Double>> &&nullvaluesArg);
46
47 const std::vector<std::pair<r_Double, r_Double>> &getNullvalues() const
48 {
49 return nullvalues;
50 }
51
53 template <typename T>
54 inline bool isNullNonFloat(const T value) const
55 {
56 for (const auto &p: nullvalues)
57 {
58 if (value >= (p.first - DBL_EPSILON) && value <= (p.second + DBL_EPSILON))
59 {
60 return true;
61 }
62 }
63 return false;
64 }
65
68 template <typename T>
69 inline bool isNullFloat(const T value) const
70 {
71 for (const auto &p: nullvalues)
72 {
73 if ((value >= (p.first - DBL_EPSILON) && value <= (p.second + DBL_EPSILON)) ||
74 (std::isnan(value) && std::isnan(p.first)))
75 {
76 return true;
77 }
78 }
79 return false;
80 }
81
86 double getFirstNullValue() const;
87
88 std::string toString() const;
89
90protected:
91 std::vector<std::pair<r_Double, r_Double>> nullvalues;
92};
93
94#endif
Definition nullvalues.hh:37
r_Nullvalues(std::vector< std::pair< r_Double, r_Double > > &&nullvaluesArg)
double getFirstNullValue() const
if the null set contains any non-interval null values, then the first such null value is returned,...
std::vector< std::pair< r_Double, r_Double > > nullvalues
Definition nullvalues.hh:91
static const double_t unlimitedLow
the * in *:hi, it is the smallest double number
Definition nullvalues.hh:40
r_Nullvalues()=default
bool isNullFloat(const T value) const
check whether a value is in an interval (hence a null value) TODO: this needs to be improved,...
Definition nullvalues.hh:69
static const double_t unlimitedHigh
the * in lo:*, it is the maximum double number
Definition nullvalues.hh:42
const std::vector< std::pair< r_Double, r_Double > > & getNullvalues() const
Definition nullvalues.hh:47
std::string toString() const
bool isNullNonFloat(const T value) const
check whether a value is in an interval (hence a null value)
Definition nullvalues.hh:54