json_conversions.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::RecordingManager
17  * @author Christian R. G. Dreher <c.dreher@kit.edu>
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 
24 #pragma once
25 
26 
27 // Simox
28 #include <SimoxUtility/json.h>
29 
30 // ArmarX
32 #include <VisionX/components/ImageRecordingManager/ImageRecordingManagerInterface.h>
33 
34 
35 namespace visionx::imrec
36 {
37  void to_json(nlohmann::json& j, const ChannelConfig& cc)
38  {
39  j = nlohmann::json
40  {
41  {"disabled", cc.disabled},
42  {"name", cc.name},
43  {"format", cc.format},
44  {"fps", cc.fps}
45  };
46  }
47 
48  void from_json(const nlohmann::json& j, ChannelConfig& cc)
49  {
50  j.at("disabled").get_to(cc.disabled);
51  j.at("name").get_to(cc.name);
52  j.at("format").get_to(cc.format);
53  j.at("fps").get_to(cc.fps);
54  }
55 
56  void to_json(nlohmann::json& j, const Config& c)
57  {
58  j = nlohmann::json
59  {
60  {"name", c.name},
61  {"location", c.location},
62  {"startTimestamp", c.startTimestamp},
63  {"channelConfigs", c.channelConfigs}
64  };
65  }
66 
67  void from_json(const nlohmann::json& j, Config& c)
68  {
69  j.at("name").get_to(c.name);
70  j.at("location").get_to(c.location);
71  j.at("startTimestamp").get_to(c.startTimestamp);
72  j.at("channelConfigs").get_to(c.channelConfigs);
73  }
74 }
visionx::imrec::to_json
void to_json(nlohmann::json &j, const ChannelConfig &cc)
Definition: json_conversions.h:37
visionx::imrec::from_json
void from_json(const nlohmann::json &j, ChannelConfig &cc)
Definition: json_conversions.h:48
json_conversions.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
visionx::imrec
Definition: json_conversions.h:35