DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::cmdlib::cmd Namespace Reference

Classes

struct  Command
struct  CommandReply

Typedefs

using data_t = nlohmann::json
using AppId = std::string
using CmdId = std::string
using Data = nlohmann::json
using IsOk = bool
using Result = std::string

Functions

void to_json (data_t &j, const Command &obj)
void from_json (const data_t &j, Command &obj)
void to_json (data_t &j, const CommandReply &obj)
void from_json (const data_t &j, CommandReply &obj)

Typedef Documentation

◆ AppId

using dunedaq::cmdlib::cmd::AppId = std::string

Definition at line 18 of file Structs.hpp.

◆ CmdId

using dunedaq::cmdlib::cmd::CmdId = std::string

Definition at line 21 of file Structs.hpp.

◆ Data

using dunedaq::cmdlib::cmd::Data = nlohmann::json

Definition at line 24 of file Structs.hpp.

◆ data_t

using dunedaq::cmdlib::cmd::data_t = nlohmann::json

Definition at line 17 of file Nljs.hpp.

◆ IsOk

Definition at line 38 of file Structs.hpp.

◆ Result

using dunedaq::cmdlib::cmd::Result = std::string

Definition at line 41 of file Structs.hpp.

Function Documentation

◆ from_json() [1/2]

void dunedaq::cmdlib::cmd::from_json ( const data_t & j,
Command & obj )
inline

Definition at line 27 of file Nljs.hpp.

28{
29 if (j.contains("id"))
30 j.at("id").get_to(obj.id);
31 obj.data = j.at("data");
32}
msgpack::object obj

◆ from_json() [2/2]

void dunedaq::cmdlib::cmd::from_json ( const data_t & j,
CommandReply & obj )
inline

Definition at line 44 of file Nljs.hpp.

45{
46 if (j.contains("success"))
47 j.at("success").get_to(obj.success);
48 if (j.contains("result"))
49 j.at("result").get_to(obj.result);
50 if (j.contains("appname"))
51 j.at("appname").get_to(obj.appname);
52 obj.data = j.at("data");
53}

◆ to_json() [1/2]

void dunedaq::cmdlib::cmd::to_json ( data_t & j,
const Command & obj )
inline

Definition at line 20 of file Nljs.hpp.

21{
22 j["id"] = obj.id;
23 j["data"] = obj.data;
24}

◆ to_json() [2/2]

void dunedaq::cmdlib::cmd::to_json ( data_t & j,
const CommandReply & obj )
inline

Definition at line 35 of file Nljs.hpp.

36{
37 j["success"] = obj.success;
38 j["result"] = obj.result;
39 j["appname"] = obj.appname;
40 j["data"] = obj.data;
41}