Prefer initialization to assignment in constructors

This commit is contained in:
Carles Fernandez 2021-12-17 17:40:17 +01:00
parent 7478069da9
commit 12ed230cd7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
15 changed files with 88 additions and 91 deletions

View File

@ -22,46 +22,46 @@
Spirent_Motion_Csv_Dump_Reader::Spirent_Motion_Csv_Dump_Reader()
: header_lines(2),
TOW_ms(0.0),
Pos_X(0.0),
Pos_Y(0.0),
Pos_Z(0.0),
Vel_X(0.0),
Vel_Y(0.0),
Vel_Z(0.0),
Acc_X(0.0),
Acc_Y(0.0),
Acc_Z(0.0),
Jerk_X(0.0),
Jerk_Y(0.0),
Jerk_Z(0.0),
Lat(0.0),
Long(0.0),
Height(0.0),
Heading(0.0),
Elevation(0.0),
Bank(0.0),
Ang_vel_X(0.0),
Ang_vel_Y(0.0),
Ang_vel_Z(0.0),
Ang_acc_X(0.0),
Ang_acc_Y(0.0),
Ang_acc_Z(0.0),
Ant1_Pos_X(0.0),
Ant1_Pos_Y(0.0),
Ant1_Pos_Z(0.0),
Ant1_Vel_X(0.0),
Ant1_Vel_Y(0.0),
Ant1_Vel_Z(0.0),
Ant1_Acc_X(0.0),
Ant1_Acc_Y(0.0),
Ant1_Acc_Z(0.0),
Ant1_Lat(0.0),
Ant1_Long(0.0),
Ant1_Height(0.0),
Ant1_DOP(0.0)
{
header_lines = 2;
TOW_ms = 0.0;
Pos_X = 0.0;
Pos_Y = 0.0;
Pos_Z = 0.0;
Vel_X = 0.0;
Vel_Y = 0.0;
Vel_Z = 0.0;
Acc_X = 0.0;
Acc_Y = 0.0;
Acc_Z = 0.0;
Jerk_X = 0.0;
Jerk_Y = 0.0;
Jerk_Z = 0.0;
Lat = 0.0;
Long = 0.0;
Height = 0.0;
Heading = 0.0;
Elevation = 0.0;
Bank = 0.0;
Ang_vel_X = 0.0;
Ang_vel_Y = 0.0;
Ang_vel_Z = 0.0;
Ang_acc_X = 0.0;
Ang_acc_Y = 0.0;
Ang_acc_Z = 0.0;
Ant1_Pos_X = 0.0;
Ant1_Pos_Y = 0.0;
Ant1_Pos_Z = 0.0;
Ant1_Vel_X = 0.0;
Ant1_Vel_Y = 0.0;
Ant1_Vel_Z = 0.0;
Ant1_Acc_X = 0.0;
Ant1_Acc_Y = 0.0;
Ant1_Acc_Z = 0.0;
Ant1_Lat = 0.0;
Ant1_Long = 0.0;
Ant1_Height = 0.0;
Ant1_DOP = 0.0;
}

View File

@ -97,7 +97,9 @@ void GpsL1CaPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::pm
}
GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx() : gr::block("GpsL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx()
: gr::block("GpsL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)),
rx_message(0)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"),
@ -110,7 +112,6 @@ GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx() : gr::blo
boost::bind(&GpsL1CaPcpsAcquisitionTest_msg_rx::msg_handler_channel_events, this, _1));
#endif
#endif
rx_message = 0;
}
@ -123,12 +124,12 @@ class GpsL1CaPcpsAcquisitionTest : public ::testing::Test
{
protected:
GpsL1CaPcpsAcquisitionTest()
: item_size(sizeof(gr_complex)),
doppler_max(5000),
doppler_step(100)
{
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
gnss_synchro = Gnss_Synchro();
doppler_max = 5000;
doppler_step = 100;
}
~GpsL1CaPcpsAcquisitionTest() override = default;

View File

@ -53,9 +53,9 @@ public:
DataTypeAdapter::DataTypeAdapter()
: file_name_input("adapter_test_input.dat"),
file_name_output("adapter_test_output.dat")
{
file_name_input = "adapter_test_input.dat";
file_name_output = "adapter_test_output.dat";
std::array<int8_t, 6> input_bytes{2, 23, -1, 127, -127, 0};
std::array<int16_t, 8> input_shorts{2, 23, -1, 127, -127, 0, 255, 255};

View File

@ -44,10 +44,9 @@ DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the
class FirFilterTest : public ::testing::Test
{
protected:
FirFilterTest()
FirFilterTest() : item_size(sizeof(gr_complex))
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
item_size = sizeof(gr_complex);
config = std::make_shared<InMemoryConfiguration>();
}
~FirFilterTest() override = default;

View File

@ -43,12 +43,10 @@ DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to fil
class NotchFilterLiteTest : public ::testing::Test
{
protected:
NotchFilterLiteTest()
NotchFilterLiteTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_lite_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
item_size = sizeof(gr_complex);
config = std::make_shared<InMemoryConfiguration>();
nsamples = FLAGS_notch_filter_lite_test_nsamples;
}
~NotchFilterLiteTest() override = default;

View File

@ -43,12 +43,10 @@ DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter i
class NotchFilterTest : public ::testing::Test
{
protected:
NotchFilterTest()
NotchFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
item_size = sizeof(gr_complex);
config = std::make_shared<InMemoryConfiguration>();
nsamples = FLAGS_notch_filter_test_nsamples;
}
~NotchFilterTest() override = default;

View File

@ -43,12 +43,10 @@ DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in t
class PulseBlankingFilterTest : public ::testing::Test
{
protected:
PulseBlankingFilterTest()
PulseBlankingFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_pb_filter_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
item_size = sizeof(gr_complex);
config = std::make_shared<InMemoryConfiguration>();
nsamples = FLAGS_pb_filter_test_nsamples;
}
~PulseBlankingFilterTest() override = default;
bool stop = false;

View File

@ -196,21 +196,21 @@ Acquisition_Dump_Reader::Acquisition_Dump_Reader(const std::string& basename,
unsigned int samples_per_code,
int channel,
int execution)
: acq_doppler_hz(0.0),
acq_delay_samples(0.0),
test_statistic(0.0),
input_power(0.0),
threshold(0.0),
positive_acq(0),
PRN(0),
num_dwells(0),
sample_counter(0),
d_basename(basename),
d_sat(sat),
d_doppler_max(doppler_max),
d_doppler_step(doppler_step),
d_samples_per_code(samples_per_code)
{
d_basename = basename;
d_sat = sat;
d_doppler_max = doppler_max;
d_doppler_step = doppler_step;
d_samples_per_code = samples_per_code;
acq_doppler_hz = 0.0;
acq_delay_samples = 0.0;
test_statistic = 0.0;
input_power = 0.0;
threshold = 0.0;
positive_acq = 0;
sample_counter = 0;
num_dwells = 0;
PRN = 0;
if (d_doppler_step == 0)
{
d_doppler_step = 1;

View File

@ -56,7 +56,9 @@ void Acquisition_msg_rx::msg_handler_channel_events(const pmt::pmt_t& msg)
}
Acquisition_msg_rx::Acquisition_msg_rx() : gr::block("Acquisition_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
Acquisition_msg_rx::Acquisition_msg_rx()
: gr::block("Acquisition_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)),
rx_message(0)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"),
@ -69,7 +71,6 @@ Acquisition_msg_rx::Acquisition_msg_rx() : gr::block("Acquisition_msg_rx", gr::i
boost::bind(&Acquisition_msg_rx::msg_handler_channel_events, this, _1));
#endif
#endif
rx_message = 0;
}

View File

@ -104,8 +104,8 @@ void Observables_Dump_Reader::close_obs_file()
Observables_Dump_Reader::Observables_Dump_Reader(int n_channels_)
: n_channels(n_channels_)
{
n_channels = n_channels_;
RX_time = std::vector<double>(n_channels);
TOW_at_current_symbol_s = std::vector<double>(n_channels);
Carrier_Doppler_hz = std::vector<double>(n_channels);

View File

@ -25,7 +25,7 @@
class TransitionModel : public ModelFunction
{
public:
explicit TransitionModel(const arma::mat& kf_F) { coeff_mat = kf_F; };
explicit TransitionModel(const arma::mat& kf_F) : coeff_mat(kf_F){};
arma::vec operator()(const arma::vec& input) override { return coeff_mat * input; };
private:
@ -35,7 +35,7 @@ private:
class MeasurementModel : public ModelFunction
{
public:
explicit MeasurementModel(const arma::mat& kf_H) { coeff_mat = kf_H; };
explicit MeasurementModel(const arma::mat& kf_H) : coeff_mat(kf_H){};
arma::vec operator()(const arma::vec& input) override { return coeff_mat * input; };
private:

View File

@ -41,12 +41,12 @@ class GalileoE1DllPllVemlTrackingInternalTest : public ::testing::Test
{
protected:
GalileoE1DllPllVemlTrackingInternalTest()
: item_size(sizeof(gr_complex)),
stop(false),
message(0)
{
factory = std::make_shared<GNSSBlockFactory>();
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
stop = false;
message = 0;
gnss_synchro = Gnss_Synchro();
}

View File

@ -102,7 +102,9 @@ void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_channel_events(const pmt::pmt
}
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() : gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx()
: gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)),
rx_message(0)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"),
@ -115,7 +117,6 @@ GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() : gr::block
boost::bind(&GpsL1CADllPllTrackingTest_msg_rx::msg_handler_channel_events, this, _1));
#endif
#endif
rx_message = 0;
}
@ -166,11 +167,10 @@ public:
double& rmse);
bool save_mat_xy(std::vector<double>& x, std::vector<double>& y, std::string filename);
GpsL1CADllPllTrackingTest()
GpsL1CADllPllTrackingTest() : item_size(sizeof(gr_complex))
{
factory = std::make_shared<GNSSBlockFactory>();
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
gnss_synchro = Gnss_Synchro();
}

View File

@ -197,9 +197,11 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_channel_events(const pmt:
}
GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : gr::block("GpsL1CADllPllTrackingTestFpga_msg_rx",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx()
: gr::block("GpsL1CADllPllTrackingTestFpga_msg_rx",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
rx_message(0)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"),
@ -212,7 +214,6 @@ GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : g
boost::bind(&GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_channel_events, this, _1));
#endif
#endif
rx_message = 0;
}
@ -245,10 +246,10 @@ public:
void check_results_codephase(arma::vec &true_time_s, arma::vec &true_value,
arma::vec &meas_time_s, arma::vec &meas_value);
GpsL1CADllPllTrackingTestFpga()
GpsL1CADllPllTrackingTestFpga() : item_size(sizeof(gr_complex))
{
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
gnss_synchro = Gnss_Synchro();
}

View File

@ -143,7 +143,9 @@ void FrontEndCal_msg_rx::msg_handler_channel_events(const pmt::pmt_t& msg)
}
FrontEndCal_msg_rx::FrontEndCal_msg_rx() : gr::block("FrontEndCal_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
FrontEndCal_msg_rx::FrontEndCal_msg_rx()
: gr::block("FrontEndCal_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)),
rx_message(0)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"),
@ -156,7 +158,6 @@ FrontEndCal_msg_rx::FrontEndCal_msg_rx() : gr::block("FrontEndCal_msg_rx", gr::i
boost::bind(&FrontEndCal_msg_rx::msg_handler_channel_events, this, _1));
#endif
#endif
rx_message = 0;
}