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::dpdklibs::nicreader to be serialized via nlohmann::json.
6 */
7#ifndef DUNEDAQ_DPDKLIBS_NICREADER_NLJS_HPP
8#define DUNEDAQ_DPDKLIBS_NICREADER_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 SrcGeoInfo& obj) {
21 j["det_id"] = obj.det_id;
22 j["crate_id"] = obj.crate_id;
23 j["slot_id"] = obj.slot_id;
24 }
25
26 inline void from_json(const data_t& j, SrcGeoInfo& obj) {
27 if (j.contains("det_id"))
28 j.at("det_id").get_to(obj.det_id);
29 if (j.contains("crate_id"))
30 j.at("crate_id").get_to(obj.crate_id);
31 if (j.contains("slot_id"))
32 j.at("slot_id").get_to(obj.slot_id);
33 }
34
35 inline void to_json(data_t& j, const StreamMap& obj) {
36 j["source_id"] = obj.source_id;
37 j["stream_id"] = obj.stream_id;
38 }
39
40 inline void from_json(const data_t& j, StreamMap& obj) {
41 if (j.contains("source_id"))
42 j.at("source_id").get_to(obj.source_id);
43 if (j.contains("stream_id"))
44 j.at("stream_id").get_to(obj.stream_id);
45 }
46
47 inline void to_json(data_t& j, const Source& obj) {
48 j["id"] = obj.id;
49 j["ip_addr"] = obj.ip_addr;
50 j["lcore"] = obj.lcore;
51 j["rx_q"] = obj.rx_q;
52 j["src_info"] = obj.src_info;
53 j["src_streams_mapping"] = obj.src_streams_mapping;
54 }
55
56 inline void from_json(const data_t& j, Source& obj) {
57 if (j.contains("id"))
58 j.at("id").get_to(obj.id);
59 if (j.contains("ip_addr"))
60 j.at("ip_addr").get_to(obj.ip_addr);
61 if (j.contains("lcore"))
62 j.at("lcore").get_to(obj.lcore);
63 if (j.contains("rx_q"))
64 j.at("rx_q").get_to(obj.rx_q);
65 if (j.contains("src_info"))
66 j.at("src_info").get_to(obj.src_info);
67 if (j.contains("src_streams_mapping"))
68 j.at("src_streams_mapping").get_to(obj.src_streams_mapping);
69 }
70
71 inline void to_json(data_t& j, const StatsReporting& obj) {
72 j["expected_seq_id_step"] = obj.expected_seq_id_step;
73 j["expected_timestamp_step"] = obj.expected_timestamp_step;
74 j["expected_packet_size"] = obj.expected_packet_size;
75 j["analyze_nth_packet"] = obj.analyze_nth_packet;
76 }
77
78 inline void from_json(const data_t& j, StatsReporting& obj) {
79 if (j.contains("expected_seq_id_step"))
80 j.at("expected_seq_id_step").get_to(obj.expected_seq_id_step);
81 if (j.contains("expected_timestamp_step"))
82 j.at("expected_timestamp_step").get_to(obj.expected_timestamp_step);
83 if (j.contains("expected_packet_size"))
84 j.at("expected_packet_size").get_to(obj.expected_packet_size);
85 if (j.contains("analyze_nth_packet"))
86 j.at("analyze_nth_packet").get_to(obj.analyze_nth_packet);
87 }
88
89 inline void to_json(data_t& j, const Interface& obj) {
90 j["pci_addr"] = obj.pci_addr;
91 j["mac_addr"] = obj.mac_addr;
92 j["ip_addr"] = obj.ip_addr;
93 j["with_flow_control"] = obj.with_flow_control;
94 j["promiscuous_mode"] = obj.promiscuous_mode;
95 j["mtu"] = obj.mtu;
96 j["rx_ring_size"] = obj.rx_ring_size;
97 j["tx_ring_size"] = obj.tx_ring_size;
98 j["num_mbufs"] = obj.num_mbufs;
99 j["mbuf_cache_size"] = obj.mbuf_cache_size;
100 j["burst_size"] = obj.burst_size;
101 j["lcore_sleep_us"] = obj.lcore_sleep_us;
102 j["expected_sources"] = obj.expected_sources;
103 j["stats_reporting_cfg"] = obj.stats_reporting_cfg;
104 }
105
106 inline void from_json(const data_t& j, Interface& obj) {
107 if (j.contains("pci_addr"))
108 j.at("pci_addr").get_to(obj.pci_addr);
109 if (j.contains("mac_addr"))
110 j.at("mac_addr").get_to(obj.mac_addr);
111 if (j.contains("ip_addr"))
112 j.at("ip_addr").get_to(obj.ip_addr);
113 if (j.contains("with_flow_control"))
114 j.at("with_flow_control").get_to(obj.with_flow_control);
115 if (j.contains("promiscuous_mode"))
116 j.at("promiscuous_mode").get_to(obj.promiscuous_mode);
117 if (j.contains("mtu"))
118 j.at("mtu").get_to(obj.mtu);
119 if (j.contains("rx_ring_size"))
120 j.at("rx_ring_size").get_to(obj.rx_ring_size);
121 if (j.contains("tx_ring_size"))
122 j.at("tx_ring_size").get_to(obj.tx_ring_size);
123 if (j.contains("num_mbufs"))
124 j.at("num_mbufs").get_to(obj.num_mbufs);
125 if (j.contains("mbuf_cache_size"))
126 j.at("mbuf_cache_size").get_to(obj.mbuf_cache_size);
127 if (j.contains("burst_size"))
128 j.at("burst_size").get_to(obj.burst_size);
129 if (j.contains("lcore_sleep_us"))
130 j.at("lcore_sleep_us").get_to(obj.lcore_sleep_us);
131 if (j.contains("expected_sources"))
132 j.at("expected_sources").get_to(obj.expected_sources);
133 if (j.contains("stats_reporting_cfg"))
134 j.at("stats_reporting_cfg").get_to(obj.stats_reporting_cfg);
135 }
136
137 inline void to_json(data_t& j, const Conf& obj) {
138 j["ifaces"] = obj.ifaces;
139 j["eal_arg_list"] = obj.eal_arg_list;
140 }
141
142 inline void from_json(const data_t& j, Conf& obj) {
143 if (j.contains("ifaces"))
144 j.at("ifaces").get_to(obj.ifaces);
145 if (j.contains("eal_arg_list"))
146 j.at("eal_arg_list").get_to(obj.eal_arg_list);
147 }
148
149} // namespace dunedaq::dpdklibs::nicreader
150
151#endif // DUNEDAQ_DPDKLIBS_NICREADER_NLJS_HPP
void to_json(data_t &j, const SrcGeoInfo &obj)
Definition Nljs.hpp:20
void from_json(const data_t &j, SrcGeoInfo &obj)
Definition Nljs.hpp:26