mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-04-30 10:41:25 +00:00
Improve constructors
Prefer initialization to assignment in constructors Improves the readability of the code and performance Easier detection of unused members (see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md\#Rc-initialize\)
This commit is contained in:
@@ -49,7 +49,20 @@ hybrid_observables_gs_sptr hybrid_observables_gs_make(const Obs_Conf &conf_)
|
||||
|
||||
hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) : gr::block("hybrid_observables_gs",
|
||||
gr::io_signature::make(conf_.nchannels_in, conf_.nchannels_in, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(conf_.nchannels_out, conf_.nchannels_out, sizeof(Gnss_Synchro)))
|
||||
gr::io_signature::make(conf_.nchannels_out, conf_.nchannels_out, sizeof(Gnss_Synchro))),
|
||||
d_conf(conf_),
|
||||
d_dump_filename(conf_.dump_filename),
|
||||
d_smooth_filter_M(static_cast<double>(conf_.smoothing_factor)),
|
||||
d_T_rx_step_s(static_cast<double>(conf_.observable_interval_ms) / 1000.0),
|
||||
d_T_rx_TOW_ms(0U),
|
||||
d_T_rx_step_ms(conf_.observable_interval_ms),
|
||||
d_T_status_report_timer_ms(0),
|
||||
d_nchannels_in(conf_.nchannels_in),
|
||||
d_nchannels_out(conf_.nchannels_out),
|
||||
d_T_rx_TOW_set(false),
|
||||
d_dump(conf_.dump),
|
||||
d_dump_mat(conf_.dump_mat && d_dump)
|
||||
|
||||
{
|
||||
// PVT input message port
|
||||
this->message_port_register_in(pmt::mp("pvt_to_observables"));
|
||||
@@ -63,16 +76,32 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) : gr::block(
|
||||
boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Send Channel status to gnss_flowgraph
|
||||
this->message_port_register_out(pmt::mp("status"));
|
||||
d_conf = conf_;
|
||||
d_dump = conf_.dump;
|
||||
d_dump_mat = conf_.dump_mat and d_dump;
|
||||
d_dump_filename = conf_.dump_filename;
|
||||
d_nchannels_out = conf_.nchannels_out;
|
||||
d_nchannels_in = conf_.nchannels_in;
|
||||
|
||||
d_gnss_synchro_history = std::make_unique<Gnss_circular_deque<Gnss_Synchro>>(1000, d_nchannels_out);
|
||||
|
||||
d_Rx_clock_buffer.set_capacity(std::min(std::max(200U / d_T_rx_step_ms, 3U), 10U));
|
||||
d_Rx_clock_buffer.clear();
|
||||
|
||||
d_channel_last_pll_lock = std::vector<bool>(d_nchannels_out, false);
|
||||
d_channel_last_pseudorange_smooth = std::vector<double>(d_nchannels_out, 0.0);
|
||||
d_channel_last_carrier_phase_rads = std::vector<double>(d_nchannels_out, 0.0);
|
||||
|
||||
d_mapStringValues["1C"] = evGPS_1C;
|
||||
d_mapStringValues["2S"] = evGPS_2S;
|
||||
d_mapStringValues["L5"] = evGPS_L5;
|
||||
d_mapStringValues["1B"] = evGAL_1B;
|
||||
d_mapStringValues["5X"] = evGAL_5X;
|
||||
d_mapStringValues["E6"] = evGAL_E6;
|
||||
d_mapStringValues["7X"] = evGAL_7X;
|
||||
d_mapStringValues["1G"] = evGLO_1G;
|
||||
d_mapStringValues["2G"] = evGLO_2G;
|
||||
d_mapStringValues["B1"] = evBDS_B1;
|
||||
d_mapStringValues["B2"] = evBDS_B2;
|
||||
d_mapStringValues["B3"] = evBDS_B3;
|
||||
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
if (d_dump)
|
||||
{
|
||||
@@ -117,31 +146,6 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) : gr::block(
|
||||
d_dump = false;
|
||||
}
|
||||
}
|
||||
d_T_rx_TOW_ms = 0U;
|
||||
d_T_rx_step_ms = conf_.observable_interval_ms;
|
||||
d_T_rx_step_s = static_cast<double>(d_T_rx_step_ms) / 1000.0;
|
||||
d_T_rx_TOW_set = false;
|
||||
d_T_status_report_timer_ms = 0;
|
||||
d_Rx_clock_buffer.set_capacity(std::min(std::max(200U / d_T_rx_step_ms, 3U), 10U));
|
||||
d_Rx_clock_buffer.clear();
|
||||
|
||||
d_channel_last_pll_lock = std::vector<bool>(d_nchannels_out, false);
|
||||
d_channel_last_pseudorange_smooth = std::vector<double>(d_nchannels_out, 0.0);
|
||||
d_channel_last_carrier_phase_rads = std::vector<double>(d_nchannels_out, 0.0);
|
||||
|
||||
d_smooth_filter_M = static_cast<double>(conf_.smoothing_factor);
|
||||
d_mapStringValues["1C"] = evGPS_1C;
|
||||
d_mapStringValues["2S"] = evGPS_2S;
|
||||
d_mapStringValues["L5"] = evGPS_L5;
|
||||
d_mapStringValues["1B"] = evGAL_1B;
|
||||
d_mapStringValues["5X"] = evGAL_5X;
|
||||
d_mapStringValues["E6"] = evGAL_E6;
|
||||
d_mapStringValues["7X"] = evGAL_7X;
|
||||
d_mapStringValues["1G"] = evGLO_1G;
|
||||
d_mapStringValues["2G"] = evGLO_2G;
|
||||
d_mapStringValues["B1"] = evBDS_B1;
|
||||
d_mapStringValues["B2"] = evBDS_B2;
|
||||
d_mapStringValues["B3"] = evBDS_B3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
#include "obs_conf.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
|
||||
Obs_Conf::Obs_Conf()
|
||||
Obs_Conf::Obs_Conf() : dump_filename("obs_dump.dat"),
|
||||
smoothing_factor(FLAGS_carrier_smoothing_factor),
|
||||
nchannels_in(0U),
|
||||
nchannels_out(0U),
|
||||
observable_interval_ms(20U),
|
||||
enable_carrier_smoothing(false),
|
||||
dump(false),
|
||||
dump_mat(false)
|
||||
{
|
||||
dump_filename = std::string("obs_dump.dat");
|
||||
smoothing_factor = FLAGS_carrier_smoothing_factor;
|
||||
nchannels_in = 0U;
|
||||
nchannels_out = 0U;
|
||||
observable_interval_ms = 20U;
|
||||
enable_carrier_smoothing = false;
|
||||
dump = false;
|
||||
dump_mat = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user