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
33#include <VisionX/components/ImageRecordingManager/ImageRecordingManagerInterface.h>
34
36{
37 void
38 to_json(nlohmann::json& j, const ChannelConfig& cc)
39 {
40 j = nlohmann::json{
41 {"disabled", cc.disabled}, {"name", cc.name}, {"format", cc.format}, {"fps", cc.fps}};
42 }
43
44 void
45 from_json(const nlohmann::json& j, ChannelConfig& cc)
46 {
47 j.at("disabled").get_to(cc.disabled);
48 j.at("name").get_to(cc.name);
49 j.at("format").get_to(cc.format);
50 j.at("fps").get_to(cc.fps);
51 }
52
53 void
54 to_json(nlohmann::json& j, const Config& c)
55 {
56 j = nlohmann::json{{"name", c.name},
57 {"location", c.location},
58 {"startTimestamp", c.startTimestamp},
59 {"channelConfigs", c.channelConfigs}};
60 }
61
62 void
63 from_json(const nlohmann::json& j, Config& c)
64 {
65 j.at("name").get_to(c.name);
66 j.at("location").get_to(c.location);
67 j.at("startTimestamp").get_to(c.startTimestamp);
68 j.at("channelConfigs").get_to(c.channelConfigs);
69 }
70} // namespace visionx::imrec
constexpr T c
void to_json(nlohmann::json &j, const ChannelConfig &cc)
void from_json(const nlohmann::json &j, ChannelConfig &cc)