1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-19 05:33:02 +00:00

Prefer initialization to assignment in constructors

This commit is contained in:
Carles Fernandez 2021-12-14 17:03:29 +01:00
parent 47024cc283
commit 2c7bead089
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
7 changed files with 37 additions and 33 deletions

View File

@ -42,13 +42,13 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels,
int decimation_factor, int decimation_factor,
int udp_port, int udp_port,
const std::vector<std::string>& udp_addresses, const std::vector<std::string>& udp_addresses,
bool enable_protobuf) : gr::block("gnss_synchro_monitor", bool enable_protobuf)
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), : gr::block("gnss_synchro_monitor",
gr::io_signature::make(0, 0, 0)) gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0)),
d_nchannels(n_channels),
d_decimation_factor(decimation_factor)
{ {
d_decimation_factor = decimation_factor;
d_nchannels = n_channels;
udp_sink_ptr = std::make_unique<Gnss_Synchro_Udp_Sink>(udp_addresses, udp_port, enable_protobuf); udp_sink_ptr = std::make_unique<Gnss_Synchro_Udp_Sink>(udp_addresses, udp_port, enable_protobuf);
} }

View File

@ -21,9 +21,12 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf) : socket{io_context} Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses,
const uint16_t& port,
bool enable_protobuf)
: socket{io_context},
use_protobuf(enable_protobuf)
{ {
use_protobuf = enable_protobuf;
if (enable_protobuf) if (enable_protobuf)
{ {
serdes = Serdes_Gnss_Synchro(); serdes = Serdes_Gnss_Synchro();

View File

@ -129,15 +129,15 @@ ControlThread::ControlThread()
ControlThread::ControlThread(std::shared_ptr<ConfigurationInterface> configuration) ControlThread::ControlThread(std::shared_ptr<ConfigurationInterface> configuration)
: configuration_(std::move(configuration)),
well_formatted_configuration_(true),
conf_file_has_section_(true),
conf_file_has_mandatory_globals_(true),
conf_has_signal_sources_(true),
conf_has_observables_(true),
conf_has_pvt_(true),
restart_(false)
{ {
configuration_ = std::move(configuration);
conf_file_has_section_ = true;
conf_file_has_mandatory_globals_ = true;
conf_has_signal_sources_ = true;
conf_has_observables_ = true;
conf_has_pvt_ = true;
well_formatted_configuration_ = true;
restart_ = false;
init(); init();
} }

View File

@ -27,15 +27,15 @@
FileConfiguration::FileConfiguration(std::string filename) FileConfiguration::FileConfiguration(std::string filename)
: filename_(std::move(filename))
{ {
filename_ = std::move(filename);
init(); init();
} }
FileConfiguration::FileConfiguration() FileConfiguration::FileConfiguration()
: filename_("./default_config_file.txt")
{ {
filename_ = "./default_config_file.txt";
init(); init();
} }

View File

@ -69,14 +69,15 @@
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8 #define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) // NOLINT(performance-unnecessary-value-param) GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) // NOLINT(performance-unnecessary-value-param)
: configuration_(std::move(configuration)),
queue_(std::move(queue)),
connected_(false),
running_(false),
multiband_(GNSSFlowgraph::is_multiband()),
enable_e6_has_rx_(false)
{ {
connected_ = false;
running_ = false;
enable_e6_has_rx_ = false;
configuration_ = std::move(configuration);
queue_ = std::move(queue);
multiband_ = GNSSFlowgraph::is_multiband();
enable_fpga_offloading_ = configuration_->property("GNSS-SDR.enable_FPGA", false); enable_fpga_offloading_ = configuration_->property("GNSS-SDR.enable_FPGA", false);
init(); init();
} }

View File

@ -32,14 +32,14 @@ using b_io_context = boost::asio::io_service;
#endif #endif
TcpCmdInterface::TcpCmdInterface() TcpCmdInterface::TcpCmdInterface()
: rx_latitude_(0.0),
rx_longitude_(0.0),
rx_altitude_(0.0),
receiver_utc_time_(0),
keep_running_(true)
{ {
register_functions(); register_functions();
keep_running_ = true;
control_queue_ = nullptr; control_queue_ = nullptr;
rx_latitude_ = 0.0;
rx_longitude_ = 0.0;
rx_altitude_ = 0.0;
receiver_utc_time_ = 0;
} }

View File

@ -19,15 +19,15 @@
Gnss_Signal::Gnss_Signal(const std::string& signal_) Gnss_Signal::Gnss_Signal(const std::string& signal_)
: signal(signal_)
{ {
this->signal = signal_;
} }
Gnss_Signal::Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& signal_) Gnss_Signal::Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& signal_)
: satellite(satellite_),
signal(signal_)
{ {
this->satellite = satellite_;
this->signal = signal_;
} }