1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Prefer initialization to assignment in constructors

This commit is contained in:
Carles Fernandez 2021-12-14 15:27:57 +01:00
parent 8d9875e881
commit 47024cc283
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
7 changed files with 58 additions and 60 deletions

View File

@ -33,8 +33,8 @@
INIReader::INIReader(const std::string& filename) INIReader::INIReader(const std::string& filename)
: _error(ini_parse(filename.c_str(), ValueHandler, this))
{ {
_error = ini_parse(filename.c_str(), ValueHandler, this);
} }

View File

@ -22,7 +22,7 @@ channel_event_sptr channel_event_make(int channel_id, int event_type)
} }
Channel_Event::Channel_Event(int channel_id_, int event_type_) Channel_Event::Channel_Event(int channel_id_, int event_type_)
: channel_id(channel_id_),
event_type(event_type_)
{ {
channel_id = channel_id_;
event_type = event_type_;
} }

View File

@ -22,7 +22,7 @@ command_event_sptr command_event_make(int command_id, int event_type)
} }
Command_Event::Command_Event(int command_id_, int event_type_) Command_Event::Command_Event(int command_id_, int event_type_)
: command_id(command_id_),
event_type(event_type_)
{ {
command_id = command_id_;
event_type = event_type_;
} }

View File

@ -46,30 +46,31 @@
gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter( gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(
double _fs, double _fs,
int32_t _interval_ms) : gr::block("fpga_fpga_sample_counter", int32_t _interval_ms)
gr::io_signature::make(0, 0, 0), : gr::block("fpga_fpga_sample_counter",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
fs(_fs),
sample_counter(0ULL),
last_sample_counter(0ULL),
current_T_rx_ms(0),
interval_ms(_interval_ms),
current_s(0),
current_m(0),
current_h(0),
current_days(0),
report_interval_ms(1000), // default reporting 1 second
flag_enable_send_msg(false), // enable it for reporting time with asynchronous message
flag_m(false),
flag_h(false),
flag_days(false),
is_open(true)
{ {
message_port_register_out(pmt::mp("fpga_sample_counter")); message_port_register_out(pmt::mp("fpga_sample_counter"));
set_max_noutput_items(1); set_max_noutput_items(1);
interval_ms = _interval_ms;
fs = _fs;
samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3); samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3);
open_device();
is_open = true;
sample_counter = 0ULL;
last_sample_counter = 0ULL;
current_T_rx_ms = 0;
current_s = 0;
current_m = 0;
current_h = 0;
current_days = 0;
report_interval_ms = 1000; // default reporting 1 second
samples_per_report = std::round(fs * static_cast<double>(report_interval_ms) / 1e3); samples_per_report = std::round(fs * static_cast<double>(report_interval_ms) / 1e3);
flag_enable_send_msg = false; // enable it for reporting time with asynchronous message open_device();
flag_m = false;
flag_h = false;
flag_days = false;
} }

View File

@ -31,27 +31,28 @@
gnss_sdr_sample_counter::gnss_sdr_sample_counter( gnss_sdr_sample_counter::gnss_sdr_sample_counter(
double _fs, double _fs,
int32_t _interval_ms, int32_t _interval_ms,
size_t _size) : gr::sync_decimator("sample_counter", size_t _size)
gr::io_signature::make(1, 1, _size), : gr::sync_decimator("sample_counter",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, _size),
static_cast<uint32_t>(std::round(_fs * static_cast<double>(_interval_ms) / 1e3))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
static_cast<uint32_t>(std::round(_fs * static_cast<double>(_interval_ms) / 1e3))),
fs(_fs),
current_T_rx_ms(0),
sample_counter(0),
interval_ms(_interval_ms),
report_interval_ms(1000), // default reporting 1 second
samples_per_output(std::round(fs * static_cast<double>(interval_ms) / 1e3)),
current_s(0),
current_m(0),
current_h(0),
current_days(0),
flag_m(false),
flag_h(false),
flag_days(false),
flag_enable_send_msg(false) // enable it for reporting time with asynchronous message
{ {
message_port_register_out(pmt::mp("sample_counter")); message_port_register_out(pmt::mp("sample_counter"));
set_max_noutput_items(1); set_max_noutput_items(1);
interval_ms = _interval_ms;
fs = _fs;
samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3);
sample_counter = 0;
current_T_rx_ms = 0;
current_s = 0;
current_m = 0;
current_h = 0;
current_days = 0;
report_interval_ms = 1000; // default reporting 1 second
flag_enable_send_msg = false; // enable it for reporting time with asynchronous message
flag_m = false;
flag_h = false;
flag_days = false;
set_tag_propagation_policy(TPP_DONT); // no tag propagation, the time tag will be adjusted and regenerated in work() set_tag_propagation_policy(TPP_DONT); // no tag propagation, the time tag will be adjusted and regenerated in work()
} }

View File

@ -31,15 +31,10 @@
#include <vector> #include <vector>
Gnss_Sdr_Supl_Client::Gnss_Sdr_Supl_Client() Gnss_Sdr_Supl_Client::Gnss_Sdr_Supl_Client()
: server_port(0), request(0), mcc(0), mns(0), lac(0), ci(0)
{ {
mcc = 0;
mns = 0;
lac = 0;
ci = 0;
supl_ctx_new(&ctx); supl_ctx_new(&ctx);
assist = supl_assist_t(); assist = supl_assist_t();
server_port = 0;
request = 0;
} }

View File

@ -21,20 +21,21 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
gnss_sdr_time_counter::gnss_sdr_time_counter() : gr::block("time_counter", gnss_sdr_time_counter::gnss_sdr_time_counter()
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), : gr::block("time_counter",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
current_T_rx_ms(0),
report_interval_ms(1000), // default reporting 1 second
current_s(0),
current_m(0),
current_h(0),
current_days(0),
flag_m(false),
flag_h(false),
flag_days(false)
{ {
set_max_noutput_items(1); set_max_noutput_items(1);
current_T_rx_ms = 0;
current_s = 0;
current_m = 0;
current_h = 0;
current_days = 0;
report_interval_ms = 1000; // default reporting 1 second
flag_m = false;
flag_h = false;
flag_days = false;
} }