PyPartMC 2.1.2__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyPartMC/_PyPartMC.pyd +0 -0
- PyPartMC/__generate_si.py +37 -0
- PyPartMC/__init__.py +78 -0
- PyPartMC/cmake/PyPartMCConfig.cmake +65 -0
- PyPartMC/include/PyPartMC/aero_binned.hpp +117 -0
- PyPartMC/include/PyPartMC/aero_data.hpp +283 -0
- PyPartMC/include/PyPartMC/aero_dist.hpp +85 -0
- PyPartMC/include/PyPartMC/aero_mode.hpp +359 -0
- PyPartMC/include/PyPartMC/aero_particle.hpp +275 -0
- PyPartMC/include/PyPartMC/aero_state.hpp +664 -0
- PyPartMC/include/PyPartMC/bin_grid.hpp +143 -0
- PyPartMC/include/PyPartMC/camp_core.hpp +31 -0
- PyPartMC/include/PyPartMC/condense.hpp +35 -0
- PyPartMC/include/PyPartMC/env_state.hpp +161 -0
- PyPartMC/include/PyPartMC/gas_data.hpp +105 -0
- PyPartMC/include/PyPartMC/gas_state.hpp +129 -0
- PyPartMC/include/PyPartMC/getters.hpp +55 -0
- PyPartMC/include/PyPartMC/input_guard.hpp +155 -0
- PyPartMC/include/PyPartMC/json_resource.hpp +363 -0
- PyPartMC/include/PyPartMC/output.hpp +96 -0
- PyPartMC/include/PyPartMC/photolysis.hpp +29 -0
- PyPartMC/include/PyPartMC/pmc_resource.hpp +42 -0
- PyPartMC/include/PyPartMC/rand.hpp +12 -0
- PyPartMC/include/PyPartMC/run_exact.hpp +34 -0
- PyPartMC/include/PyPartMC/run_exact_opt.hpp +46 -0
- PyPartMC/include/PyPartMC/run_part.hpp +110 -0
- PyPartMC/include/PyPartMC/run_part_opt.hpp +72 -0
- PyPartMC/include/PyPartMC/run_sect.hpp +34 -0
- PyPartMC/include/PyPartMC/run_sect_opt.hpp +54 -0
- PyPartMC/include/PyPartMC/scenario.hpp +220 -0
- PyPartMC/include/PyPartMC/si.hpp +118 -0
- PyPartMC/include/PyPartMC/util.hpp +22 -0
- PyPartMC/include/PyPartMC.hpp +28 -0
- PyPartMC/include/aero_data_parameters.hpp +27 -0
- PyPartMC/include/bpstd/detail/string_view.inl +925 -0
- PyPartMC/include/bpstd/string_view.hpp +498 -0
- PyPartMC/include/gas_data_parameters.hpp +14 -0
- PyPartMC/include/nanobind_json/nanobind_json.h +226 -0
- PyPartMC/include/nlohmann/adl_serializer.hpp +55 -0
- PyPartMC/include/nlohmann/byte_container_with_subtype.hpp +103 -0
- PyPartMC/include/nlohmann/detail/abi_macros.hpp +100 -0
- PyPartMC/include/nlohmann/detail/conversions/from_json.hpp +497 -0
- PyPartMC/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
- PyPartMC/include/nlohmann/detail/conversions/to_json.hpp +446 -0
- PyPartMC/include/nlohmann/detail/exceptions.hpp +257 -0
- PyPartMC/include/nlohmann/detail/hash.hpp +129 -0
- PyPartMC/include/nlohmann/detail/input/binary_reader.hpp +3009 -0
- PyPartMC/include/nlohmann/detail/input/input_adapters.hpp +492 -0
- PyPartMC/include/nlohmann/detail/input/json_sax.hpp +727 -0
- PyPartMC/include/nlohmann/detail/input/lexer.hpp +1633 -0
- PyPartMC/include/nlohmann/detail/input/parser.hpp +519 -0
- PyPartMC/include/nlohmann/detail/input/position_t.hpp +37 -0
- PyPartMC/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
- PyPartMC/include/nlohmann/detail/iterators/iter_impl.hpp +751 -0
- PyPartMC/include/nlohmann/detail/iterators/iteration_proxy.hpp +242 -0
- PyPartMC/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
- PyPartMC/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
- PyPartMC/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
- PyPartMC/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
- PyPartMC/include/nlohmann/detail/json_pointer.hpp +988 -0
- PyPartMC/include/nlohmann/detail/json_ref.hpp +78 -0
- PyPartMC/include/nlohmann/detail/macro_scope.hpp +482 -0
- PyPartMC/include/nlohmann/detail/macro_unscope.hpp +45 -0
- PyPartMC/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
- PyPartMC/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
- PyPartMC/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
- PyPartMC/include/nlohmann/detail/meta/detected.hpp +70 -0
- PyPartMC/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
- PyPartMC/include/nlohmann/detail/meta/is_sax.hpp +159 -0
- PyPartMC/include/nlohmann/detail/meta/std_fs.hpp +29 -0
- PyPartMC/include/nlohmann/detail/meta/type_traits.hpp +795 -0
- PyPartMC/include/nlohmann/detail/meta/void_t.hpp +24 -0
- PyPartMC/include/nlohmann/detail/output/binary_writer.hpp +1838 -0
- PyPartMC/include/nlohmann/detail/output/output_adapters.hpp +147 -0
- PyPartMC/include/nlohmann/detail/output/serializer.hpp +988 -0
- PyPartMC/include/nlohmann/detail/string_concat.hpp +146 -0
- PyPartMC/include/nlohmann/detail/string_escape.hpp +72 -0
- PyPartMC/include/nlohmann/detail/value_t.hpp +118 -0
- PyPartMC/include/nlohmann/json.hpp +5258 -0
- PyPartMC/include/nlohmann/json_fwd.hpp +75 -0
- PyPartMC/include/nlohmann/ordered_map.hpp +359 -0
- PyPartMC/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
- PyPartMC/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
- PyPartMC/include/output_parameters.hpp +25 -0
- PyPartMC/include/tcb/span.hpp +617 -0
- PyPartMC/include/tl/optional.hpp +2062 -0
- PyPartMC/lib/libpartmclib.a +0 -0
- pypartmc-2.1.2.dist-info/METADATA +494 -0
- pypartmc-2.1.2.dist-info/RECORD +91 -0
- pypartmc-2.1.2.dist-info/WHEEL +5 -0
- pypartmc-2.1.2.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* Copyright (c) 2019, Martin Renou, Ian Bell, Gracjan Adamus *
|
|
3
|
+
* *
|
|
4
|
+
* Distributed under the terms of the BSD 3-Clause License. *
|
|
5
|
+
* *
|
|
6
|
+
* The full license is in the file LICENSE, distributed with this software. *
|
|
7
|
+
****************************************************************************/
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include <string>
|
|
12
|
+
#include <set>
|
|
13
|
+
|
|
14
|
+
#undef snprintf // required to fix an issue with std::snprintf in nlohmann::json
|
|
15
|
+
#include <nlohmann/json.hpp>
|
|
16
|
+
#include <nanobind/nanobind.h>
|
|
17
|
+
#include <nanobind/stl/string.h>
|
|
18
|
+
|
|
19
|
+
namespace nb = nanobind;
|
|
20
|
+
namespace nl = nlohmann;
|
|
21
|
+
|
|
22
|
+
namespace nbjson {
|
|
23
|
+
class CircularReferenceError : public std::runtime_error {
|
|
24
|
+
public:
|
|
25
|
+
CircularReferenceError(const char *msg) : std::runtime_error{msg} {}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename JSONType>
|
|
29
|
+
inline nb::object from_json(const JSONType &j) {
|
|
30
|
+
if (j.is_null()) {
|
|
31
|
+
return nb::none();
|
|
32
|
+
}
|
|
33
|
+
else if (j.is_boolean()) {
|
|
34
|
+
return nb::bool_(j.template get<bool>());
|
|
35
|
+
}
|
|
36
|
+
else if (j.is_number_integer()) {
|
|
37
|
+
return nb::int_(j.template get<long long>());
|
|
38
|
+
}
|
|
39
|
+
else if (j.is_number_float()) {
|
|
40
|
+
return nb::float_(j.template get<double>());
|
|
41
|
+
}
|
|
42
|
+
else if (j.is_string()) {
|
|
43
|
+
return nb::str(j.template get<std::string>().c_str());
|
|
44
|
+
}
|
|
45
|
+
else if (j.is_array()) {
|
|
46
|
+
nb::list obj;
|
|
47
|
+
for (const auto &el : j) {
|
|
48
|
+
obj.append(from_json<JSONType>(el));
|
|
49
|
+
}
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
nb::dict obj;
|
|
54
|
+
for (typename JSONType::const_iterator it = j.cbegin(); it != j.cend(); ++it) {
|
|
55
|
+
obj[nb::str(it.key().c_str())] = from_json<JSONType>(it.value());
|
|
56
|
+
}
|
|
57
|
+
return obj;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
template <typename JSONType>
|
|
62
|
+
inline JSONType to_json(const nb::handle &obj, std::set<const PyObject *> &refs) {
|
|
63
|
+
if (obj.ptr() == nullptr || obj.is_none()) {
|
|
64
|
+
return nullptr;
|
|
65
|
+
}
|
|
66
|
+
else if (nb::isinstance<nb::bool_>(obj)) {
|
|
67
|
+
return nb::cast<bool>(obj);
|
|
68
|
+
}
|
|
69
|
+
else if (nb::isinstance<nb::int_>(obj)) {
|
|
70
|
+
return nb::cast<long long>(obj);
|
|
71
|
+
}
|
|
72
|
+
else if (nb::isinstance<nb::float_>(obj)) {
|
|
73
|
+
return nb::cast<double>(obj);
|
|
74
|
+
}
|
|
75
|
+
else if (nb::isinstance<nb::bytes>(obj)) {
|
|
76
|
+
nb::module_ base64 = nb::module_::import_("base64");
|
|
77
|
+
return nb::cast<std::string>(base64.attr("b64encode")(obj).attr("decode")("utf-8"));
|
|
78
|
+
}
|
|
79
|
+
else if (nb::isinstance<nb::str>(obj)) {
|
|
80
|
+
return nb::cast<std::string>(obj);
|
|
81
|
+
}
|
|
82
|
+
else if (nb::isinstance<nb::tuple>(obj) || nb::isinstance<nb::list>(obj)) {
|
|
83
|
+
auto insert_ret = refs.insert(obj.ptr());
|
|
84
|
+
if (!insert_ret.second) {
|
|
85
|
+
throw CircularReferenceError("Circular reference detected");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
auto out = JSONType::array();
|
|
89
|
+
for (const nb::handle value : obj) {
|
|
90
|
+
out.push_back(to_json<JSONType>(value, refs));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
refs.erase(insert_ret.first);
|
|
94
|
+
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
else if (nb::isinstance<nb::dict>(obj)) {
|
|
98
|
+
auto insert_ret = refs.insert(obj.ptr());
|
|
99
|
+
if (!insert_ret.second) {
|
|
100
|
+
throw CircularReferenceError("Circular reference detected");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
auto out = JSONType::object();
|
|
104
|
+
for (const nb::handle key : obj) {
|
|
105
|
+
out[nb::cast<std::string>(nb::str(key))] = to_json<JSONType>(obj[key], refs);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
refs.erase(insert_ret.first);
|
|
109
|
+
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
throw std::runtime_error("to_json not implemented for this type of object: " + nb::cast<std::string>(nb::repr(obj)));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
template <typename JSONType>
|
|
118
|
+
inline JSONType to_json(const nb::handle &obj) {
|
|
119
|
+
std::set<const PyObject *> refs;
|
|
120
|
+
return to_json<JSONType>(obj, refs);
|
|
121
|
+
}
|
|
122
|
+
} // nbjson
|
|
123
|
+
|
|
124
|
+
// nlohmann_json serializers
|
|
125
|
+
namespace nlohmann {
|
|
126
|
+
#define MAKE_NLJSON_SERIALIZER_DESERIALIZER(T) \
|
|
127
|
+
template <> \
|
|
128
|
+
struct adl_serializer<T> { \
|
|
129
|
+
inline static void to_json(json &j, const T &obj) { \
|
|
130
|
+
j = nbjson::to_json<json>(obj); \
|
|
131
|
+
} \
|
|
132
|
+
\
|
|
133
|
+
inline static T from_json(const json &j) { \
|
|
134
|
+
return nb::cast<T>(nbjson::from_json<json>(j)); \
|
|
135
|
+
} \
|
|
136
|
+
\
|
|
137
|
+
inline static void to_json(ordered_json &j, const T &obj) { \
|
|
138
|
+
j = nbjson::to_json<ordered_json>(obj); \
|
|
139
|
+
} \
|
|
140
|
+
\
|
|
141
|
+
inline static T from_json(const ordered_json &j) { \
|
|
142
|
+
return nb::cast<T>(nbjson::from_json<ordered_json>(j)); \
|
|
143
|
+
} \
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#define MAKE_NLJSON_SERIALIZER_ONLY(T) \
|
|
147
|
+
template <> \
|
|
148
|
+
struct adl_serializer<T> { \
|
|
149
|
+
inline static void to_json(json &j, const T &obj) { \
|
|
150
|
+
j = nbjson::to_json<json>(obj); \
|
|
151
|
+
} \
|
|
152
|
+
\
|
|
153
|
+
inline static void to_json(ordered_json &j, const T &obj) { \
|
|
154
|
+
j = nbjson::to_json<ordered_json>(obj); \
|
|
155
|
+
} \
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::object);
|
|
159
|
+
|
|
160
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::bool_);
|
|
161
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::int_);
|
|
162
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::float_);
|
|
163
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::str);
|
|
164
|
+
|
|
165
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::list);
|
|
166
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::tuple);
|
|
167
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(nb::dict);
|
|
168
|
+
|
|
169
|
+
MAKE_NLJSON_SERIALIZER_ONLY(nb::handle);
|
|
170
|
+
|
|
171
|
+
#undef MAKE_NLJSON_SERIALIZER_DESERIALIZER
|
|
172
|
+
#undef MAKE_NLJSON_SERIALIZER_ONLY
|
|
173
|
+
} // nlohmann
|
|
174
|
+
|
|
175
|
+
NAMESPACE_BEGIN(NB_NAMESPACE)
|
|
176
|
+
NAMESPACE_BEGIN(detail)
|
|
177
|
+
|
|
178
|
+
// nanobind caster
|
|
179
|
+
template <> struct type_caster<nl::json> {
|
|
180
|
+
public:
|
|
181
|
+
NB_TYPE_CASTER(nl::json, const_name("JSON"))
|
|
182
|
+
|
|
183
|
+
bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) {
|
|
184
|
+
try {
|
|
185
|
+
value = nbjson::to_json<nl::json>(src);
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
catch (nbjson::CircularReferenceError &e) {
|
|
189
|
+
throw e;
|
|
190
|
+
}
|
|
191
|
+
catch (...) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static handle from_cpp(const nl::json &src, rv_policy policy, cleanup_list *cleanup) noexcept {
|
|
197
|
+
object obj = nbjson::from_json<nl::json>(src);
|
|
198
|
+
return obj.release();
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
template <> struct type_caster<nl::ordered_json> {
|
|
203
|
+
public:
|
|
204
|
+
NB_TYPE_CASTER(nl::ordered_json, const_name("OrderedJSON"))
|
|
205
|
+
|
|
206
|
+
bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) {
|
|
207
|
+
try {
|
|
208
|
+
value = nbjson::to_json<nl::ordered_json>(src);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
catch (nbjson::CircularReferenceError &e) {
|
|
212
|
+
throw e;
|
|
213
|
+
}
|
|
214
|
+
catch (...) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
static handle from_cpp(const nl::ordered_json &src, rv_policy policy, cleanup_list *cleanup) noexcept {
|
|
220
|
+
object obj = nbjson::from_json<nl::ordered_json>(src);
|
|
221
|
+
return obj.release();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
NAMESPACE_END(detail)
|
|
226
|
+
NAMESPACE_END(NB_NAMESPACE)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// __ _____ _____ _____
|
|
2
|
+
// __| | __| | | | JSON for Modern C++
|
|
3
|
+
// | | |__ | | | | | | version 3.11.3
|
|
4
|
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|
5
|
+
//
|
|
6
|
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
|
7
|
+
// SPDX-License-Identifier: MIT
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include <utility>
|
|
12
|
+
|
|
13
|
+
#include <nlohmann/detail/abi_macros.hpp>
|
|
14
|
+
#include <nlohmann/detail/conversions/from_json.hpp>
|
|
15
|
+
#include <nlohmann/detail/conversions/to_json.hpp>
|
|
16
|
+
#include <nlohmann/detail/meta/identity_tag.hpp>
|
|
17
|
+
|
|
18
|
+
NLOHMANN_JSON_NAMESPACE_BEGIN
|
|
19
|
+
|
|
20
|
+
/// @sa https://json.nlohmann.me/api/adl_serializer/
|
|
21
|
+
template<typename ValueType, typename>
|
|
22
|
+
struct adl_serializer
|
|
23
|
+
{
|
|
24
|
+
/// @brief convert a JSON value to any value type
|
|
25
|
+
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
|
|
26
|
+
template<typename BasicJsonType, typename TargetType = ValueType>
|
|
27
|
+
static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
|
|
28
|
+
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
|
|
29
|
+
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
|
|
30
|
+
{
|
|
31
|
+
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// @brief convert a JSON value to any value type
|
|
35
|
+
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
|
|
36
|
+
template<typename BasicJsonType, typename TargetType = ValueType>
|
|
37
|
+
static auto from_json(BasicJsonType && j) noexcept(
|
|
38
|
+
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
|
|
39
|
+
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
|
|
40
|
+
{
|
|
41
|
+
return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// @brief convert any value type to a JSON value
|
|
45
|
+
/// @sa https://json.nlohmann.me/api/adl_serializer/to_json/
|
|
46
|
+
template<typename BasicJsonType, typename TargetType = ValueType>
|
|
47
|
+
static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
|
|
48
|
+
noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
|
|
49
|
+
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
|
|
50
|
+
{
|
|
51
|
+
::nlohmann::to_json(j, std::forward<TargetType>(val));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
NLOHMANN_JSON_NAMESPACE_END
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// __ _____ _____ _____
|
|
2
|
+
// __| | __| | | | JSON for Modern C++
|
|
3
|
+
// | | |__ | | | | | | version 3.11.3
|
|
4
|
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|
5
|
+
//
|
|
6
|
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
|
7
|
+
// SPDX-License-Identifier: MIT
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include <cstdint> // uint8_t, uint64_t
|
|
12
|
+
#include <tuple> // tie
|
|
13
|
+
#include <utility> // move
|
|
14
|
+
|
|
15
|
+
#include <nlohmann/detail/abi_macros.hpp>
|
|
16
|
+
|
|
17
|
+
NLOHMANN_JSON_NAMESPACE_BEGIN
|
|
18
|
+
|
|
19
|
+
/// @brief an internal type for a backed binary type
|
|
20
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/
|
|
21
|
+
template<typename BinaryType>
|
|
22
|
+
class byte_container_with_subtype : public BinaryType
|
|
23
|
+
{
|
|
24
|
+
public:
|
|
25
|
+
using container_type = BinaryType;
|
|
26
|
+
using subtype_type = std::uint64_t;
|
|
27
|
+
|
|
28
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
|
|
29
|
+
byte_container_with_subtype() noexcept(noexcept(container_type()))
|
|
30
|
+
: container_type()
|
|
31
|
+
{}
|
|
32
|
+
|
|
33
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
|
|
34
|
+
byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))
|
|
35
|
+
: container_type(b)
|
|
36
|
+
{}
|
|
37
|
+
|
|
38
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
|
|
39
|
+
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))
|
|
40
|
+
: container_type(std::move(b))
|
|
41
|
+
{}
|
|
42
|
+
|
|
43
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
|
|
44
|
+
byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b)))
|
|
45
|
+
: container_type(b)
|
|
46
|
+
, m_subtype(subtype_)
|
|
47
|
+
, m_has_subtype(true)
|
|
48
|
+
{}
|
|
49
|
+
|
|
50
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
|
|
51
|
+
byte_container_with_subtype(container_type&& b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))))
|
|
52
|
+
: container_type(std::move(b))
|
|
53
|
+
, m_subtype(subtype_)
|
|
54
|
+
, m_has_subtype(true)
|
|
55
|
+
{}
|
|
56
|
+
|
|
57
|
+
bool operator==(const byte_container_with_subtype& rhs) const
|
|
58
|
+
{
|
|
59
|
+
return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
|
|
60
|
+
std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
bool operator!=(const byte_container_with_subtype& rhs) const
|
|
64
|
+
{
|
|
65
|
+
return !(rhs == *this);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// @brief sets the binary subtype
|
|
69
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/
|
|
70
|
+
void set_subtype(subtype_type subtype_) noexcept
|
|
71
|
+
{
|
|
72
|
+
m_subtype = subtype_;
|
|
73
|
+
m_has_subtype = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// @brief return the binary subtype
|
|
77
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/
|
|
78
|
+
constexpr subtype_type subtype() const noexcept
|
|
79
|
+
{
|
|
80
|
+
return m_has_subtype ? m_subtype : static_cast<subtype_type>(-1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// @brief return whether the value has a subtype
|
|
84
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/
|
|
85
|
+
constexpr bool has_subtype() const noexcept
|
|
86
|
+
{
|
|
87
|
+
return m_has_subtype;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// @brief clears the binary subtype
|
|
91
|
+
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/
|
|
92
|
+
void clear_subtype() noexcept
|
|
93
|
+
{
|
|
94
|
+
m_subtype = 0;
|
|
95
|
+
m_has_subtype = false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private:
|
|
99
|
+
subtype_type m_subtype = 0;
|
|
100
|
+
bool m_has_subtype = false;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
NLOHMANN_JSON_NAMESPACE_END
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// __ _____ _____ _____
|
|
2
|
+
// __| | __| | | | JSON for Modern C++
|
|
3
|
+
// | | |__ | | | | | | version 3.11.3
|
|
4
|
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|
5
|
+
//
|
|
6
|
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
|
7
|
+
// SPDX-License-Identifier: MIT
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
// This file contains all macro definitions affecting or depending on the ABI
|
|
12
|
+
|
|
13
|
+
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
|
|
14
|
+
#if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
|
|
15
|
+
#if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3
|
|
16
|
+
#warning "Already included a different version of the library!"
|
|
17
|
+
#endif
|
|
18
|
+
#endif
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum)
|
|
22
|
+
#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum)
|
|
23
|
+
#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum)
|
|
24
|
+
|
|
25
|
+
#ifndef JSON_DIAGNOSTICS
|
|
26
|
+
#define JSON_DIAGNOSTICS 0
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
|
30
|
+
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#if JSON_DIAGNOSTICS
|
|
34
|
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
|
|
35
|
+
#else
|
|
36
|
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
|
40
|
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
|
|
41
|
+
#else
|
|
42
|
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
|
46
|
+
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
// Construct the namespace ABI tags component
|
|
50
|
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
|
|
51
|
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
|
|
52
|
+
NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
|
|
53
|
+
|
|
54
|
+
#define NLOHMANN_JSON_ABI_TAGS \
|
|
55
|
+
NLOHMANN_JSON_ABI_TAGS_CONCAT( \
|
|
56
|
+
NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
|
|
57
|
+
NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
|
|
58
|
+
|
|
59
|
+
// Construct the namespace version component
|
|
60
|
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
|
|
61
|
+
_v ## major ## _ ## minor ## _ ## patch
|
|
62
|
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
|
|
63
|
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
|
|
64
|
+
|
|
65
|
+
#if NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
|
66
|
+
#define NLOHMANN_JSON_NAMESPACE_VERSION
|
|
67
|
+
#else
|
|
68
|
+
#define NLOHMANN_JSON_NAMESPACE_VERSION \
|
|
69
|
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
|
|
70
|
+
NLOHMANN_JSON_VERSION_MINOR, \
|
|
71
|
+
NLOHMANN_JSON_VERSION_PATCH)
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
// Combine namespace components
|
|
75
|
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
|
|
76
|
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
|
|
77
|
+
NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
|
|
78
|
+
|
|
79
|
+
#ifndef NLOHMANN_JSON_NAMESPACE
|
|
80
|
+
#define NLOHMANN_JSON_NAMESPACE \
|
|
81
|
+
nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
|
82
|
+
NLOHMANN_JSON_ABI_TAGS, \
|
|
83
|
+
NLOHMANN_JSON_NAMESPACE_VERSION)
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
|
|
87
|
+
#define NLOHMANN_JSON_NAMESPACE_BEGIN \
|
|
88
|
+
namespace nlohmann \
|
|
89
|
+
{ \
|
|
90
|
+
inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
|
91
|
+
NLOHMANN_JSON_ABI_TAGS, \
|
|
92
|
+
NLOHMANN_JSON_NAMESPACE_VERSION) \
|
|
93
|
+
{
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
#ifndef NLOHMANN_JSON_NAMESPACE_END
|
|
97
|
+
#define NLOHMANN_JSON_NAMESPACE_END \
|
|
98
|
+
} /* namespace (inline namespace) NOLINT(readability/namespace) */ \
|
|
99
|
+
} // namespace nlohmann
|
|
100
|
+
#endif
|