1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +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
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
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();

View File

@ -39,30 +39,35 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
const unsigned int _code_length = 10230;
bool G1[_code_length];
bool G2[_code_length];
std::array<bool, 13> G1_register = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
std::array<bool, 13> G2_register = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
std::array<bool, 13> G1_register_reset = {{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
std::array<bool, 13> G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
std::array<bool, 13> G2_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
std::array<bool, 13> G1_register_reset = {{false, false, true, true, true, true, true, true, true, true, true, true, true}};
bool feedback1, feedback2, aux;
uint32_t lcv, lcv2, delay;
int32_t prn_idx = _prn - 1;
// clang-format off
std::array<std::array<bool, 13>, 63> G2_register_shifted = {{
{{1,0,1,0,1,1,1,1,1,1,1,1,1,}}, {{1,1,1,1,0,0,0,1,0,1,0,1,1,}}, {{1,0,1,1,1,1,0,0,0,1,0,1,0,}}, {{1,1,1,1,1,1,1,1,1,1,0,1,1,}},
{{1,1,0,0,1,0,0,0,1,1,1,1,1,}}, {{1,0,0,1,0,0,1,1,0,0,1,0,0,}}, {{1,1,1,1,1,1,1,0,1,0,0,1,0,}}, {{1,1,1,0,1,1,1,1,1,1,1,0,1,}},
{{1,0,1,0,0,0,0,0,0,0,0,1,0,}}, {{0,0,1,0,0,0,0,0,1,1,0,1,1,}}, {{1,1,1,0,1,0,1,1,1,0,0,0,0,}}, {{0,0,1,0,1,1,0,0,1,1,1,1,0,}},
{{0,1,1,0,0,1,0,0,1,0,1,0,1,}}, {{0,1,1,1,0,0,0,1,0,0,1,1,0,}},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{1,1,1,1,1,0,1,0,0,1,0,0,0,}},
{{0,0,0,0,1,0,1,0,0,1,0,0,1,}}, {{1,0,0,0,0,1,0,1,0,1,1,0,0,}}, {{1,1,1,1,0,0,1,0,0,1,1,0,0,}}, {{0,1,0,0,1,1,0,0,0,1,1,1,1,}},
{{0,0,0,0,0,0,0,0,1,1,0,0,0,}}, {{1,0,0,0,0,0,0,0,0,0,1,0,0,}}, {{0,0,1,1,0,1,0,1,0,0,1,1,0,}}, {{1,0,1,1,0,0,1,0,0,0,1,1,0,}},
{{0,1,1,1,0,0,1,1,1,1,0,0,0,}}, {{0,0,1,0,1,1,1,0,0,1,0,1,0,}}, {{1,1,0,0,1,1,1,1,1,0,1,1,0,}}, {{1,0,0,1,0,0,1,0,0,0,1,0,1,}},
{{0,1,1,1,0,0,0,1,0,0,0,0,0,}}, {{0,0,1,1,0,0,1,0,0,0,0,1,0,}}, {{0,0,1,0,0,0,1,0,0,1,1,1,0,}}}};
{{true,false,true,false,true,true,true,true,true,true,true,true,true,}},
{{true,true,true,true,false,false,false,true,false,true,false,true,true,}},
{{true,false,true,true,true,true,false,false,false,true,false,true,false,}},
{{true,true,true,true,true,true,true,true,true,true,false,true,true,}},
{{true,true,false,false,true,false,false,false,true,true,true,true,true,}},
{{true,false,false,true,false,false,true,true,false,false,true,false,false,}},
{{true,true,true,true,true,true,true,false,true,false,false,true,false,}}, {{true,true,true,false,true,true,true,true,true,true,true,false,true,}},
{{true,false,true,false,false,false,false,false,false,false,false,true,false,}}, {{false,false,true,false,false,false,false,false,true,true,false,true,true,}}, {{true,true,true,false,true,false,true,true,true,false,false,false,false,}}, {{false,false,true,false,true,true,false,false,true,true,true,true,false,}},
{{false,true,true,false,false,true,false,false,true,false,true,false,true,}}, {{false,true,true,true,false,false,false,true,false,false,true,true,false,}}, {{true,false,false,false,true,true,false,false,false,true,false,false,true,}}, {{true,true,true,false,false,false,true,true,true,true,true,false,false,}},
{{false,false,true,false,false,true,true,false,false,false,true,false,true,}}, {{false,false,false,false,false,true,true,true,false,true,true,false,false,}}, {{true,false,false,false,true,false,true,false,true,false,true,true,true,}}, {{false,false,false,true,false,true,true,false,true,true,true,true,false,}},
{{false,false,true,false,false,false,false,true,false,true,true,false,true,}}, {{false,false,true,false,true,true,false,false,false,true,false,true,false,}}, {{false,false,false,true,false,true,true,false,false,true,true,true,true,}}, {{false,false,true,true,false,false,true,true,false,false,false,true,false,}},
{{false,false,true,true,true,false,true,false,false,true,false,false,false,}}, {{false,true,false,false,true,false,false,true,false,true,false,false,true,}}, {{true,false,true,true,false,true,true,false,true,false,false,true,true,}}, {{true,false,true,false,true,true,true,true,false,false,false,true,false,}},
{{false,false,false,true,false,true,true,true,true,false,true,false,true,}}, {{false,true,true,true,true,true,true,true,true,true,true,true,true,}}, {{false,true,true,false,true,true,false,false,false,true,true,true,true,}}, {{true,false,true,false,true,true,false,false,false,true,false,false,true,}},
{{true,false,false,true,false,true,false,true,false,true,false,true,true,}}, {{true,true,false,false,true,true,false,true,false,false,true,false,true,}}, {{true,true,false,true,false,false,true,false,true,true,true,false,true,}}, {{true,true,true,true,true,false,true,true,true,false,true,false,false,}},
{{false,false,true,false,true,false,true,true,false,false,true,true,true,}}, {{true,true,true,false,true,false,false,false,true,false,false,false,false,}}, {{true,true,false,true,true,true,false,false,true,false,false,false,false,}}, {{true,true,false,true,false,true,true,false,false,true,true,true,false,}},
{{true,false,false,false,false,false,false,true,true,false,true,false,false,}}, {{false,true,false,true,true,true,true,false,true,true,false,false,true,}}, {{false,true,true,false,true,true,false,true,true,true,true,false,false,}}, {{true,true,false,true,false,false,true,true,true,false,false,false,true,}},
{{false,false,true,true,true,false,false,true,false,false,false,true,false,}}, {{false,true,false,true,false,true,true,false,false,false,true,false,true,}}, {{true,false,false,true,true,true,true,true,false,false,true,true,false,}}, {{true,true,true,true,true,false,true,false,false,true,false,false,false,}},
{{false,false,false,false,true,false,true,false,false,true,false,false,true,}}, {{true,false,false,false,false,true,false,true,false,true,true,false,false,}}, {{true,true,true,true,false,false,true,false,false,true,true,false,false,}}, {{false,true,false,false,true,true,false,false,false,true,true,true,true,}},
{{false,false,false,false,false,false,false,false,true,true,false,false,false,}}, {{true,false,false,false,false,false,false,false,false,false,true,false,false,}}, {{false,false,true,true,false,true,false,true,false,false,true,true,false,}}, {{true,false,true,true,false,false,true,false,false,false,true,true,false,}},
{{false,true,true,true,false,false,true,true,true,true,false,false,false,}}, {{false,false,true,false,true,true,true,false,false,true,false,true,false,}}, {{true,true,false,false,true,true,true,true,true,false,true,true,false,}}, {{true,false,false,true,false,false,true,false,false,false,true,false,true,}},
{{false,true,true,true,false,false,false,true,false,false,false,false,false,}}, {{false,false,true,true,false,false,true,false,false,false,false,true,false,}}, {{false,false,true,false,false,false,true,false,false,true,true,true,false,}}}};
// clang-format on
// A simple error check
if ((prn_idx < 0) || (prn_idx > 63))
@ -96,7 +101,7 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
// Reset G1 register if sequence found
if (G1_register == G1_register_reset)
{
G1_register = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
}
}

View File

@ -34,7 +34,7 @@
#include <glog/logging.h>
BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(
ConfigurationInterface *configuration, std::string role,
ConfigurationInterface *configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams)
: role_(role), in_streams_(in_streams), out_streams_(out_streams)
{

View File

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

View File

@ -45,7 +45,7 @@
using google::LogMessage;
BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
ConfigurationInterface* configuration, std::string role,
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
@ -118,7 +118,7 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
trk_param.carrier_lock_th = carrier_lock_th;
//################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0)
if (item_type == "gr_complex")
{
item_size_ = sizeof(gr_complex);
tracking_ = dll_pll_veml_make_tracking(trk_param);
@ -142,8 +142,7 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
BeidouB3iDllPllTracking::~BeidouB3iDllPllTracking()
{
}
= default;
void BeidouB3iDllPllTracking::start_tracking()

View File

@ -50,7 +50,7 @@ class BeidouB3iDllPllTracking : public TrackingInterface
{
public:
BeidouB3iDllPllTracking(ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);

View File

@ -36,8 +36,8 @@
#include <utility>
#include <vector>
const double BEIDOU_DNAV_C_m_s = 299792458.0; //!< The speed of light, [m/s]
const double BEIDOU_DNAV_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]
const double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s]
const double BEIDOU_DNAV_C_M_MS = 299792.4580; //!< The speed of light, [m/ms]
const double BEIDOU_DNAV_PI = 3.1415926535898; //!< Pi
const double BEIDOU_DNAV_TWO_PI = 6.283185307179586; //!< 2Pi
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;