使用boost pfr 遍历结构体

This commit is contained in:
2026-06-26 09:36:14 +08:00
parent 26b5c8a54d
commit 472e609f13
17 changed files with 1322 additions and 1622 deletions
+24 -38
View File
@@ -18,21 +18,27 @@ class Global;
enum Demod_Mode { LSB, USB, AM, FM };
extern BaseLogger *dsp_logger;
struct DSP_Config : Base_DSP {
std::string url;
std::uint16_t port{};
std::int64_t power_min;
std::int64_t power_max;
std::int64_t power_offset;
std::uint64_t frame_rate;
bool debug;
Demod_Mode demod_mode;
std::int64_t audio_gain;
std::int64_t color_gain;
class DSP_Config_Data {
public:
std::string url;
std::uint16_t port{};
std::int64_t power_min;
std::int64_t power_max;
std::int64_t power_offset;
std::uint64_t frame_rate;
bool debug;
Demod_Mode demod_mode;
std::int64_t audio_gain;
std::int64_t color_gain;
PSC_USE_JSON
};
class DSP_Config : public Base_DSP, public DSP_Config_Data{
public:
~DSP_Config();
void close_dsp_device() const;
void init_update(const Psc::JSON *that_json) {
Get_J(port);
Get_J(center_freq);
@@ -46,36 +52,16 @@ struct DSP_Config : Base_DSP {
Get_J(audio_gain);
Get_J(color_gain);
}
void init(const Psc::JSON *that_json) {
init_update(that_json);
Get_J(url);
Get_J(fft_period_ms);
Get_J(fft_win_type);
Get_J(debug);
Get_J(frame_rate);
Get_J(library_path);
void from_json(const Psc::JSON *that_json) {
Base_DSP::from_base_json(that_json);
DSP_Config_Data::from_base_json(that_json);
}
Psc::JSON to_json() const {
Psc::JSON ret = Base_DSP::to_json();
Ret_J(url);
Ret_J(port);
Ret_J(power_min);
Ret_J(power_max);
Ret_J(power_offset);
Ret_J(frame_rate);
Ret_J(debug);
Ret_J(demod_mode);
Ret_J(audio_gain);
Ret_J(color_gain);
return ret;
Psc::JSON to_base_json() const {
return Base_DSP::to_base_json() += DSP_Config_Data::to_base_json();
}
void init_env();
void set_fft_point_number(uint64_t fft_point_number, bool force = false);
std::atomic<bool> record_iq_stream_ing = false;
struct Memory_Buffer {
std::vector<std::string> get_all() {
std::vector<std::string> empty;