Replace C-style cast by C++ casts

This commit is contained in:
Carles Fernandez
2017-08-19 02:33:54 +02:00
parent fe17181af3
commit 7ac3f282fa
36 changed files with 465 additions and 465 deletions
@@ -284,8 +284,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
int corr_value = 0;
int preamble_diff = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
@@ -295,9 +295,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
consume_each(1);
d_flag_preamble = false;
unsigned int required_symbols=GALILEO_INAV_PAGE_SYMBOLS+d_symbols_per_preamble;
unsigned int required_symbols = GALILEO_INAV_PAGE_SYMBOLS + d_symbols_per_preamble;
if (d_symbol_history.size()>required_symbols)
if (d_symbol_history.size() > required_symbols)
{
// TODO Optimize me!
//******* preamble correlation ********
@@ -432,7 +432,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64)));
}
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
if(d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
{
current_symbol.Flag_valid_word = true;
}
@@ -442,7 +442,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
}
current_symbol.TOW_at_current_symbol_s = floor(d_TOW_at_current_symbol*1000.0)/1000.0;
current_symbol.TOW_at_current_symbol_s -=delta_t; //Galileo to GPS TOW
current_symbol.TOW_at_current_symbol_s -= delta_t; //Galileo to GPS TOW
if(d_dump == true)
{
@@ -466,9 +466,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
// remove used symbols from history
if (d_symbol_history.size()>required_symbols)
{
d_symbol_history.pop_front();
}
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
//std::cout<<"GPS L1 TLM output on CH="<<this->d_channel << " SAMPLE STAMP="<<d_sample_counter/d_decimation_output_factor<<std::endl;
@@ -175,7 +175,6 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram
std::cout << "New Galileo E5a F/NAV message received: UTC model parameters from satellite " << d_satellite << std::endl;
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
}
@@ -246,8 +245,9 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()
int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
/* Terminology: Prompt: output from tracking Prompt correlator (Prompt samples)
* Symbol: encoded navigation bits. 1 symbol = 20 samples in E5a
* Bit: decoded navigation bits forming words as described in Galileo ICD
@@ -48,6 +48,7 @@ gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, dump));
}
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
Gnss_Satellite satellite,
bool dump) :
@@ -68,7 +69,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
//memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GPS_CA_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
// preamble bits to sampled symbols
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
d_preambles_symbols = static_cast<signed int*>(malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS));
int n = 0;
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
@@ -150,14 +151,11 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
int corr_value = 0;
int preamble_diff_ms = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
// ########### Output the tracking data to navigation and PVT ##########
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
@@ -165,7 +163,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue
consume_each(1);
unsigned int required_symbols=GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
unsigned int required_symbols = GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
d_flag_preamble = false;
if (d_symbol_history.size()>required_symbols)
@@ -186,8 +184,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
}
if (corr_value >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
}
}
//******* frame sync ******************
if (abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
{
@@ -365,11 +363,10 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol;
current_symbol.Flag_valid_word = flag_TOW_set;
if (flag_PLL_180_deg_phase_locked == true)
{
//correct the accumulated phase for the Costas loop phase shift, if required
current_symbol.Carrier_phase_rads += GPS_PI;
current_symbol.Carrier_phase_rads += GPS_PI;
}
if(d_dump == true)
@@ -394,15 +391,16 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
// remove used symbols from history
if (d_symbol_history.size()>required_symbols)
{
d_symbol_history.pop_front();
}
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
}
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
@@ -93,8 +93,8 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
bool flag_new_cnav_frame = false;
cnav_msg_t msg;
@@ -98,8 +98,8 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
{
VLOG(FLOW) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output