1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-30 23:03:05 +00:00

Apply clang-tidy fixes

This commit is contained in:
Carles Fernandez
2019-03-18 09:10:00 +01:00
parent ed9aaf86ce
commit 52c69073ac
8 changed files with 50 additions and 46 deletions

View File

@@ -43,7 +43,7 @@ using google::LogMessage;
BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
@@ -90,7 +90,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@@ -111,7 +111,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@@ -120,7 +120,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@@ -207,7 +207,7 @@ void BeidouB3iPcpsAcquisition::init()
void BeidouB3iPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@@ -251,9 +251,9 @@ float BeidouB3iPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@@ -261,15 +261,15 @@ float BeidouB3iPcpsAcquisition::calculate_threshold(float pfa)
void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@@ -284,15 +284,15 @@ void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@@ -309,15 +309,15 @@ void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr BeidouB3iPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}

View File

@@ -54,7 +54,7 @@ class BeidouB3iPcpsAcquisition : public AcquisitionInterface
{
public:
BeidouB3iPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
virtual ~BeidouB3iPcpsAcquisition();