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::cmdlib::cmd to be serialized via nlohmann::json.
6 */
7#ifndef DUNEDAQ_CMDLIB_CMD_NLJS_HPP
8#define DUNEDAQ_CMDLIB_CMD_NLJS_HPP
9
10// My structs
12
13
14#include <nlohmann/json.hpp>
15
17
18 using data_t = nlohmann::json;
19
20 inline void to_json(data_t& j, const Command& obj) {
21 j["id"] = obj.id;
22 j["data"] = obj.data;
23 }
24
25 inline void from_json(const data_t& j, Command& obj) {
26 if (j.contains("id"))
27 j.at("id").get_to(obj.id);
28 obj.data = j.at("data");
29 }
30
31 inline void to_json(data_t& j, const CommandReply& obj) {
32 j["success"] = obj.success;
33 j["result"] = obj.result;
34 j["appname"] = obj.appname;
35 j["data"] = obj.data;
36 }
37
38 inline void from_json(const data_t& j, CommandReply& obj) {
39 if (j.contains("success"))
40 j.at("success").get_to(obj.success);
41 if (j.contains("result"))
42 j.at("result").get_to(obj.result);
43 if (j.contains("appname"))
44 j.at("appname").get_to(obj.appname);
45 obj.data = j.at("data");
46 }
47
48} // namespace dunedaq::cmdlib::cmd
49
50#endif // DUNEDAQ_CMDLIB_CMD_NLJS_HPP
void to_json(data_t &j, const Command &obj)
Definition Nljs.hpp:20
void from_json(const data_t &j, Command &obj)
Definition Nljs.hpp:25