mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-09 12:16:46 +00:00
Remove unnecessary temporary objects and destructors
This commit is contained in:
parent
bf3c3918ef
commit
7209dc4e87
@ -30,10 +30,10 @@ Gnss_Satellite::Gnss_Satellite(const std::string& system_, uint32_t PRN_)
|
||||
|
||||
void Gnss_Satellite::reset()
|
||||
{
|
||||
system = std::string("");
|
||||
block = std::string("");
|
||||
PRN = 0;
|
||||
rf_link = 0;
|
||||
this->system.clear();
|
||||
this->block.clear();
|
||||
this->PRN = 0;
|
||||
this->rf_link = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,10 @@ Gnss_Satellite::Gnss_Satellite(Gnss_Satellite&& other) noexcept
|
||||
PRN(other.PRN),
|
||||
rf_link(other.rf_link)
|
||||
{
|
||||
other.reset();
|
||||
other.system.clear();
|
||||
other.block.clear();
|
||||
other.PRN = 0;
|
||||
other.rf_link = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +119,10 @@ Gnss_Satellite& Gnss_Satellite::operator=(Gnss_Satellite&& other) noexcept
|
||||
block = std::move(other.block);
|
||||
PRN = other.PRN;
|
||||
rf_link = other.rf_link;
|
||||
other.reset();
|
||||
other.system.clear();
|
||||
other.block.clear();
|
||||
other.PRN = 0;
|
||||
other.rf_link = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -621,7 +627,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
|
||||
block_ = std::string("FOC-FM19"); // Galileo Full Operational Capability (FOC) satellite FM19 / GSAT0219, launched on Jul. 25, 2018. UNDER COMMISSIONING.
|
||||
break;
|
||||
default:
|
||||
block_ = std::string("Unknown(Simulated)");
|
||||
block_ = std::string("Unknown");
|
||||
}
|
||||
}
|
||||
if (system_ == "Beidou")
|
||||
@ -768,7 +774,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
|
||||
block_ = std::string("BeiDou-3 GEOG3"); // launched 2020/06/2023
|
||||
break;
|
||||
default:
|
||||
block_ = std::string("Unknown(Simulated)");
|
||||
block_ = std::string("Unknown");
|
||||
}
|
||||
}
|
||||
return block_;
|
||||
|
@ -72,7 +72,6 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message{0};
|
||||
~GpsL1CaPcpsAcquisitionTest_msg_rx() override; //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@ -115,9 +114,6 @@ GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx()
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTest_msg_rx::~GpsL1CaPcpsAcquisitionTest_msg_rx() = default;
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsAcquisitionTest : public ::testing::Test
|
||||
@ -131,8 +127,6 @@ protected:
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
~GpsL1CaPcpsAcquisitionTest() override = default;
|
||||
|
||||
void init();
|
||||
void plot_grid() const;
|
||||
|
||||
|
@ -38,7 +38,6 @@ class DataTypeAdapter : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
DataTypeAdapter();
|
||||
~DataTypeAdapter() override;
|
||||
int run_byte_to_short_block() const;
|
||||
int run_ibyte_to_cbyte_block() const;
|
||||
int run_ibyte_to_complex_block() const;
|
||||
@ -67,9 +66,6 @@ DataTypeAdapter::DataTypeAdapter()
|
||||
}
|
||||
|
||||
|
||||
DataTypeAdapter::~DataTypeAdapter() = default;
|
||||
|
||||
|
||||
int DataTypeAdapter::run_ishort_to_cshort_block() const
|
||||
{
|
||||
std::shared_ptr<ConfigurationInterface> config = std::make_shared<InMemoryConfiguration>();
|
||||
|
@ -44,23 +44,24 @@ DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the
|
||||
class FirFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
FirFilterTest() : item_size(sizeof(gr_complex))
|
||||
FirFilterTest() : item_size(sizeof(gr_complex)),
|
||||
nsamples(FLAGS_filter_test_nsamples)
|
||||
{
|
||||
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
}
|
||||
~FirFilterTest() override = default;
|
||||
|
||||
void init();
|
||||
void configure_cbyte_cbyte();
|
||||
void configure_cbyte_gr_complex();
|
||||
void configure_gr_complex_gr_complex();
|
||||
void configure_cshort_cshort();
|
||||
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
size_t item_size;
|
||||
int nsamples = FLAGS_filter_test_nsamples;
|
||||
int nsamples;
|
||||
};
|
||||
|
||||
|
||||
|
@ -43,28 +43,28 @@ DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to fil
|
||||
class NotchFilterLiteTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
NotchFilterLiteTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_lite_test_nsamples)
|
||||
NotchFilterLiteTest() : item_size(sizeof(gr_complex)),
|
||||
nsamples(FLAGS_notch_filter_lite_test_nsamples)
|
||||
{
|
||||
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
}
|
||||
~NotchFilterLiteTest() override = default;
|
||||
|
||||
bool stop = false;
|
||||
std::thread ch_thread;
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void process_message();
|
||||
void stop_queue();
|
||||
pmt::pmt_t message;
|
||||
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
pmt::pmt_t message;
|
||||
std::thread ch_thread;
|
||||
size_t item_size;
|
||||
int nsamples;
|
||||
bool stop{false};
|
||||
};
|
||||
|
||||
|
||||
|
@ -43,28 +43,28 @@ DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter i
|
||||
class NotchFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
NotchFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_test_nsamples)
|
||||
NotchFilterTest() : item_size(sizeof(gr_complex)),
|
||||
nsamples(FLAGS_notch_filter_test_nsamples)
|
||||
{
|
||||
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
}
|
||||
~NotchFilterTest() override = default;
|
||||
|
||||
bool stop = false;
|
||||
std::thread ch_thread;
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void process_message();
|
||||
void stop_queue();
|
||||
pmt::pmt_t message;
|
||||
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::thread ch_thread;
|
||||
pmt::pmt_t message;
|
||||
size_t item_size;
|
||||
int nsamples;
|
||||
bool stop{false};
|
||||
};
|
||||
|
||||
|
||||
|
@ -43,26 +43,28 @@ DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in t
|
||||
class PulseBlankingFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
PulseBlankingFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_pb_filter_test_nsamples)
|
||||
PulseBlankingFilterTest() : item_size(sizeof(gr_complex)),
|
||||
nsamples(FLAGS_pb_filter_test_nsamples)
|
||||
{
|
||||
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
}
|
||||
~PulseBlankingFilterTest() override = default;
|
||||
bool stop = false;
|
||||
std::thread ch_thread;
|
||||
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void process_message();
|
||||
void stop_queue();
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
|
||||
std::thread ch_thread;
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
gr::top_block_sptr top_block;
|
||||
pmt::pmt_t message;
|
||||
size_t item_size;
|
||||
int nsamples;
|
||||
pmt::pmt_t message;
|
||||
bool stop{false};
|
||||
};
|
||||
|
||||
|
||||
|
@ -126,14 +126,14 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.emplace_back(std::thread(run_correlator_cpu_real_codes,
|
||||
thread_pool.emplace_back(run_correlator_cpu_real_codes,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_code_phase_rate_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
correlation_sizes[correlation_sizes_idx]);
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
@ -224,14 +224,14 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc)
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.emplace_back(std::thread(run_correlator_cpu_real_codes,
|
||||
thread_pool.emplace_back(run_correlator_cpu_real_codes,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_code_phase_rate_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
correlation_sizes[correlation_sizes_idx]);
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
|
@ -122,13 +122,13 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu,
|
||||
thread_pool.emplace_back(run_correlator_cpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
correlation_sizes[correlation_sizes_idx]);
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
@ -220,13 +220,13 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc)
|
||||
// create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu,
|
||||
thread_pool.emplace_back(run_correlator_cpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
correlation_sizes[correlation_sizes_idx]);
|
||||
}
|
||||
// wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
|
@ -45,11 +45,8 @@ protected:
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
~GalileoE1DllPllVemlTrackingInternalTest() override = default;
|
||||
|
||||
void init();
|
||||
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
@ -58,8 +55,8 @@ protected:
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro{};
|
||||
size_t item_size;
|
||||
bool stop{false};
|
||||
int message{0};
|
||||
bool stop{false};
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user