DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Nljs.hpp
Go to the documentation of this file.
1/*
2 * This file is 100% generated. Any manual edits will likely be lost.
3 *
4 * This contains functions struct and other type definitions for shema in
5 * namespace dunedaq::rcif::cmd to be serialized via nlohmann::json.
6 */
7#ifndef DUNEDAQ_RCIF_CMD_NLJS_HPP
8#define DUNEDAQ_RCIF_CMD_NLJS_HPP
9
10// My structs
11#include "rcif/cmd/Structs.hpp"
12
13// Nljs for externally referenced schema
14#include "cmdlib/cmd/Nljs.hpp"
15
16#include <nlohmann/json.hpp>
17
19
20 using data_t = nlohmann::json;
21
22 inline void to_json(data_t& j, const ChangeRateParams& obj) {
23 j["trigger_rate"] = obj.trigger_rate;
24 }
25
26 inline void from_json(const data_t& j, ChangeRateParams& obj) {
27 if (j.contains("trigger_rate"))
28 j.at("trigger_rate").get_to(obj.trigger_rate);
29 }
30
31 inline void to_json(data_t& j, const DisableParams& obj) {
32 j["resource_name"] = obj.resource_name;
33 }
34
35 inline void from_json(const data_t& j, DisableParams& obj) {
36 if (j.contains("resource_name"))
37 j.at("resource_name").get_to(obj.resource_name);
38 }
39
40 inline void to_json(data_t& j, const EnableParams& obj) {
41 j["resource_name"] = obj.resource_name;
42 }
43
44 inline void from_json(const data_t& j, EnableParams& obj) {
45 if (j.contains("resource_name"))
46 j.at("resource_name").get_to(obj.resource_name);
47 }
48
49 inline void to_json(data_t& j, const RCCommand& obj) {
50 j["id"] = obj.id;
51 j["entry_state"] = obj.entry_state;
52 j["exit_state"] = obj.exit_state;
53 j["data"] = obj.data;
54 }
55
56 inline void from_json(const data_t& j, RCCommand& obj) {
57 if (j.contains("id"))
58 j.at("id").get_to(obj.id);
59 if (j.contains("entry_state"))
60 j.at("entry_state").get_to(obj.entry_state);
61 if (j.contains("exit_state"))
62 j.at("exit_state").get_to(obj.exit_state);
63 if (j.contains("data"))
64 j.at("data").get_to(obj.data);
65 }
66
67 inline void to_json(data_t& j, const StartParams& obj) {
68 j["run"] = obj.run;
69 j["disable_data_storage"] = obj.disable_data_storage;
70 j["trigger_rate"] = obj.trigger_rate;
71 j["production_vs_test"] = obj.production_vs_test;
72 }
73
74 inline void from_json(const data_t& j, StartParams& obj) {
75 if (j.contains("run"))
76 j.at("run").get_to(obj.run);
77 if (j.contains("disable_data_storage"))
78 j.at("disable_data_storage").get_to(obj.disable_data_storage);
79 if (j.contains("trigger_rate"))
80 j.at("trigger_rate").get_to(obj.trigger_rate);
81 if (j.contains("production_vs_test"))
82 j.at("production_vs_test").get_to(obj.production_vs_test);
83 }
84
85} // namespace dunedaq::rcif::cmd
86
87#endif // DUNEDAQ_RCIF_CMD_NLJS_HPP
void to_json(data_t &j, const ChangeRateParams &obj)
Definition Nljs.hpp:22
void from_json(const data_t &j, ChangeRateParams &obj)
Definition Nljs.hpp:26