Debian Codegraph @

src/atlas/field/MissingValue.h

raw
1 /*
2 * (C) Copyright 1996- ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 *
7 * In applying this licence, ECMWF does not waive the privileges and immunities
8 * granted to it by virtue of its status as an intergovernmental organisation nor
9 * does it submit to any jurisdiction.
10 */
11
12
13 #pragma once
14
15 #include <string>
16
17 #include "atlas/field/detail/MissingValue.h"
18 #include "atlas/library/config.h"
19 #include "atlas/util/ObjectHandle.h"
20
21
22 namespace atlas {
23 class Field;
24 namespace util {
25 class Config;
26 }
27 } // namespace atlas
28
29
30 namespace atlas {
31 namespace field {
32
33
34 /**
35 * @brief Missing values indicator
36 */
37 struct MissingValue : DOXYGEN_HIDE(public util::ObjectHandle<detail::MissingValue>) {
38 using Spec = util::Config;
39 using Config = detail::MissingValue::Config;
40
41 /**
42 * @brief ctor
43 */
44 using Handle::Handle;
45 MissingValue();
46 MissingValue(const Config&);
47 MissingValue(const std::string& type, const Config&);
48 MissingValue(const Field&);
49 MissingValue(const std::string& type, const Field&);
50
51 /**
52 * @brief bool operator
53 * @return if MissingValue object has been setup
54 */
55 using Handle::operator bool; // (ensure this exists)
56
57 /**
58 * @brief operator() on user-defined values
59 * @param [in] value user-defined value
60 * @return if user-defined value indicates a missing value
61 */
62 bool operator()(const double& value) const;
63
64 /**
65 * @brief operator() on user-defined values
66 * @param [in] value user-defined value
67 * @return if user-defined value indicates a missing value
68 */
69 bool operator()(const float& value) const;
70
71 /**
72 * @brief operator() on user-defined values
73 * @param [in] value user-defined value
74 * @return if user-defined value indicates a missing value
75 */
76 bool operator()(const int& value) const;
77
78 /**
79 * @brief operator() on user-defined values
80 * @param [in] value user-defined value
81 * @return if user-defined value indicates a missing value
82 */
83 bool operator()(const long& value) const;
84
85 /**
86 * @brief operator() on user-defined values
87 * @param [in] value user-defined value
88 * @return if user-defined value indicates a missing value
89 */
90 bool operator()(const unsigned long& value) const;
91
92 /**
93 * @brief if missing value is represented by not-a-number
94 * @return if missing value is represented by not-a-number
95 */
96 bool isnan() const;
97
98 /**
99 * @brief reference to internal implementation
100 * @return reference to internal implementation
101 */
102 const detail::MissingValue& ref() const;
103
104 /**
105 * @brief fill missing value metadata on Field
106 * @param [in] field field to set
107 */
108 void metadata(Field& field) const;
109 };
110
111
112 } // namespace field
113 } // namespace atlas