DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
cmdlib
include
cmdlib
cmd
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
11
#include "
cmdlib/cmd/Structs.hpp
"
12
13
14
#include <nlohmann/json.hpp>
15
16
namespace
dunedaq::cmdlib::cmd
{
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
Structs.hpp
dunedaq::cmdlib::cmd
Definition
Nljs.hpp:16
dunedaq::cmdlib::cmd::data_t
nlohmann::json data_t
Definition
Nljs.hpp:18
dunedaq::cmdlib::cmd::to_json
void to_json(data_t &j, const Command &obj)
Definition
Nljs.hpp:20
dunedaq::cmdlib::cmd::from_json
void from_json(const data_t &j, Command &obj)
Definition
Nljs.hpp:25
dunedaq::obj
msgpack::object obj
Definition
Serialization.hpp:257
dunedaq::cmdlib::cmd::CommandReply
Definition
Structs.hpp:45
dunedaq::cmdlib::cmd::Command
Definition
Structs.hpp:28
Generated on
for DUNE-DAQ by
1.17.0