Skip to content

Commit 9030136

Browse files
Piotr Gawlowiczcodebot
authored andcommitted
asn1,utils: add nlohmann json to/from json funcs for real_s
1 parent e7063e0 commit 9030136

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
*
3+
* Copyright 2021-2025 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "asn1_utils.h"
14+
#include "nlohmann/json.hpp"
15+
16+
namespace asn1 {
17+
18+
inline void to_json(nlohmann::json& out_j, const real_s& obj)
19+
{
20+
out_j = obj.value;
21+
}
22+
23+
inline void from_json(const nlohmann::json& in_j, real_s& obj)
24+
{
25+
in_j.get_to(obj.value);
26+
}
27+
28+
inline void to_json(nlohmann::ordered_json& out_j, const real_s& obj)
29+
{
30+
out_j = obj.value;
31+
}
32+
33+
inline void from_json(const nlohmann::ordered_json& in_j, real_s& obj)
34+
{
35+
in_j.get_to(obj.value);
36+
}
37+
38+
} // namespace asn1

0 commit comments

Comments
 (0)