From 81af1a531b551f060ffa6762f533b209ff86c6c9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Jun 2020 11:49:28 +0200 Subject: [PATCH] Redesign of pointer management Avoid indirection caused by passing shared_ptr by reference The block factory does not have responsability on the lifetime of their inputs Define std::make_unique when using C++11 and make use of it Printers are turned into unique_ptr to express ownership Printers do not participate on the lifelime of the data, so they take const raw pointers Modernize tests code --- docs/changelog.md | 3 + .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 25 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 12 +- src/algorithms/PVT/libs/geojson_printer.cc | 16 +- src/algorithms/PVT/libs/geojson_printer.h | 2 +- src/algorithms/PVT/libs/gpx_printer.cc | 29 +- src/algorithms/PVT/libs/gpx_printer.h | 4 +- src/algorithms/PVT/libs/kml_printer.cc | 30 +- src/algorithms/PVT/libs/kml_printer.h | 4 +- .../PVT/libs/monitor_pvt_udp_sink.cc | 8 +- .../PVT/libs/monitor_pvt_udp_sink.h | 3 +- src/algorithms/PVT/libs/nmea_printer.cc | 3 +- src/algorithms/PVT/libs/nmea_printer.h | 4 +- src/algorithms/PVT/libs/pvt_solution.h | 6 + src/algorithms/PVT/libs/rtklib_solver.h | 8 +- .../acquisition/adapters/CMakeLists.txt | 1 + ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 5 +- .../galileo_e5a_pcps_acquisition_fpga.cc | 3 +- .../gps_l1_ca_pcps_acquisition_fpga.cc | 3 +- .../gps_l2_m_pcps_acquisition_fpga.cc | 3 +- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 3 +- src/algorithms/channel/adapters/channel.cc | 14 +- src/algorithms/channel/adapters/channel.h | 8 +- src/algorithms/channel/libs/channel_fsm.cc | 6 +- src/algorithms/channel/libs/channel_fsm.h | 4 +- src/algorithms/libs/CMakeLists.txt | 1 + src/algorithms/libs/gnss_sdr_make_unique.h | 76 ++ .../adapters/signal_generator.cc | 3 +- .../adapters/signal_generator.h | 3 +- .../adapters/ad9361_fpga_signal_source.cc | 459 ++++++------ .../adapters/ad9361_fpga_signal_source.h | 9 +- .../adapters/custom_udp_signal_source.cc | 2 +- .../adapters/custom_udp_signal_source.h | 4 +- .../adapters/file_signal_source.cc | 4 +- .../adapters/file_signal_source.h | 3 +- .../adapters/flexiband_signal_source.cc | 5 +- .../adapters/flexiband_signal_source.h | 10 +- .../adapters/fmcomms2_signal_source.cc | 4 +- .../adapters/fmcomms2_signal_source.h | 3 +- .../adapters/gen_signal_source.cc | 19 +- .../adapters/gen_signal_source.h | 13 +- .../adapters/gn3s_signal_source.cc | 5 +- .../adapters/gn3s_signal_source.h | 3 +- .../adapters/labsat_signal_source.cc | 4 +- .../adapters/labsat_signal_source.h | 3 +- .../multichannel_file_signal_source.cc | 4 +- .../multichannel_file_signal_source.h | 3 +- .../adapters/nsr_file_signal_source.cc | 4 +- .../adapters/nsr_file_signal_source.h | 3 +- .../adapters/osmosdr_signal_source.cc | 4 +- .../adapters/osmosdr_signal_source.h | 3 +- .../adapters/plutosdr_signal_source.cc | 4 +- .../adapters/plutosdr_signal_source.h | 3 +- .../adapters/raw_array_signal_source.cc | 2 +- .../adapters/raw_array_signal_source.h | 3 +- .../adapters/rtl_tcp_signal_source.cc | 9 +- .../adapters/rtl_tcp_signal_source.h | 3 +- .../adapters/spir_file_signal_source.cc | 4 +- .../adapters/spir_file_signal_source.h | 3 +- .../spir_gss6450_file_signal_source.cc | 4 +- .../spir_gss6450_file_signal_source.h | 3 +- .../two_bit_cpx_file_signal_source.cc | 9 +- .../adapters/two_bit_cpx_file_signal_source.h | 3 +- .../two_bit_packed_file_signal_source.cc | 9 +- .../two_bit_packed_file_signal_source.h | 3 +- .../adapters/uhd_signal_source.cc | 4 +- .../adapters/uhd_signal_source.h | 4 +- .../gnuradio_blocks/labsat23_source.cc | 50 +- .../gnuradio_blocks/labsat23_source.h | 10 +- .../signal_source/libs/ad9361_manager.cc | 4 +- .../signal_source/libs/gnss_sdr_valve.cc | 25 +- .../signal_source/libs/gnss_sdr_valve.h | 24 +- src/core/receiver/gnss_block_factory.cc | 708 +++++++++--------- src/core/receiver/gnss_block_factory.h | 71 +- src/core/receiver/gnss_flowgraph.cc | 33 +- src/core/receiver/gnss_flowgraph.h | 11 +- src/main/CMakeLists.txt | 1 + src/main/main.cc | 3 +- .../arithmetic/code_generation_test.cc | 24 +- .../arithmetic/complex_carrier_test.cc | 13 +- .../unit-tests/arithmetic/fft_length_test.cc | 5 +- .../unit-tests/arithmetic/fft_speed_test.cc | 5 +- .../arithmetic/preamble_correlator_test.cc | 7 +- .../control-plane/control_thread_test.cc | 4 +- .../control-plane/file_configuration_test.cc | 7 +- .../control-plane/gnss_block_factory_test.cc | 44 +- .../in_memory_configuration_test.cc | 27 +- .../control-plane/string_converter_test.cc | 7 +- .../acquisition/acq_performance_test.cc | 2 +- .../beidou_b1i_pcps_acquisition_test.cc | 2 +- .../beidou_b3i_pcps_acquisition_test.cc | 2 +- ...8ms_ambiguous_acquisition_gsoc2013_test.cc | 24 +- ...cps_ambiguous_acquisition_gsoc2013_test.cc | 24 +- ...e1_pcps_ambiguous_acquisition_gsoc_test.cc | 8 +- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 8 +- ...wsr_ambiguous_acquisition_gsoc2013_test.cc | 24 +- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 33 +- ...ong_ambiguous_acquisition_gsoc2013_test.cc | 24 +- ...cps_acquisition_gsoc2014_gensource_test.cc | 9 +- ...ss_l1_ca_pcps_acquisition_gsoc2017_test.cc | 23 +- .../glonass_l1_ca_pcps_acquisition_test.cc | 2 +- .../glonass_l2_ca_pcps_acquisition_test.cc | 33 +- ...ps_l1_ca_pcps_acquisition_gsoc2013_test.cc | 33 +- .../gps_l1_ca_pcps_acquisition_test.cc | 4 +- ...a_pcps_opencl_acquisition_gsoc2013_test.cc | 16 +- ...cps_quicksync_acquisition_gsoc2014_test.cc | 23 +- ..._ca_pcps_tong_acquisition_gsoc2013_test.cc | 16 +- .../gps_l2_m_pcps_acquisition_test.cc | 4 +- .../filter/fir_filter_test.cc | 39 +- .../filter/notch_filter_lite_test.cc | 16 +- .../filter/notch_filter_test.cc | 16 +- .../filter/pulse_blanking_filter_test.cc | 16 +- .../libs/item_type_helpers_test.cc | 1 + .../libs/observables_dump_reader.cc | 21 +- .../libs/observables_dump_reader.h | 14 +- .../observables/hybrid_observables_test.cc | 6 +- .../hybrid_observables_test_fpga.cc | 4 +- .../pvt/nmea_printer_test.cc | 2 +- .../pvt/rtcm_printer_test.cc | 5 +- .../pvt/rtklib_solver_test.cc | 3 +- .../direct_resampler_conditioner_cc_test.cc | 10 +- .../resampler/mmse_resampler_test.cc | 20 +- .../sources/file_signal_source_test.cc | 13 +- .../sources/gnss_sdr_valve_test.cc | 10 +- .../gps_l1_ca_telemetry_decoder_test.cc | 2 +- .../galileo_e1_dll_pll_veml_tracking_test.cc | 10 +- .../tracking/galileo_e5a_tracking_test.cc | 4 +- ...onass_l1_ca_dll_pll_c_aid_tracking_test.cc | 2 +- .../glonass_l1_ca_dll_pll_tracking_test.cc | 2 +- .../gps_l1_ca_dll_pll_tracking_test.cc | 2 +- .../tracking/gps_l1_ca_kf_tracking_test.cc | 2 +- .../gps_l2_m_dll_pll_tracking_test.cc | 2 +- .../tracking/tracking_pull-in_test.cc | 4 +- .../tracking/tracking_pull-in_test_fpga.cc | 6 +- src/utils/front-end-cal/main.cc | 37 +- 135 files changed, 1295 insertions(+), 1302 deletions(-) create mode 100644 src/algorithms/libs/gnss_sdr_make_unique.h diff --git a/docs/changelog.md b/docs/changelog.md index f9c8db453..21c028a1b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -26,6 +26,9 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades (nchannels, 0.0); channel_initialized = std::vector(nchannels, false); max_obs_block_rx_clock_offset_ms = conf_.max_obs_block_rx_clock_offset_ms; - d_output_rate_ms = conf_.output_rate_ms; d_display_rate_ms = conf_.display_rate_ms; d_report_rate_ms = 1000; // report every second PVT to gnss_synchro @@ -211,7 +210,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, } if (d_kml_output_enabled) { - d_kml_dump = std::make_shared(conf_.kml_output_path); + d_kml_dump = std::make_unique(conf_.kml_output_path); d_kml_dump->set_headers(kml_dump_filename); } else @@ -230,7 +229,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, } if (d_gpx_output_enabled) { - d_gpx_dump = std::make_shared(conf_.gpx_output_path); + d_gpx_dump = std::make_unique(conf_.gpx_output_path); d_gpx_dump->set_headers(gpx_dump_filename); } else @@ -249,7 +248,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, } if (d_geojson_output_enabled) { - d_geojson_printer = std::make_shared(conf_.geojson_output_path); + d_geojson_printer = std::make_unique(conf_.geojson_output_path); d_geojson_printer->set_headers(geojson_dump_filename); } else @@ -267,7 +266,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, if (d_nmea_output_file_enabled) { - d_nmea_printer = std::make_shared(conf_.nmea_dump_filename, conf_.nmea_output_file_enabled, conf_.flag_nmea_tty_port, conf_.nmea_dump_devname, conf_.nmea_output_file_path); + d_nmea_printer = std::make_unique(conf_.nmea_dump_filename, conf_.nmea_output_file_enabled, conf_.flag_nmea_tty_port, conf_.nmea_dump_devname, conf_.nmea_output_file_path); } else { @@ -279,7 +278,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, rtcm_dump_filename = d_dump_filename; if (conf_.flag_rtcm_server or conf_.flag_rtcm_tty_port or conf_.rtcm_output_file_enabled) { - d_rtcm_printer = std::make_shared(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, true, conf_.rtcm_output_file_path); + d_rtcm_printer = std::make_unique(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, true, conf_.rtcm_output_file_path); std::map rtcm_msg_rate_ms = conf_.rtcm_msg_rate_ms; if (rtcm_msg_rate_ms.find(1019) != rtcm_msg_rate_ms.end()) { @@ -355,7 +354,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_rinex_version = conf_.rinex_version; if (b_rinex_output_enabled) { - rp = std::make_shared(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name); + rp = std::make_unique(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name); rp->set_pre_2009_file(conf_.pre_2009_file); } else @@ -413,7 +412,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); - udp_sink_ptr = std::unique_ptr(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled)); + udp_sink_ptr = std::make_unique(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled); } else { @@ -2283,28 +2282,28 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item { if (current_RX_time_ms % d_kml_rate_ms == 0) { - d_kml_dump->print_position(d_user_pvt_solver, false); + d_kml_dump->print_position(d_user_pvt_solver.get(), false); } } if (d_gpx_output_enabled) { if (current_RX_time_ms % d_gpx_rate_ms == 0) { - d_gpx_dump->print_position(d_user_pvt_solver, false); + d_gpx_dump->print_position(d_user_pvt_solver.get(), false); } } if (d_geojson_output_enabled) { if (current_RX_time_ms % d_geojson_rate_ms == 0) { - d_geojson_printer->print_position(d_user_pvt_solver, false); + d_geojson_printer->print_position(d_user_pvt_solver.get(), false); } } if (d_nmea_output_file_enabled) { if (current_RX_time_ms % d_nmea_rate_ms == 0) { - d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver, false); + d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver.get(), false); } } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 6334657ab..66ee465c0 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -191,12 +191,12 @@ private: int32_t d_display_rate_ms; int32_t d_report_rate_ms; - std::shared_ptr rp; - std::shared_ptr d_kml_dump; - std::shared_ptr d_gpx_dump; - std::shared_ptr d_nmea_printer; - std::shared_ptr d_geojson_printer; - std::shared_ptr d_rtcm_printer; + std::unique_ptr rp; + std::unique_ptr d_kml_dump; + std::unique_ptr d_gpx_dump; + std::unique_ptr d_nmea_printer; + std::unique_ptr d_geojson_printer; + std::unique_ptr d_rtcm_printer; double d_rx_time; bool d_geojson_output_enabled; diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index 533839a6e..bb13c1ae0 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -176,25 +176,23 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam } -bool GeoJSON_Printer::print_position(const std::shared_ptr& position, bool print_average_values) +bool GeoJSON_Printer::print_position(const Pvt_Solution* position, bool print_average_values) { double latitude; double longitude; double height; - const std::shared_ptr& position_ = position; - if (print_average_values == false) { - latitude = position_->get_latitude(); - longitude = position_->get_longitude(); - height = position_->get_height(); + latitude = position->get_latitude(); + longitude = position->get_longitude(); + height = position->get_height(); } else { - latitude = position_->get_avg_latitude(); - longitude = position_->get_avg_longitude(); - height = position_->get_avg_height(); + latitude = position->get_avg_latitude(); + longitude = position->get_avg_longitude(); + height = position->get_avg_height(); } if (geojson_file.is_open()) diff --git a/src/algorithms/PVT/libs/geojson_printer.h b/src/algorithms/PVT/libs/geojson_printer.h index 7806493b4..ec4dfe2dc 100644 --- a/src/algorithms/PVT/libs/geojson_printer.h +++ b/src/algorithms/PVT/libs/geojson_printer.h @@ -40,7 +40,7 @@ public: explicit GeoJSON_Printer(const std::string& base_path = "."); ~GeoJSON_Printer(); bool set_headers(const std::string& filename, bool time_tag_name = true); - bool print_position(const std::shared_ptr& position, bool print_average_values); + bool print_position(const Pvt_Solution* position, bool print_average_values); bool close_file(); private: diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index f1aef11e8..d60e54235 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -20,7 +20,7 @@ #include "gpx_printer.h" -#include "rtklib_solver.h" +#include "pvt_solution.h" #include #include #include // for tm @@ -162,22 +162,21 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name) } -bool Gpx_Printer::print_position(const std::shared_ptr& position, bool print_average_values) +bool Gpx_Printer::print_position(const Pvt_Solution* position, bool print_average_values) { double latitude; double longitude; double height; positions_printed = true; - const std::shared_ptr& position_ = position; - double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s - double course_over_ground = position_->get_course_over_ground(); // expressed in deg + double speed_over_ground = position->get_speed_over_ground(); // expressed in m/s + double course_over_ground = position->get_course_over_ground(); // expressed in deg - double hdop = position_->get_hdop(); - double vdop = position_->get_vdop(); - double pdop = position_->get_pdop(); - std::string utc_time = to_iso_extended_string(position_->get_position_UTC_time()); + double hdop = position->get_hdop(); + double vdop = position->get_vdop(); + double pdop = position->get_pdop(); + std::string utc_time = to_iso_extended_string(position->get_position_UTC_time()); if (utc_time.length() < 23) { utc_time += "."; @@ -187,15 +186,15 @@ bool Gpx_Printer::print_position(const std::shared_ptr& position, if (print_average_values == false) { - latitude = position_->get_latitude(); - longitude = position_->get_longitude(); - height = position_->get_height(); + latitude = position->get_latitude(); + longitude = position->get_longitude(); + height = position->get_height(); } else { - latitude = position_->get_avg_latitude(); - longitude = position_->get_avg_longitude(); - height = position_->get_avg_height(); + latitude = position->get_avg_latitude(); + longitude = position->get_avg_longitude(); + height = position->get_avg_height(); } if (gpx_file.is_open()) diff --git a/src/algorithms/PVT/libs/gpx_printer.h b/src/algorithms/PVT/libs/gpx_printer.h index a38c8195e..0500eaff8 100644 --- a/src/algorithms/PVT/libs/gpx_printer.h +++ b/src/algorithms/PVT/libs/gpx_printer.h @@ -27,7 +27,7 @@ #include #include -class Rtklib_Solver; +class Pvt_Solution; /*! * \brief Prints PVT information to GPX format file @@ -40,7 +40,7 @@ public: explicit Gpx_Printer(const std::string& base_path = "."); ~Gpx_Printer(); bool set_headers(const std::string& filename, bool time_tag_name = true); - bool print_position(const std::shared_ptr& position, bool print_average_values); + bool print_position(const Pvt_Solution* position, bool print_average_values); bool close_file(); private: diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index ccd3cc416..d8978faf3 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -20,7 +20,7 @@ */ #include "kml_printer.h" -#include "rtklib_solver.h" +#include "pvt_solution.h" #include #include #include // for mkstemp @@ -231,7 +231,7 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name) } -bool Kml_Printer::print_position(const std::shared_ptr& position, bool print_average_values) +bool Kml_Printer::print_position(const Pvt_Solution* position, bool print_average_values) { double latitude; double longitude; @@ -239,15 +239,13 @@ bool Kml_Printer::print_position(const std::shared_ptr& position, positions_printed = true; - const std::shared_ptr& position_ = position; + double speed_over_ground = position->get_speed_over_ground(); // expressed in m/s + double course_over_ground = position->get_course_over_ground(); // expressed in deg - double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s - double course_over_ground = position_->get_course_over_ground(); // expressed in deg - - double hdop = position_->get_hdop(); - double vdop = position_->get_vdop(); - double pdop = position_->get_pdop(); - std::string utc_time = to_iso_extended_string(position_->get_position_UTC_time()); + double hdop = position->get_hdop(); + double vdop = position->get_vdop(); + double pdop = position->get_pdop(); + std::string utc_time = to_iso_extended_string(position->get_position_UTC_time()); if (utc_time.length() < 23) { utc_time += "."; @@ -257,15 +255,15 @@ bool Kml_Printer::print_position(const std::shared_ptr& position, if (print_average_values == false) { - latitude = position_->get_latitude(); - longitude = position_->get_longitude(); - height = position_->get_height(); + latitude = position->get_latitude(); + longitude = position->get_longitude(); + height = position->get_height(); } else { - latitude = position_->get_avg_latitude(); - longitude = position_->get_avg_longitude(); - height = position_->get_avg_height(); + latitude = position->get_avg_latitude(); + longitude = position->get_avg_longitude(); + height = position->get_avg_height(); } if (kml_file.is_open() && tmp_file.is_open()) diff --git a/src/algorithms/PVT/libs/kml_printer.h b/src/algorithms/PVT/libs/kml_printer.h index 58019aff2..6d9fa2ac4 100644 --- a/src/algorithms/PVT/libs/kml_printer.h +++ b/src/algorithms/PVT/libs/kml_printer.h @@ -26,7 +26,7 @@ #include // for shared_ptr #include -class Rtklib_Solver; +class Pvt_Solution; /*! * \brief Prints PVT information to OGC KML format file (can be viewed with Google Earth) @@ -39,7 +39,7 @@ public: explicit Kml_Printer(const std::string& base_path = std::string(".")); ~Kml_Printer(); bool set_headers(const std::string& filename, bool time_tag_name = true); - bool print_position(const std::shared_ptr& position, bool print_average_values); + bool print_position(const Pvt_Solution* position, bool print_average_values); bool close_file(); private: diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 58fb5ce81..454d9e667 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -22,6 +22,7 @@ #include #include #include +#include Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context} @@ -40,19 +41,20 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addre } -bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const std::shared_ptr& monitor_pvt) +bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr monitor_pvt) { + monitor_pvt_ = std::move(monitor_pvt); std::string outbound_data; if (use_protobuf == false) { std::ostringstream archive_stream; boost::archive::binary_oarchive oa{archive_stream}; - oa << *monitor_pvt.get(); + oa << *monitor_pvt_.get(); outbound_data = archive_stream.str(); } else { - outbound_data = serdes.createProtobuffer(monitor_pvt); + outbound_data = serdes.createProtobuffer(monitor_pvt_); } for (const auto& endpoint : endpoints) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index bbecda420..1f5fa2bcb 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink { public: Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool protobuf_enabled); - bool write_monitor_pvt(const std::shared_ptr& monitor_pvt); + bool write_monitor_pvt(std::shared_ptr monitor_pvt); private: b_io_context io_context; @@ -46,6 +46,7 @@ private: boost::system::error_code error; std::vector endpoints; Serdes_Monitor_Pvt serdes; + std::shared_ptr monitor_pvt_; bool use_protobuf; }; diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 405dab140..559d51a99 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -119,6 +119,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi nmea_dev_descriptor = -1; } print_avg_pos = false; + d_PVT_data = nullptr; } @@ -213,7 +214,7 @@ void Nmea_Printer::close_serial() } -bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr& pvt_data, bool print_average_values) +bool Nmea_Printer::Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values) { std::string GPRMC; std::string GPGGA; diff --git a/src/algorithms/PVT/libs/nmea_printer.h b/src/algorithms/PVT/libs/nmea_printer.h index 4a19edbd6..c05ca4af1 100644 --- a/src/algorithms/PVT/libs/nmea_printer.h +++ b/src/algorithms/PVT/libs/nmea_printer.h @@ -49,7 +49,7 @@ public: /*! * \brief Print NMEA PVT and satellite info to the initialized device */ - bool Print_Nmea_Line(const std::shared_ptr& pvt_data, bool print_average_values); + bool Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values); /*! * \brief Default destructor. @@ -62,7 +62,7 @@ private: std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file std::string nmea_devname; int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port) - std::shared_ptr d_PVT_data; + const Rtklib_Solver* d_PVT_data; int init_serial(const std::string& serial_device); // serial port control void close_serial(); std::string get_GPGGA(); // fix data diff --git a/src/algorithms/PVT/libs/pvt_solution.h b/src/algorithms/PVT/libs/pvt_solution.h index 190ba0ede..afbb694da 100644 --- a/src/algorithms/PVT/libs/pvt_solution.h +++ b/src/algorithms/PVT/libs/pvt_solution.h @@ -38,6 +38,7 @@ class Pvt_Solution { public: Pvt_Solution(); + virtual ~Pvt_Solution() = default; void set_pre_2009_file(bool pre_2009_file); //!< Flag for the week rollover computation in post processing mode for signals older than 2009 double get_time_offset_s() const; //!< Get RX time offset [s] void set_time_offset_s(double offset); //!< Set RX time offset [s] @@ -123,6 +124,11 @@ public: */ int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km); + virtual double get_hdop() const = 0; + virtual double get_vdop() const = 0; + virtual double get_pdop() const = 0; + virtual double get_gdop() const = 0; + protected: bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009 private: diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h index 913d057e4..b07642bba 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.h +++ b/src/algorithms/PVT/libs/rtklib_solver.h @@ -75,10 +75,10 @@ public: sol_t pvt_sol{}; std::array pvt_ssat{}; - double get_hdop() const; - double get_vdop() const; - double get_pdop() const; - double get_gdop() const; + double get_hdop() const override; + double get_vdop() const override; + double get_pdop() const override; + double get_gdop() const override; Monitor_Pvt get_monitor_pvt() const; std::map galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index fc0fc4477..258c3c7f4 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -118,6 +118,7 @@ endif() if(ENABLE_FPGA) target_link_libraries(acquisition_adapters PRIVATE + algorithms_libs Gnuradio::fft Volk::volk Volkgnsssdr::volkgnsssdr diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 381568a7b..92e9ea00c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -23,6 +23,7 @@ #include "configuration_interface.h" #include "galileo_e1_signal_processing.h" #include "gnss_sdr_flags.h" +#include "gnss_sdr_make_unique.h" #include #include // for fft_complex #include // for gr_complex @@ -87,8 +88,8 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT - volk_gnsssdr::vector> code(nsamples_total); // buffer for the local code + auto fft_if = std::make_unique(nsamples_total, true); // Direct FFT + volk_gnsssdr::vector> code(nsamples_total); // buffer for the local code volk_gnsssdr::vector fft_codes_padded(nsamples_total); d_all_fft_codes_ = std::vector(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 8e0c1fd59..ddfbbd589 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -23,6 +23,7 @@ #include "configuration_interface.h" #include "galileo_e5_signal_processing.h" #include "gnss_sdr_flags.h" +#include "gnss_sdr_make_unique.h" #include #include // for fft_complex #include // for gr_complex @@ -88,7 +89,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT + auto fft_if = std::make_unique(nsamples_total, true); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = std::vector(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 6c582cd2a..35bceda00 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -25,6 +25,7 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include "gnss_sdr_make_unique.h" #include "gps_sdr_signal_processing.h" #include #include @@ -80,7 +81,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); + auto fft_if = std::make_unique(nsamples_total, true); // allocate memory to compute all the PRNs and compute all the possible codes volk_gnsssdr::vector> code(nsamples_total); volk_gnsssdr::vector> fft_codes_padded(nsamples_total); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 1df49c9d4..56dffc3d3 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -24,6 +24,7 @@ #include "GPS_L2C.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include "gnss_sdr_make_unique.h" #include "gnss_synchro.h" #include "gps_l2c_signal.h" #include @@ -81,7 +82,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT + auto fft_if = std::make_unique(nsamples_total, true); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes volk_gnsssdr::vector> code(nsamples_total); volk_gnsssdr::vector> fft_codes_padded(nsamples_total); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 0f123169f..4b0a25216 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -25,6 +25,7 @@ #include "GPS_L5.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include "gnss_sdr_make_unique.h" #include "gps_l5_signal.h" #include #include // for fft_complex @@ -85,7 +86,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - auto fft_if = std::unique_ptr(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT + auto fft_if = std::make_unique(nsamples_total, true); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = std::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 68fc67dd4..aa81225c0 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -29,17 +29,17 @@ #include // for std::move -Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr& acq, - const std::shared_ptr& trk, const std::shared_ptr& nav, - const std::string& role, const std::string& implementation, const std::shared_ptr >& queue) +Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, + std::shared_ptr trk, std::shared_ptr nav, + const std::string& role, const std::string& implementation, Concurrent_Queue* queue) { - acq_ = acq; - trk_ = trk; - nav_ = nav; + acq_ = std::move(acq); + trk_ = std::move(trk); + nav_ = std::move(nav); + queue_ = queue; role_ = role; implementation_ = implementation; channel_ = channel; - queue_ = queue; channel_fsm_ = std::make_shared(); flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false); diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index ec5194114..d2d965798 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -54,9 +54,9 @@ class Channel : public ChannelInterface { public: //! Constructor - Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr& acq, - const std::shared_ptr& trk, const std::shared_ptr& nav, - const std::string& role, const std::string& implementation, const std::shared_ptr>& queue); + Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, + std::shared_ptr trk, std::shared_ptr nav, + const std::string& role, const std::string& implementation, Concurrent_Queue* queue); ~Channel() = default; //!< Destructor @@ -97,7 +97,7 @@ private: bool connected_; bool repeat_; std::shared_ptr channel_fsm_; - std::shared_ptr> queue_; + Concurrent_Queue* queue_; std::mutex mx; }; diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index 3802b720d..3a1a840c9 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -30,6 +30,7 @@ ChannelFsm::ChannelFsm() trk_ = nullptr; channel_ = 0U; d_state = 0U; + queue_ = nullptr; } @@ -38,6 +39,7 @@ ChannelFsm::ChannelFsm(std::shared_ptr acquisition) : acq_ trk_ = nullptr; channel_ = 0U; d_state = 0U; + queue_ = nullptr; } @@ -168,10 +170,10 @@ void ChannelFsm::set_telemetry(std::shared_ptr teleme } -void ChannelFsm::set_queue(std::shared_ptr> queue) +void ChannelFsm::set_queue(Concurrent_Queue* queue) { std::lock_guard lk(mx); - queue_ = std::move(queue); + queue_ = queue; } diff --git a/src/algorithms/channel/libs/channel_fsm.h b/src/algorithms/channel/libs/channel_fsm.h index 4b696a278..09461c567 100644 --- a/src/algorithms/channel/libs/channel_fsm.h +++ b/src/algorithms/channel/libs/channel_fsm.h @@ -45,7 +45,7 @@ public: void set_acquisition(std::shared_ptr acquisition); void set_tracking(std::shared_ptr tracking); void set_telemetry(std::shared_ptr telemetry); - void set_queue(std::shared_ptr> queue); + void set_queue(Concurrent_Queue* queue); void set_channel(uint32_t channel); void start_acquisition(); // FSM EVENTS @@ -67,7 +67,7 @@ private: std::shared_ptr acq_; std::shared_ptr trk_; std::shared_ptr nav_; - std::shared_ptr> queue_; + Concurrent_Queue* queue_; uint32_t channel_; uint32_t d_state; std::mutex mx; diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 1fefc2489..1c5a3c827 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -55,6 +55,7 @@ set(GNSS_SPLIBS_HEADERS conjugate_sc.h conjugate_ic.h gnss_sdr_create_directory.h + gnss_sdr_make_unique.h gnss_circular_deque.h geofunctions.h item_type_helpers.h diff --git a/src/algorithms/libs/gnss_sdr_make_unique.h b/src/algorithms/libs/gnss_sdr_make_unique.h new file mode 100644 index 000000000..6ca5350d9 --- /dev/null +++ b/src/algorithms/libs/gnss_sdr_make_unique.h @@ -0,0 +1,76 @@ +/*! + * \file gnss_sdr_make_unique.h + * \brief This file implements std::make_unique for C++11 + * + * \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es + * + * Based on https://stackoverflow.com/a/17902439 + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H +#define GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H + +#if __cplusplus == 201103L + +#include +#include +#include +#include + +namespace std +{ +template +struct _Unique_if +{ + typedef unique_ptr _Single_object; +}; + +template +struct _Unique_if +{ + typedef unique_ptr _Unknown_bound; +}; + +template +struct _Unique_if +{ + typedef void _Known_bound; +}; + +template +typename _Unique_if::_Single_object +make_unique(Args&&... args) +{ + return unique_ptr(new T(std::forward(args)...)); +} + +template +typename _Unique_if::_Unknown_bound +make_unique(size_t n) +{ + typedef typename remove_extent::type U; + return unique_ptr(new U[n]()); +} + +template +typename _Unique_if::_Known_bound +make_unique(Args&&...) = delete; +} // namespace std + +#endif // __cplusplus == 201103L + +#endif // GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 4b0f0285c..77e658144 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -33,7 +33,8 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr > queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + unsigned int out_stream, + Concurrent_Queue* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/gen_source.dat"; diff --git a/src/algorithms/signal_generator/adapters/signal_generator.h b/src/algorithms/signal_generator/adapters/signal_generator.h index 26c0e456f..9bb607f1d 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.h +++ b/src/algorithms/signal_generator/adapters/signal_generator.h @@ -44,7 +44,7 @@ class SignalGenerator : public GNSSBlockInterface public: SignalGenerator(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr > queue); + unsigned int out_stream, Concurrent_Queue* queue); ~SignalGenerator() = default; @@ -86,7 +86,6 @@ private: #endif gr::blocks::vector_to_stream::sptr vector_to_stream_; gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr > queue_; }; #endif // GNSS_SDR_SIGNAL_GENERATOR_H diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index fa5227d81..f909c43c0 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -40,238 +40,10 @@ #include #include -void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA) -{ - const int MAX_INPUT_SAMPLES_TOTAL = 16384; - int max_value = 0; - int tx_fd; // DMA descriptor - std::ifstream infile1; - infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); - - try - { - infile1.open(Filename1, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception opening file " << Filename1 << std::endl; - return; - } - - std::ifstream infile2; - infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); - try - { - infile2.open(Filename2, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - // could not exist - } - - // rx signal - std::vector input_samples(MAX_INPUT_SAMPLES_TOTAL * 2); - std::vector input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2); - std::vector input_samples_dma(MAX_INPUT_SAMPLES_TOTAL * 2 * 2); - - int nread_elements; - int nread_elements2; - int file_completed = 0; - int num_transferred_bytes; - - //************************************************************************** - // Open DMA device - //************************************************************************** - tx_fd = open("/dev/loop_tx", O_WRONLY); - if (tx_fd < 0) - { - std::cout << "Cannot open loop device" << std::endl; - return; - } - - //************************************************************************** - // Open input file - //************************************************************************** - int nsamples = 0; - - while ((file_completed == 0) && (enable_DMA == true)) - { - unsigned int dma_index = 0; - - if (FreqBand == "L1") - { - try - { - infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << Filename1 << std::endl; - } - if (infile1) - { - nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; - } - else - { - nread_elements = 0; - } - nsamples += (nread_elements / 2); - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // channel 1 (queue 1) - input_samples_dma[dma_index] = 0; - input_samples_dma[dma_index + 1] = 0; - // channel 0 (queue 0) - input_samples_dma[dma_index + 2] = input_samples[index0]; - input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; - - dma_index += 4; - } - } - else if (FreqBand == "L2") - { - try - { - infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << Filename1 << std::endl; - } - if (infile1) - { - nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; - } - else - { - nread_elements = 0; - } - nsamples += (nread_elements / 2); - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // channel 1 (queue 1) - input_samples_dma[dma_index] = input_samples[index0]; - input_samples_dma[dma_index + 1] = input_samples[index0 + 1]; - // channel 0 (queue 0) - input_samples_dma[dma_index + 2] = 0; - input_samples_dma[dma_index + 3] = 0; - - dma_index += 4; - } - } - else if (FreqBand == "L1L2") - { - try - { - infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << Filename1 << std::endl; - } - if (infile1) - { - nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; - } - else - { - nread_elements = 0; - } - try - { - infile2.read(reinterpret_cast(input_samples2.data()), MAX_INPUT_SAMPLES_TOTAL * 2); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << Filename1 << std::endl; - } - if (infile2) - { - nread_elements2 = MAX_INPUT_SAMPLES_TOTAL * 2; - } - else - { - nread_elements2 = 0; - } - - if (nread_elements > nread_elements2) - { - nread_elements = nread_elements2; // take the smallest - } - - nsamples += (nread_elements / 2); - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - input_samples[index0] = input_samples[index0]; - input_samples[index0 + 1] = input_samples[index0 + 1]; - - if (input_samples[index0] > max_value) - { - max_value = input_samples[index0]; - } - else if (-input_samples[index0] > max_value) - { - max_value = -input_samples[index0]; - } - - if (input_samples[index0 + 1] > max_value) - { - max_value = input_samples[index0 + 1]; - } - else if (-input_samples[index0 + 1] > max_value) - { - max_value = -input_samples[index0 + 1]; - } - - // channel 1 (queue 1) - input_samples_dma[dma_index] = input_samples2[index0]; - input_samples_dma[dma_index + 1] = input_samples2[index0 + 1]; - // channel 0 (queue 0) - input_samples_dma[dma_index + 2] = input_samples[index0]; - input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; - - dma_index += 4; - } - } - - if (nread_elements > 0) - { - num_transferred_bytes = nread_elements * 2; - int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2); - if (num_bytes_sent != num_transferred_bytes) - { - std::cerr << "Error: DMA could not send all the required samples " << std::endl; - } - - // Throttle the DMA - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - - if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2) - { - file_completed = 1; - } - } - - try - { - infile1.close(); - infile2.close(); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception closing files " << Filename1 << " and " << Filename2 << std::endl; - } -} - Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue *queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_gain_mode("slow_attack"); double default_tx_attenuation_db = -10.0; @@ -564,6 +336,235 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() } +void Ad9361FpgaSignalSource::run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA) +{ + const int MAX_INPUT_SAMPLES_TOTAL = 16384; + int max_value = 0; + int tx_fd; // DMA descriptor + std::ifstream infile1; + infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); + + try + { + infile1.open(Filename1, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << Filename1 << std::endl; + return; + } + + std::ifstream infile2; + infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); + try + { + infile2.open(Filename2, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + // could not exist + } + + // rx signal + std::vector input_samples(MAX_INPUT_SAMPLES_TOTAL * 2); + std::vector input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2); + std::vector input_samples_dma(MAX_INPUT_SAMPLES_TOTAL * 2 * 2); + + int nread_elements; + int nread_elements2; + int file_completed = 0; + int num_transferred_bytes; + + //************************************************************************** + // Open DMA device + //************************************************************************** + tx_fd = open("/dev/loop_tx", O_WRONLY); + if (tx_fd < 0) + { + std::cout << "Cannot open loop device" << std::endl; + return; + } + + //************************************************************************** + // Open input file + //************************************************************************** + int nsamples = 0; + + while ((file_completed == 0) && (enable_DMA == true)) + { + unsigned int dma_index = 0; + + if (FreqBand == "L1") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // channel 1 (queue 1) + input_samples_dma[dma_index] = 0; + input_samples_dma[dma_index + 1] = 0; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = input_samples[index0]; + input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; + + dma_index += 4; + } + } + else if (FreqBand == "L2") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // channel 1 (queue 1) + input_samples_dma[dma_index] = input_samples[index0]; + input_samples_dma[dma_index + 1] = input_samples[index0 + 1]; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = 0; + input_samples_dma[dma_index + 3] = 0; + + dma_index += 4; + } + } + else if (FreqBand == "L1L2") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + try + { + infile2.read(reinterpret_cast(input_samples2.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile2) + { + nread_elements2 = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements2 = 0; + } + + if (nread_elements > nread_elements2) + { + nread_elements = nread_elements2; // take the smallest + } + + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + input_samples[index0] = input_samples[index0]; + input_samples[index0 + 1] = input_samples[index0 + 1]; + + if (input_samples[index0] > max_value) + { + max_value = input_samples[index0]; + } + else if (-input_samples[index0] > max_value) + { + max_value = -input_samples[index0]; + } + + if (input_samples[index0 + 1] > max_value) + { + max_value = input_samples[index0 + 1]; + } + else if (-input_samples[index0 + 1] > max_value) + { + max_value = -input_samples[index0 + 1]; + } + + // channel 1 (queue 1) + input_samples_dma[dma_index] = input_samples2[index0]; + input_samples_dma[dma_index + 1] = input_samples2[index0 + 1]; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = input_samples[index0]; + input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; + + dma_index += 4; + } + } + + if (nread_elements > 0) + { + num_transferred_bytes = nread_elements * 2; + int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2); + if (num_bytes_sent != num_transferred_bytes) + { + std::cerr << "Error: DMA could not send all the required samples " << std::endl; + } + + // Throttle the DMA + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + + if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2) + { + file_completed = 1; + } + } + + try + { + infile1.close(); + infile2.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing files " << Filename1 << " and " << Filename2 << std::endl; + } +} + + void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block) { if (top_block) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index f8af17830..a861ac844 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -35,9 +35,9 @@ class ConfigurationInterface; class Ad9361FpgaSignalSource : public GNSSBlockInterface { public: - Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + Ad9361FpgaSignalSource(ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); ~Ad9361FpgaSignalSource(); @@ -102,8 +102,6 @@ private: size_t item_size_; - std::shared_ptr> queue_; - std::shared_ptr switch_fpga; int32_t switch_position; @@ -114,6 +112,7 @@ private: bool enable_DMA_; bool rf_shutdown_; + void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA); }; #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 518607d76..c0e2d0479 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -29,7 +29,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { // DUMP PARAMETERS std::string empty = ""; diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index cab739186..2c5a490b0 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -48,7 +48,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface public: CustomUDPSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~CustomUDPSignalSource() = default; @@ -98,8 +98,6 @@ private: #endif Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_; - - std::shared_ptr> queue_; }; #endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index 40631b2cb..b5f347744 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -33,7 +33,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + Concurrent_Queue* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_filename = "./example_capture.dat"; std::string default_item_type = "short"; @@ -211,7 +211,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (dump_) diff --git a/src/algorithms/signal_source/adapters/file_signal_source.h b/src/algorithms/signal_source/adapters/file_signal_source.h index 6e6476170..7624bd4a1 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.h +++ b/src/algorithms/signal_source/adapters/file_signal_source.h @@ -50,7 +50,7 @@ class FileSignalSource : public GNSSBlockInterface public: FileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~FileSignalSource() = default; @@ -121,7 +121,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 717977214..95af50c4d 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -31,10 +31,7 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), - in_stream_(in_stream), - out_stream_(out_stream), - queue_(std::move(queue)) + Concurrent_Queue* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "byte"; item_type_ = configuration->property(role + ".item_type", default_item_type); diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.h b/src/algorithms/signal_source/adapters/flexiband_signal_source.h index d59d03b6d..3f8be56f6 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.h +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.h @@ -47,7 +47,7 @@ class FlexibandSignalSource : public GNSSBlockInterface public: FlexibandSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~FlexibandSignalSource() = default; @@ -94,13 +94,11 @@ private: int n_channels_; int sel_ch_; - gr::block_sptr flexiband_source_; + boost::shared_ptr flexiband_source_; - std::vector> char_to_float; - std::vector> float_to_complex_; + std::vector> char_to_float; + std::vector> float_to_complex_; std::vector null_sinks_; - - std::shared_ptr> queue_; }; #endif // GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 7c9c85db2..f1f96f3fc 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -34,7 +34,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue *queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; @@ -320,7 +320,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration if (samples_ != 0) { DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index e91e78a07..0e30fc0d1 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -46,7 +46,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface public: Fmcomms2SignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~Fmcomms2SignalSource(); @@ -127,7 +127,6 @@ private: boost::shared_ptr valve_; #endif gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.cc b/src/algorithms/signal_source/adapters/gen_signal_source.cc index c2367c0b4..71a2f668b 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gen_signal_source.cc @@ -29,24 +29,17 @@ // Constructor -GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter, - std::string role, std::shared_ptr> queue) : signal_generator_(signal_generator), - filter_(filter), - role_(std::move(role)), - queue_(std::move(queue)) +GenSignalSource::GenSignalSource(std::shared_ptr signal_generator, + std::shared_ptr filter, + std::string role, + Concurrent_Queue *queue __attribute__((unused))) : signal_generator_(std::move(signal_generator)), + filter_(std::move(filter)), + role_(std::move(role)) { connected_ = false; } -// Destructor -GenSignalSource::~GenSignalSource() -{ - delete signal_generator_; - delete filter_; -} - - void GenSignalSource::connect(gr::top_block_sptr top_block) { if (connected_) diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.h b/src/algorithms/signal_source/adapters/gen_signal_source.h index b22d33f05..148db05db 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.h +++ b/src/algorithms/signal_source/adapters/gen_signal_source.h @@ -37,11 +37,11 @@ class GenSignalSource : public GNSSBlockInterface { public: //! Constructor - GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter, - std::string role, std::shared_ptr> queue); + GenSignalSource(std::shared_ptr signal_generator, std::shared_ptr filter, + std::string role, Concurrent_Queue *queue); //! Virtual destructor - virtual ~GenSignalSource(); + virtual ~GenSignalSource() = default; void connect(gr::top_block_sptr top_block) override; void disconnect(gr::top_block_sptr top_block) override; @@ -52,15 +52,14 @@ public: //! Returns "Signal Source" inline std::string implementation() override { return "Signal Source"; } inline size_t item_size() override { return 0; } - inline GNSSBlockInterface *signal_generator() const { return signal_generator_; } + inline std::shared_ptr signal_generator() const { return signal_generator_; } private: - GNSSBlockInterface *signal_generator_; - GNSSBlockInterface *filter_; + std::shared_ptr signal_generator_; + std::shared_ptr filter_; std::string role_; std::string implementation_; bool connected_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_GEN_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc index e1bd04d70..824429655 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc @@ -25,7 +25,10 @@ Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + std::string role, + unsigned int in_stream, + unsigned int out_stream, + Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "short"; std::string default_dump_file = "./data/gn3s_source.dat"; diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.h b/src/algorithms/signal_source/adapters/gn3s_signal_source.h index 2973646a3..1eeea5ec4 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.h +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.h @@ -40,7 +40,7 @@ class Gn3sSignalSource : public GNSSBlockInterface public: Gn3sSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~Gn3sSignalSource() = default; @@ -78,7 +78,6 @@ private: std::string dump_filename_; gr::block_sptr gn3s_source_; gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_GN3S_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 3b788385e..fa828795b 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -26,7 +26,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + const std::string& role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./labsat_output.dat"; @@ -42,7 +42,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); - labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue_); + labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue); DLOG(INFO) << "Item size " << item_size_; DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.h b/src/algorithms/signal_source/adapters/labsat_signal_source.h index 8a353420e..67e170b8f 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.h +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.h @@ -39,7 +39,7 @@ class LabsatSignalSource : public GNSSBlockInterface public: LabsatSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~LabsatSignalSource() = default; @@ -77,7 +77,6 @@ private: std::string dump_filename_; gr::block_sptr labsat23_source_; gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_LABSAT_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc index 76ba2d7fc..22ce5e3cb 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -32,7 +32,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + Concurrent_Queue* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_filename = "./example_capture.dat"; std::string default_item_type = "short"; @@ -205,7 +205,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterfac DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (enable_throttle_control_) diff --git a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h index 480aedc63..e4f1f1ffd 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h @@ -51,7 +51,7 @@ class MultichannelFileSignalSource : public GNSSBlockInterface public: MultichannelFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~MultichannelFileSignalSource() = default; @@ -121,7 +121,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; std::vector throttle_vec_; - std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index 9515c78b1..b365c0d20 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -33,7 +33,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + Concurrent_Queue* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; @@ -137,7 +137,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue_); + valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (dump_) diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.h b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h index 5c6ca67a2..171b4f343 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h @@ -50,7 +50,7 @@ class NsrFileSignalSource : public GNSSBlockInterface public: NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~NsrFileSignalSource() = default; inline std::string role() override @@ -121,7 +121,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 10cb7c453..14c056489 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -31,7 +31,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { // DUMP PARAMETERS std::string empty = ""; @@ -123,7 +123,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, if (samples_ != 0) { DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index fd9230548..d514562e1 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -48,7 +48,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface public: OsmosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~OsmosdrSignalSource() = default; @@ -108,7 +108,6 @@ private: boost::shared_ptr valve_; #endif gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index 5419b4130..161ccdff5 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -28,7 +28,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; @@ -135,7 +135,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration if (samples_ != 0) { DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index d701742a5..edb54fe37 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -48,7 +48,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface public: PlutosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~PlutosdrSignalSource() = default; @@ -112,7 +112,6 @@ private: boost::shared_ptr valve_; #endif gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc index 39e85e4f1..26d64f7cb 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc @@ -27,7 +27,7 @@ RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + std::string role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/raw_array_source.dat"; diff --git a/src/algorithms/signal_source/adapters/raw_array_signal_source.h b/src/algorithms/signal_source/adapters/raw_array_signal_source.h index e14eb9530..fd3272b72 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.h +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.h @@ -39,7 +39,7 @@ class RawArraySignalSource : public GNSSBlockInterface public: RawArraySignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~RawArraySignalSource() = default; @@ -78,7 +78,6 @@ private: std::string eth_device_; gr::block_sptr raw_array_source_; gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index bdf84a135..8edde7ee4 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -34,10 +34,9 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), - in_stream_(in_stream), - out_stream_(out_stream), - queue_(std::move(queue)) + Concurrent_Queue* queue) : role_(role), + in_stream_(in_stream), + out_stream_(out_stream) { // DUMP PARAMETERS std::string empty = ""; @@ -111,7 +110,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, if (samples_ != 0ULL) { DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; - valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h index 134906233..56ae6975e 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h @@ -51,7 +51,7 @@ public: const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue); + Concurrent_Queue* queue); ~RtlTcpSignalSource() = default; @@ -111,7 +111,6 @@ private: boost::shared_ptr valve_; #endif gr::blocks::file_sink::sptr file_sink_; - std::shared_ptr> queue_; }; #endif // GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc index 5c3a3c163..a14bab6ad 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -32,7 +32,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + Concurrent_Queue* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "int"; @@ -136,7 +136,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue_); + valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (dump_) diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_file_signal_source.h index 517747a65..d4d35f826 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.h @@ -48,7 +48,7 @@ class SpirFileSignalSource : public GNSSBlockInterface public: SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~SpirFileSignalSource() = default; inline std::string role() override @@ -119,7 +119,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index cce6e49e9..76ba6a20e 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -29,7 +29,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, - const std::string& role, uint32_t in_streams, uint32_t out_streams, std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) + const std::string& role, uint32_t in_streams, uint32_t out_streams, Concurrent_Queue* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { std::string default_filename = "../data/my_capture.dat"; std::string default_dump_filename = "../data/my_capture_dump.dat"; @@ -137,7 +137,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* for (uint32_t i = 0; i < (n_channels_); i++) { - valve_vec_.emplace_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_)); + valve_vec_.emplace_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue)); if (dump_) { std::string tmp_str = dump_filename_ + "_ch" + std::to_string(i); diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h index 3a1d32d47..bfda945a2 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h @@ -53,7 +53,7 @@ class SpirGSS6450FileSignalSource : public GNSSBlockInterface { public: SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, const std::string& role, - uint32_t in_streams, uint32_t out_streams, std::shared_ptr> queue); + uint32_t in_streams, uint32_t out_streams, Concurrent_Queue* queue); ~SpirGSS6450FileSignalSource() = default; inline std::string role() override @@ -130,7 +130,6 @@ private: #endif std::vector sink_vec_; std::vector throttle_vec_; - std::shared_ptr> queue_; size_t item_size_; }; diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index f600ae324..93c4c196a 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -34,10 +34,9 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), - in_streams_(in_streams), - out_streams_(out_streams), - queue_(queue) + Concurrent_Queue* queue) : role_(role), + in_streams_(in_streams), + out_streams_(out_streams) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; @@ -142,7 +141,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_); + valve_ = gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (dump_) diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h index ae9ad36b0..bfb997d44 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h @@ -54,7 +54,7 @@ public: const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~TwoBitCpxFileSignalSource() = default; inline std::string role() override @@ -126,7 +126,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index 721bf6c9d..cb4032487 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -36,10 +36,9 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue) : role_(role), - in_streams_(in_streams), - out_streams_(out_streams), - queue_(queue) + Concurrent_Queue* queue) : role_(role), + in_streams_(in_streams), + out_streams_(out_streams) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; @@ -206,7 +205,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; - valve_ = gnss_sdr_make_valve(output_item_size, samples_, queue_); + valve_ = gnss_sdr_make_valve(output_item_size, samples_, queue); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (dump_) diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h index cd2365c85..21ace2c68 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h @@ -53,7 +53,7 @@ class TwoBitPackedFileSignalSource : public GNSSBlockInterface public: TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); ~TwoBitPackedFileSignalSource() = default; inline std::string role() override @@ -145,7 +145,6 @@ private: #endif gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - std::shared_ptr> queue_; size_t item_size_; bool big_endian_items_; bool big_endian_bytes_; diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index 51bdaffff..ea6b30150 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -31,7 +31,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + Concurrent_Queue* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { // DUMP PARAMETERS std::string empty = ""; @@ -204,7 +204,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, if (samples_.at(i) != 0ULL) { LOG(INFO) << "RF_channel " << i << " Send STOP signal after " << samples_.at(i) << " samples"; - valve_.emplace_back(gnss_sdr_make_valve(item_size_, samples_.at(i), queue_)); + valve_.emplace_back(gnss_sdr_make_valve(item_size_, samples_.at(i), queue)); DLOG(INFO) << "valve(" << valve_.at(i)->unique_id() << ")"; } diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.h b/src/algorithms/signal_source/adapters/uhd_signal_source.h index 623664148..91cfcb8c9 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.h +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.h @@ -46,7 +46,7 @@ class UhdSignalSource : public GNSSBlockInterface public: UhdSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, std::shared_ptr> queue); + unsigned int out_stream, Concurrent_Queue* queue); ~UhdSignalSource() = default; @@ -103,8 +103,6 @@ private: std::vector> valve_; #endif std::vector file_sink_; - - std::shared_ptr> queue_; }; #endif // GNSS_SDR_UHD_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index c2a99eb3c..006577344 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -30,18 +30,18 @@ #include -labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr> queue) +labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, Concurrent_Queue *queue) { - return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, std::move(queue))); + return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, queue)); } labsat23_source::labsat23_source(const char *signal_file_basename, int channel_selector, - std::shared_ptr> queue) : gr::block("labsat23_source", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(1, 1, sizeof(gr_complex))), - d_queue(std::move(queue)) + Concurrent_Queue *queue) : gr::block("labsat23_source", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(gr_complex))), + d_queue(queue) { if (channel_selector < 1 or channel_selector > 2) { @@ -60,16 +60,15 @@ labsat23_source::labsat23_source(const char *signal_file_basename, std::string signal_file; this->set_output_multiple(8); signal_file = generate_filename(); - binary_input_file = new std::ifstream(signal_file.c_str(), std::ios::in | std::ios::binary); + binary_input_file.open(signal_file.c_str(), std::ios::in | std::ios::binary); - if (binary_input_file->is_open()) + if (binary_input_file.is_open()) { std::cout << "Labsat file source is reading samples from " << signal_file << std::endl; } else { std::cout << "Labsat file " << signal_file << " could not be opened!" << std::endl; - delete binary_input_file; exit(1); } } @@ -79,9 +78,9 @@ labsat23_source::~labsat23_source() { try { - if (binary_input_file->is_open()) + if (binary_input_file.is_open()) { - binary_input_file->close(); + binary_input_file.close(); } } catch (const std::ifstream::failure &e) @@ -92,7 +91,6 @@ labsat23_source::~labsat23_source() { std::cerr << e.what() << '\n'; } - delete binary_input_file; } @@ -202,10 +200,10 @@ int labsat23_source::general_work(int noutput_items, if (d_header_parsed == false) { - if (binary_input_file->eof() == false) + if (binary_input_file.eof() == false) { std::array memblock{}; - binary_input_file->read(memblock.data(), 1024); + binary_input_file.read(memblock.data(), 1024); // parse Labsat header // check preamble int byte_counter = 0; @@ -392,8 +390,8 @@ int labsat23_source::general_work(int noutput_items, // end of header d_header_parsed = true; // seek file to the first signal sample - binary_input_file->clear(); - binary_input_file->seekg(header_bytes, binary_input_file->beg); + binary_input_file.clear(); + binary_input_file.seekg(header_bytes, binary_input_file.beg); return 0; } std::cout << "Labsat file header error: section 2 is not available." << std::endl; @@ -419,8 +417,8 @@ int labsat23_source::general_work(int noutput_items, if (n_int16_to_read > 0) { std::vector memblock(n_int16_to_read); - binary_input_file->read(reinterpret_cast(memblock.data()), n_int16_to_read * 2); - n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16 + binary_input_file.read(reinterpret_cast(memblock.data()), n_int16_to_read * 2); + n_int16_to_read = binary_input_file.gcount() / 2; // from bytes to int16 if (n_int16_to_read > 0) { int output_pointer = 0; @@ -438,9 +436,9 @@ int labsat23_source::general_work(int noutput_items, { std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; } - binary_input_file->close(); - binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); - if (binary_input_file->is_open()) + binary_input_file.close(); + binary_input_file.open(generate_filename().c_str(), std::ios::in | std::ios::binary); + if (binary_input_file.is_open()) { std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; return 0; @@ -477,8 +475,8 @@ int labsat23_source::general_work(int noutput_items, if (n_int16_to_read > 0) { std::vector memblock(n_int16_to_read); - binary_input_file->read(reinterpret_cast(memblock.data()), n_int16_to_read * 2); - n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16 + binary_input_file.read(reinterpret_cast(memblock.data()), n_int16_to_read * 2); + n_int16_to_read = binary_input_file.gcount() / 2; // from bytes to int16 if (n_int16_to_read > 0) { int output_pointer = 0; @@ -496,9 +494,9 @@ int labsat23_source::general_work(int noutput_items, { std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl; } - binary_input_file->close(); - binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary); - if (binary_input_file->is_open()) + binary_input_file.close(); + binary_input_file.open(generate_filename().c_str(), std::ios::in | std::ios::binary); + if (binary_input_file.is_open()) { std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl; return 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h index 0a19a2ceb..40bbee142 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h @@ -43,7 +43,7 @@ using labsat23_source_sptr = boost::shared_ptr; labsat23_source_sptr labsat23_make_source_sptr( const char *signal_file_basename, int channel_selector, - std::shared_ptr> queue); + Concurrent_Queue *queue); /*! * \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex @@ -62,11 +62,11 @@ private: friend labsat23_source_sptr labsat23_make_source_sptr( const char *signal_file_basename, int channel_selector, - std::shared_ptr> queue); + Concurrent_Queue *queue); labsat23_source(const char *signal_file_basename, int channel_selector, - std::shared_ptr> queue); + Concurrent_Queue *queue); std::string generate_filename(); void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type); @@ -77,10 +77,10 @@ private: int d_current_file_number; uint8_t d_labsat_version; std::string d_signal_file_basename; - std::ifstream *binary_input_file; + std::ifstream binary_input_file; uint8_t d_ref_clock; uint8_t d_bits_per_sample; - std::shared_ptr> d_queue; + Concurrent_Queue *d_queue; }; #endif // GNSS_SDR_LABSAT23_SOURCE_H diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 94f847689..f30930302 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -180,8 +180,8 @@ bool config_ad9361_rx_local(uint64_t bandwidth_, bool quadrature_, bool rfdc_, bool bbdc_, - std::string filter_source_, - std::string filter_filename_, + std::string filter_source_, // NOLINT(performance-unnecessary-value-param) + std::string filter_filename_, // NOLINT(performance-unnecessary-value-param) float Fpass_, float Fstop_) diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc index a13102301..b9048dace 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc @@ -31,42 +31,43 @@ Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, + Concurrent_Queue* queue, bool stop_flowgraph) : gr::sync_block("valve", gr::io_signature::make(1, 20, sizeof_stream_item), gr::io_signature::make(1, 20, sizeof_stream_item)), d_nitems(nitems), d_ncopied_items(0), - d_queue(std::move(queue)), + d_queue(queue), d_stop_flowgraph(stop_flowgraph) { d_open_valve = false; } + #if GNURADIO_USES_STD_POINTERS -std::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue, bool stop_flowgraph) +std::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue, bool stop_flowgraph) { - std::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph)); + std::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph)); return valve_; } -std::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue) +std::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue) { - std::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true)); + std::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, true)); return valve_; } #else -boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue, bool stop_flowgraph) +boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue, bool stop_flowgraph) { - boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph)); + boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph)); return valve_; } -boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue) +boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue) { - boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true)); + boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, true)); return valve_; } #endif @@ -79,8 +80,8 @@ void Gnss_Sdr_Valve::open_valve() int Gnss_Sdr_Valve::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) { if (d_open_valve == false) { diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.h b/src/algorithms/signal_source/libs/gnss_sdr_valve.h index 61b1f9584..b2aa7559f 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.h +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.h @@ -41,23 +41,23 @@ class Gnss_Sdr_Valve; std::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue); + Concurrent_Queue* queue); std::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, + Concurrent_Queue* queue, bool stop_flowgraph); #else boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue); + Concurrent_Queue* queue); boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, + Concurrent_Queue* queue, bool stop_flowgraph); #endif @@ -71,40 +71,40 @@ public: void open_valve(); int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items); private: #if GNURADIO_USES_STD_POINTERS friend std::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue); + Concurrent_Queue* queue); friend std::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, + Concurrent_Queue* queue, bool stop_flowgraph); #else friend boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue); + Concurrent_Queue* queue); friend boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, + Concurrent_Queue* queue, bool stop_flowgraph); #endif Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, - std::shared_ptr> queue, bool stop_flowgraph); + Concurrent_Queue* queue, bool stop_flowgraph); uint64_t d_nitems; uint64_t d_ncopied_items; - std::shared_ptr> d_queue; + Concurrent_Queue* d_queue; bool d_stop_flowgraph; bool d_open_valve; }; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index d645720bb..136716f8f 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -5,13 +5,15 @@ * Luis Esteve, 2012. luis(at)epsilon-formacion.com * Javier Arribas, 2011. jarribas(at)cttc.es * Marc Majoral, 2018. mmajoral(at)cttc.es + * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es * * This class encapsulates the complexity behind the instantiation * of GNSS blocks. * - * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * ----------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -20,7 +22,7 @@ * * SPDX-License-Identifier: GPL-3.0-or-later * - * ------------------------------------------------------------------------- + * ----------------------------------------------------------------------------- */ @@ -62,6 +64,7 @@ #include "glonass_l2_ca_pcps_acquisition.h" #include "glonass_l2_ca_telemetry_decoder.h" #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_kf_tracking.h" #include "gps_l1_ca_pcps_acquisition.h" @@ -165,7 +168,7 @@ std::unique_ptr GNSSBlockFactory::GetSignalSource( - const std::shared_ptr& configuration, const std::shared_ptr> queue, int ID) // NOLINT(performance-unnecessary-value-param) + ConfigurationInterface* configuration, Concurrent_Queue* queue, int ID) // NOLINT(performance-unnecessary-value-param) { std::string default_implementation = "File_Signal_Source"; std::string role = "SignalSource"; // backwards compatibility for old conf files @@ -187,7 +190,7 @@ std::unique_ptr GNSSBlockFactory::GetSignalSource( std::unique_ptr GNSSBlockFactory::GetSignalConditioner( - const std::shared_ptr& configuration, int ID) + ConfigurationInterface* configuration, int ID) { std::string default_implementation = "Pass_Through"; // backwards compatibility for old conf files @@ -235,25 +238,25 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( if (signal_conditioner == "Array_Signal_Conditioner") { // instantiate the array version - std::unique_ptr conditioner_(new ArraySignalConditioner(configuration.get(), + std::unique_ptr conditioner_ = std::make_unique(configuration, GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1), GetBlock(configuration, role_inputfilter, input_filter, 1, 1), GetBlock(configuration, role_resampler, resampler, 1, 1), - role_conditioner, "Signal_Conditioner")); + role_conditioner, "Signal_Conditioner"); return conditioner_; } // single-antenna version - std::unique_ptr conditioner_(new SignalConditioner(configuration.get(), + std::unique_ptr conditioner_ = std::make_unique(configuration, GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1), GetBlock(configuration, role_inputfilter, input_filter, 1, 1), GetBlock(configuration, role_resampler, resampler, 1, 1), - role_conditioner, "Signal_Conditioner")); + role_conditioner, "Signal_Conditioner"); return conditioner_; } -std::unique_ptr GNSSBlockFactory::GetObservables(const std::shared_ptr& configuration) +std::unique_ptr GNSSBlockFactory::GetObservables(ConfigurationInterface* configuration) { std::string default_implementation = "Hybrid_Observables"; std::string implementation = configuration->property("Observables.implementation", default_implementation); @@ -281,7 +284,7 @@ std::unique_ptr GNSSBlockFactory::GetObservables(const std:: } -std::unique_ptr GNSSBlockFactory::GetPVT(const std::shared_ptr& configuration) +std::unique_ptr GNSSBlockFactory::GetPVT(ConfigurationInterface* configuration) { std::string default_implementation = "RTKLIB_PVT"; std::string implementation = configuration->property("PVT.implementation", default_implementation); @@ -302,9 +305,9 @@ std::unique_ptr GNSSBlockFactory::GetPVT(const std::shared_p // ********* GPS L1 C/A CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_1C( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { // "appendix" is added to the "role" with the aim of Acquisition, Tracking and Telemetry Decoder adapters // can find their specific configurations when they read the config @@ -343,8 +346,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_1C" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_1C" + appendix2 + ".item_type", default_item_type); @@ -352,17 +353,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1C" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1C" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1C" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "1C", queue)); + "Channel", "1C", queue); return channel_; } @@ -370,9 +370,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( // ********* GPS L2C (M) CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_2S( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; @@ -407,8 +407,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_2S" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_2S" + appendix2 + ".item_type", default_item_type); @@ -416,17 +414,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_2S" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_2S" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_2S" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "2S", queue)); + "Channel", "2S", queue); return channel_; } @@ -434,9 +431,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( // ********* GALILEO E1 B CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_1B( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -474,8 +471,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_1B" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_1B" + appendix2 + ".item_type", default_item_type); @@ -483,17 +478,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1B" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1B" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1B" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "1B", queue)); + "Channel", "1B", queue); return channel_; } @@ -501,9 +495,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( // ********* GALILEO E5a CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_5X( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -541,8 +535,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_5X" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_5X" + appendix2 + ".item_type", default_item_type); @@ -550,17 +542,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_5X" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_5X" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_5X" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "5X", queue)); + "Channel", "5X", queue); return channel_; } @@ -568,9 +559,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( // ********* GLONASS L1 C/A CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_1G( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -609,8 +600,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_1G" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_1G" + appendix2 + ".item_type", default_item_type); @@ -618,17 +607,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1G" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1G" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1G" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "1G", queue)); + "Channel", "1G", queue); return channel_; } @@ -636,9 +624,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( // ********* GLONASS L2 C/A CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_2G( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -677,8 +665,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_2G" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_2G" + appendix2 + ".item_type", default_item_type); @@ -686,17 +672,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_2G" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_2G" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_2G" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "2G", queue)); + "Channel", "2G", queue); return channel_; } @@ -704,9 +689,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( // ********* GPS L5 CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_L5( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -744,8 +729,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_L5" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_L5" + appendix2 + ".item_type", default_item_type); @@ -753,17 +736,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_L5" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_L5" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_L5" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "L5", queue)); + "Channel", "L5", queue); return channel_; } @@ -771,9 +753,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( // ********* BeiDou B1I CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_B1( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -811,8 +793,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B1( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_B1" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_B1" + appendix2 + ".item_type", default_item_type); @@ -820,17 +800,16 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B1( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_B1" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_B1" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_B1" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "B1", queue)); + "Channel", "B1", queue); return channel_; } @@ -838,9 +817,9 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B1( // ********* BeiDou B3I CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_B3( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue) + Concurrent_Queue* queue) { std::stringstream stream; stream << channel; @@ -878,8 +857,6 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B3( appendix3 = ""; } // Automatically detect input data type - std::shared_ptr config; - config = std::make_shared(); std::string default_item_type = "gr_complex"; std::string acq_item_type = configuration->property("Acquisition_B3" + appendix1 + ".item_type", default_item_type); std::string trk_item_type = configuration->property("Tracking_B3" + appendix2 + ".item_type", default_item_type); @@ -887,24 +864,23 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B3( { LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; } - config->set_property("Channel.item_type", acq_item_type); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_B3" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_B3" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_B3" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, + std::unique_ptr channel_ = std::make_unique(configuration, channel, std::move(acq_), std::move(trk_), std::move(tlm_), - "Channel", "B3", queue)); + "Channel", "B3", queue); return channel_; } std::unique_ptr>> GNSSBlockFactory::GetChannels( - const std::shared_ptr& configuration, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) + ConfigurationInterface* configuration, Concurrent_Queue* queue) // NOLINT(performance-unnecessary-value-param) { std::string default_implementation = "Pass_Through"; std::string tracking_implementation; @@ -933,7 +909,7 @@ std::unique_ptr>> GNSSBlockFacto Channels_B1_count + Channels_B3_count; - std::unique_ptr>> channels(new std::vector>(total_channels)); + auto channels = std::make_unique>>(total_channels); try { // **************** GPS L1 C/A CHANNELS ********************** @@ -1221,17 +1197,17 @@ std::unique_ptr>> GNSSBlockFacto * (see below) */ std::unique_ptr GNSSBlockFactory::GetBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, - unsigned int out_streams, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) + unsigned int out_streams, Concurrent_Queue* queue) // NOLINT(performance-unnecessary-value-param) { std::unique_ptr block; // PASS THROUGH ------------------------------------------------------------ if (implementation == "Pass_Through") { - std::unique_ptr block_(new Pass_Through(configuration.get(), role, in_streams, out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } @@ -1240,8 +1216,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new FileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } @@ -1255,8 +1231,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new MultichannelFileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } @@ -1271,8 +1247,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new CustomUDPSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } @@ -1287,8 +1263,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new NsrFileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1301,8 +1277,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new TwoBitCpxFileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1315,8 +1291,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new TwoBitPackedFileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1329,8 +1305,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new SpirFileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1343,8 +1319,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new SpirGSS6450FileSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1357,8 +1333,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new RtlTcpSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } catch (const std::exception& e) @@ -1371,8 +1347,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( { try { - std::unique_ptr block_(new LabsatSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } @@ -1385,16 +1361,16 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if UHD_DRIVER else if (implementation == "UHD_Signal_Source") { - std::unique_ptr block_(new UhdSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif #if GN3S_DRIVER else if (implementation == "GN3S_Signal_Source") { - std::unique_ptr block_(new Gn3sSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1402,8 +1378,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if RAW_ARRAY_DRIVER else if (implementation == "Raw_Array_Signal_Source") { - std::unique_ptr block_(new RawArraySignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1411,8 +1387,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if OSMOSDR_DRIVER else if (implementation == "Osmosdr_Signal_Source") { - std::unique_ptr block_(new OsmosdrSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1420,8 +1396,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if PLUTOSDR_DRIVER else if (implementation == "Plutosdr_Signal_Source") { - std::unique_ptr block_(new PlutosdrSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1429,8 +1405,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if FMCOMMS2_DRIVER else if (implementation == "Fmcomms2_Signal_Source") { - std::unique_ptr block_(new Fmcomms2SignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1438,8 +1414,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #if FLEXIBAND_DRIVER else if (implementation == "Flexiband_Signal_Source") { - std::unique_ptr block_(new FlexibandSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1447,447 +1423,447 @@ std::unique_ptr GNSSBlockFactory::GetBlock( // DATA TYPE ADAPTER ----------------------------------------------------------- else if (implementation == "Byte_To_Short") { - std::unique_ptr block_(new ByteToShort(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Ibyte_To_Cbyte") { - std::unique_ptr block_(new IbyteToCbyte(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Ibyte_To_Cshort") { - std::unique_ptr block_(new IbyteToCshort(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Ibyte_To_Complex") { - std::unique_ptr block_(new IbyteToComplex(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Ishort_To_Cshort") { - std::unique_ptr block_(new IshortToCshort(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Ishort_To_Complex") { - std::unique_ptr block_(new IshortToComplex(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } // INPUT FILTER ---------------------------------------------------------------- else if (implementation == "Fir_Filter") { - std::unique_ptr block_(new FirFilter(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Freq_Xlating_Fir_Filter") { - std::unique_ptr block_(new FreqXlatingFirFilter(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Beamformer_Filter") { - std::unique_ptr block_(new BeamformerFilter(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Pulse_Blanking_Filter") { - std::unique_ptr block_(new PulseBlankingFilter(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Notch_Filter") { - std::unique_ptr block_(new NotchFilter(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Notch_Filter_Lite") { - std::unique_ptr block_(new NotchFilterLite(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } // RESAMPLER ------------------------------------------------------------------- else if (implementation == "Direct_Resampler") { - std::unique_ptr block_(new DirectResamplerConditioner(configuration.get(), role, - in_streams, out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, + in_streams, out_streams); block = std::move(block_); } else if ((implementation == "Fractional_Resampler") || (implementation == "Mmse_Resampler")) { - std::unique_ptr block_(new MmseResamplerConditioner(configuration.get(), role, - in_streams, out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, + in_streams, out_streams); block = std::move(block_); } // ACQUISITION BLOCKS --------------------------------------------------------- else if (implementation == "GPS_L1_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_PCPS_Assisted_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsAssistedAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_PCPS_Tong_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsTongAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if OPENCL_BLOCKS else if (implementation == "GPS_L1_CA_PCPS_OpenCl_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsOpenClAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_PCPS_QuickSync_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsQuickSyncAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L2_M_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL2MPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL2MPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L5i_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL5iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL5iPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") { - std::unique_ptr block_(new GalileoE1PcpsAmbiguousAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1Pcps8msAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsTongAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsCccwsrAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF") { - std::unique_ptr block_(new GalileoE5aNoncoherentIQAcquisitionCaf(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Pcps_Acquisition") { - std::unique_ptr block_(new GalileoE5aPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") { - std::unique_ptr block_(new GalileoE5aPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsQuickSyncAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L1_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GlonassL1CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GlonassL2CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_PCPS_Acquisition") { - std::unique_ptr block_(new BeidouB1iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_PCPS_Acquisition") { - std::unique_ptr block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } // TRACKING BLOCKS ------------------------------------------------------------- else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GpsL1CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_KF_Tracking") { - std::unique_ptr block_(new GpsL1CaKfTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GpsL1CaDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_TCP_CONNECTOR_Tracking") { - std::unique_ptr block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") { - std::unique_ptr block_(new GpsL2MDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GpsL2MDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if ((implementation == "GPS_L5i_DLL_PLL_Tracking") or (implementation == "GPS_L5_DLL_PLL_Tracking")) { - std::unique_ptr block_(new GpsL5DllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) { - std::unique_ptr block_(new GpsL5DllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif #if CUDA_GPU_ACCEL else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_GPU") { - std::unique_ptr block_(new GpsL1CaDllPllTrackingGPU(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking") { - std::unique_ptr block_(new GalileoE1DllPllVemlTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") { - std::unique_ptr block_(new GalileoE1DllPllVemlTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_TCP_CONNECTOR_Tracking") { - std::unique_ptr block_(new GalileoE1TcpConnectorTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking") { - std::unique_ptr block_(new GalileoE5aDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GalileoE5aDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GLONASS_L1_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GlonassL1CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking") { - std::unique_ptr block_(new GlonassL1CaDllPllCAidTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GlonassL2CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_DLL_PLL_C_Aid_Tracking") { - std::unique_ptr block_(new GlonassL2CaDllPllCAidTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_DLL_PLL_Tracking") { - std::unique_ptr block_(new BeidouB1iDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking") { - std::unique_ptr block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } // TELEMETRY DECODERS ---------------------------------------------------------- else if (implementation == "GPS_L1_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL1CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L2C_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL2CTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L5_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL5TelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1B_Telemetry_Decoder") { - std::unique_ptr block_(new GalileoE1BTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "SBAS_L1_Telemetry_Decoder") { - std::unique_ptr block_(new SbasL1TelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Telemetry_Decoder") { - std::unique_ptr block_(new GalileoE5aTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L1_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GlonassL1CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GlonassL2CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_Telemetry_Decoder") { - std::unique_ptr block_(new BeidouB1iTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_Telemetry_Decoder") { - std::unique_ptr block_(new BeidouB3iTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } @@ -1895,16 +1871,16 @@ std::unique_ptr GNSSBlockFactory::GetBlock( else if ((implementation == "Hybrid_Observables") || (implementation == "GPS_L1_CA_Observables") || (implementation == "GPS_L2C_Observables") || (implementation == "Galileo_E5A_Observables")) { - std::unique_ptr block_(new HybridObservables(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } // PVT ------------------------------------------------------------------------- else if ((implementation == "RTKLIB_PVT") || (implementation == "GPS_L1_CA_PVT") || (implementation == "Galileo_E1_PVT") || (implementation == "Hybrid_PVT")) { - std::unique_ptr block_(new Rtklib_Pvt(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } @@ -1913,8 +1889,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( // in post-processing mode, the receiver is configured and ready when the DMA starts sending samples to the receiver. else if (implementation == "Ad9361_Fpga_Signal_Source") { - std::unique_ptr block_(new Ad9361FpgaSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); block = std::move(block_); } #endif @@ -1937,7 +1913,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( */ std::unique_ptr GNSSBlockFactory::GetAcqBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams) @@ -1946,161 +1922,161 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( // ACQUISITION BLOCKS --------------------------------------------------------- if (implementation == "GPS_L1_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_PCPS_Assisted_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsAssistedAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_PCPS_Tong_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsTongAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if OPENCL_BLOCKS else if (implementation == "GPS_L1_CA_PCPS_OpenCl_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsOpenClAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") { - std::unique_ptr block_(new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_PCPS_QuickSync_Acquisition") { - std::unique_ptr block_(new GpsL1CaPcpsQuickSyncAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L2_M_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL2MPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL2MPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L5i_PCPS_Acquisition") { - std::unique_ptr block_(new GpsL5iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") { - std::unique_ptr block_(new GpsL5iPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") { - std::unique_ptr block_(new GalileoE1PcpsAmbiguousAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1Pcps8msAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsTongAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsCccwsrAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition") { - std::unique_ptr block_(new GalileoE1PcpsQuickSyncAmbiguousAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF") { - std::unique_ptr block_(new GalileoE5aNoncoherentIQAcquisitionCaf(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Pcps_Acquisition") { - std::unique_ptr block_(new GalileoE5aPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") { - std::unique_ptr block_(new GalileoE5aPcpsAcquisitionFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GLONASS_L1_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GlonassL1CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_PCPS_Acquisition") { - std::unique_ptr block_(new GlonassL2CaPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_PCPS_Acquisition") { - std::unique_ptr block_(new BeidouB1iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_PCPS_Acquisition") { - std::unique_ptr block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else @@ -2113,7 +2089,7 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( std::unique_ptr GNSSBlockFactory::GetTrkBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams) @@ -2123,134 +2099,134 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( // TRACKING BLOCKS ------------------------------------------------------------- if (implementation == "GPS_L1_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GpsL1CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L1_CA_KF_Tracking") { - std::unique_ptr block_(new GpsL1CaKfTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GpsL1CaDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L1_CA_TCP_CONNECTOR_Tracking") { - std::unique_ptr block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking") { - std::unique_ptr block_(new GalileoE1DllPllVemlTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") { - std::unique_ptr block_(new GalileoE1DllPllVemlTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "Galileo_E1_TCP_CONNECTOR_Tracking") { - std::unique_ptr block_(new GalileoE1TcpConnectorTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking") { - std::unique_ptr block_(new GalileoE5aDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GalileoE5aDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") { - std::unique_ptr block_(new GpsL2MDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") { - std::unique_ptr block_(new GpsL2MDllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if ((implementation == "GPS_L5i_DLL_PLL_Tracking") or (implementation == "GPS_L5_DLL_PLL_Tracking")) { - std::unique_ptr block_(new GpsL5DllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #if ENABLE_FPGA else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) { - std::unique_ptr block_(new GpsL5DllPllTrackingFpga(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif #if CUDA_GPU_ACCEL else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_GPU") { - std::unique_ptr block_(new GpsL1CaDllPllTrackingGPU(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } #endif else if (implementation == "GLONASS_L1_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GlonassL1CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking") { - std::unique_ptr block_(new GlonassL1CaDllPllCAidTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_DLL_PLL_Tracking") { - std::unique_ptr block_(new GlonassL2CaDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_DLL_PLL_C_Aid_Tracking") { - std::unique_ptr block_(new GlonassL2CaDllPllCAidTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_DLL_PLL_Tracking") { - std::unique_ptr block_(new BeidouB1iDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking") { - std::unique_ptr block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } @@ -2264,7 +2240,7 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( std::unique_ptr GNSSBlockFactory::GetTlmBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams) @@ -2274,62 +2250,62 @@ std::unique_ptr GNSSBlockFactory::GetTlmBlock( // TELEMETRY DECODERS ---------------------------------------------------------- if (implementation == "GPS_L1_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL1CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E1B_Telemetry_Decoder") { - std::unique_ptr block_(new GalileoE1BTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "SBAS_L1_Telemetry_Decoder") { - std::unique_ptr block_(new SbasL1TelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "Galileo_E5a_Telemetry_Decoder") { - std::unique_ptr block_(new GalileoE5aTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L2C_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL2CTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L1_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GlonassL1CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GLONASS_L2_CA_Telemetry_Decoder") { - std::unique_ptr block_(new GlonassL2CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "GPS_L5_Telemetry_Decoder") { - std::unique_ptr block_(new GpsL5TelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B1I_Telemetry_Decoder") { - std::unique_ptr block_(new BeidouB1iTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } else if (implementation == "BEIDOU_B3I_Telemetry_Decoder") { - std::unique_ptr block_(new BeidouB3iTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); block = std::move(block_); } diff --git a/src/core/receiver/gnss_block_factory.h b/src/core/receiver/gnss_block_factory.h index a669b8641..cdf89e8a2 100644 --- a/src/core/receiver/gnss_block_factory.h +++ b/src/core/receiver/gnss_block_factory.h @@ -4,14 +4,15 @@ * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com * Javier Arribas, 2011. jarribas(at)cttc.es - * Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es * * This class encapsulates the complexity behind the instantiation * of GNSS blocks. * - * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * ----------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -20,7 +21,7 @@ * * SPDX-License-Identifier: GPL-3.0-or-later * - * ------------------------------------------------------------------------- + * ----------------------------------------------------------------------------- */ #ifndef GNSS_SDR_BLOCK_FACTORY_H @@ -28,7 +29,7 @@ #include "concurrent_queue.h" #include -#include // for unique_ptr, shared_ptr +#include // for unique_ptr #include // for string #include // for vector @@ -48,77 +49,77 @@ public: GNSSBlockFactory() = default; ~GNSSBlockFactory() = default; - std::unique_ptr GetSignalSource(const std::shared_ptr& configuration, - const std::shared_ptr> queue, int ID = -1); // NOLINT(performance-unnecessary-value-param) + std::unique_ptr GetSignalSource(ConfigurationInterface* configuration, + Concurrent_Queue* queue, int ID = -1); // NOLINT(performance-unnecessary-value-param) - std::unique_ptr GetSignalConditioner(const std::shared_ptr& configuration, int ID = -1); + std::unique_ptr GetSignalConditioner(ConfigurationInterface* configuration, int ID = -1); - std::unique_ptr>> GetChannels(const std::shared_ptr& configuration, - const std::shared_ptr> queue); // NOLINT(performance-unnecessary-value-param) + std::unique_ptr>> GetChannels(ConfigurationInterface* configuration, + Concurrent_Queue* queue); // NOLINT(performance-unnecessary-value-param) - std::unique_ptr GetObservables(const std::shared_ptr& configuration); + std::unique_ptr GetObservables(ConfigurationInterface* configuration); - std::unique_ptr GetPVT(const std::shared_ptr& configuration); + std::unique_ptr GetPVT(ConfigurationInterface* configuration); /*! * \brief Returns the block with the required configuration and implementation */ - std::unique_ptr GetBlock(const std::shared_ptr& configuration, + std::unique_ptr GetBlock(ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams, - const std::shared_ptr> queue = nullptr); // NOLINT(performance-unnecessary-value-param) + Concurrent_Queue* queue = nullptr); // NOLINT(performance-unnecessary-value-param) private: - std::unique_ptr GetChannel_1C(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_1C(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_2S(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_2S(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_1B(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_1B(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_5X(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_5X(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_L5(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_L5(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_1G(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_1G(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_2G(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_2G(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_B1(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_B1(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); - std::unique_ptr GetChannel_B3(const std::shared_ptr& configuration, + std::unique_ptr GetChannel_B3(ConfigurationInterface* configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - const std::shared_ptr>& queue); + Concurrent_Queue* queue); std::unique_ptr GetAcqBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams); std::unique_ptr GetTrkBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams); std::unique_ptr GetTlmBlock( - const std::shared_ptr& configuration, + ConfigurationInterface* configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index f471ebf8a..cd09aee1e 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -3,13 +3,14 @@ * \brief Implementation of a GNSS receiver flow graph * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * Luis Esteve, 2012. luis(at)epsilon-formacion.com - * Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * Javier Arribas, 2018. javiarribas(at)gmail.com * + * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -34,6 +35,7 @@ #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_satellite.h" +#include "gnss_sdr_make_unique.h" #include "gnss_synchro_monitor.h" #include // for boost::lexical_cast #include // for boost::tokenizer @@ -52,7 +54,10 @@ #include // for std::shared_ptr #include // for set #include // for invalid_argument -#include // for thread +#include // for std::thread +#include // for std::move + + #ifdef GR_GREATER_38 #include #else @@ -63,12 +68,12 @@ #define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8 -GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) +GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) { connected_ = false; running_ = false; configuration_ = std::move(configuration); - queue_ = queue; + queue_ = std::move(queue); multiband_ = GNSSFlowgraph::is_multiband(); init(); } @@ -1482,7 +1487,7 @@ void GNSSFlowgraph::init() /* * Instantiates the receiver blocks */ - std::unique_ptr block_factory_(new GNSSBlockFactory()); + auto block_factory_ = std::make_unique(); channels_status_ = channel_status_msg_receiver_make(); @@ -1497,7 +1502,7 @@ void GNSSFlowgraph::init() for (int i = 0; i < sources_count_; i++) { std::cout << "Creating source " << i << std::endl; - sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, i)); + sig_source_.push_back(block_factory_->GetSignalSource(configuration_.get(), queue_.get(), i)); // TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface. // Include GetRFChannels in the interface to avoid read config parameters here // read the number of RF channels for each front-end @@ -1505,7 +1510,7 @@ void GNSSFlowgraph::init() std::cout << "RF Channels " << RF_Channels << std::endl; for (int j = 0; j < RF_Channels; j++) { - sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID)); + sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), signal_conditioner_ID)); signal_conditioner_ID++; } } @@ -1513,7 +1518,7 @@ void GNSSFlowgraph::init() else { // backwards compatibility for old config files - sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, -1)); + sig_source_.push_back(block_factory_->GetSignalSource(configuration_.get(), queue_.get(), -1)); // TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface. // Include GetRFChannels in the interface to avoid read config parameters here // read the number of RF channels for each front-end @@ -1522,18 +1527,18 @@ void GNSSFlowgraph::init() { for (int j = 0; j < RF_Channels; j++) { - sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID)); + sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), signal_conditioner_ID)); signal_conditioner_ID++; } } else { // old config file, single signal source and single channel, not specified - sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, -1)); + sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), -1)); } } - observables_ = block_factory_->GetObservables(configuration_); + observables_ = block_factory_->GetObservables(configuration_.get()); // Mark old implementations as deprecated std::string default_str("Default"); std::string obs_implementation = configuration_->property("Observables.implementation", default_str); @@ -1544,7 +1549,7 @@ void GNSSFlowgraph::init() std::cout << "Please update your configuration file." << std::endl; } - pvt_ = block_factory_->GetPVT(configuration_); + pvt_ = block_factory_->GetPVT(configuration_.get()); // Mark old implementations as deprecated std::string pvt_implementation = configuration_->property("PVT.implementation", default_str); if ((pvt_implementation == "GPS_L1_CA_PVT") || (pvt_implementation == "Galileo_E1_PVT") || (pvt_implementation == "Hybrid_PVT")) @@ -1553,7 +1558,7 @@ void GNSSFlowgraph::init() std::cout << "Please update your configuration file." << std::endl; } - std::shared_ptr>> channels = block_factory_->GetChannels(configuration_, queue_); + auto channels = block_factory_->GetChannels(configuration_.get(), queue_.get()); channels_count_ = channels->size(); for (unsigned int i = 0; i < channels_count_; i++) diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 89e64d8b1..d678e9781 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -3,15 +3,16 @@ * \brief Interface of a GNSS receiver flow graph. * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com - * Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * * It contains a signal source, * a signal conditioner, a set of channels, an observables block and a pvt. * - * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * ----------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -20,7 +21,7 @@ * * SPDX-License-Identifier: GPL-3.0-or-later * - * ------------------------------------------------------------------------- + * ----------------------------------------------------------------------------- */ #ifndef GNSS_SDR_GNSS_FLOWGRAPH_H @@ -61,7 +62,7 @@ public: /*! * \brief Constructor that initializes the receiver flow graph */ - GNSSFlowgraph(std::shared_ptr configuration, const std::shared_ptr> queue); // NOLINT(performance-unnecessary-value-param) + GNSSFlowgraph(std::shared_ptr configuration, std::shared_ptr> queue); // NOLINT(performance-unnecessary-value-param) /*! * \brief Destructor diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 575494c3a..b6c01d75e 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -27,6 +27,7 @@ endif() target_link_libraries(gnss-sdr PRIVATE + algorithms_libs core_receiver Boost::headers Boost::thread diff --git a/src/main/main.cc b/src/main/main.cc index 095f23407..cb9595b7a 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -31,6 +31,7 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "control_thread.h" +#include "gnss_sdr_make_unique.h" #include "gps_acq_assist.h" #include // for diagnostic_information #include // for exception @@ -139,7 +140,7 @@ int main(int argc, char** argv) int return_code = 0; try { - std::unique_ptr control_thread(new ControlThread()); + auto control_thread = std::make_unique(); // record startup time start = std::chrono::system_clock::now(); return_code = control_thread->run(); diff --git a/src/tests/unit-tests/arithmetic/code_generation_test.cc b/src/tests/unit-tests/arithmetic/code_generation_test.cc index ec59c4c25..850e97a69 100644 --- a/src/tests/unit-tests/arithmetic/code_generation_test.cc +++ b/src/tests/unit-tests/arithmetic/code_generation_test.cc @@ -20,19 +20,14 @@ #include "gnss_signal_processing.h" #include "gps_sdr_signal_processing.h" +#include #include #include - -#if HAS_STD_SPAN -#include -namespace gsl = std; -#else -#include -#endif +#include TEST(CodeGenerationTest, CodeGenGPSL1Test) { - auto* _dest = new std::complex[1023]; + std::array, 1023> _dest{}; signed int _prn = 1; unsigned int _chip_shift = 4; @@ -43,13 +38,12 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test) for (int i = 0; i < iterations; i++) { - gps_l1_ca_code_gen_complex(own::span>(_dest, 1023), _prn, _chip_shift); + gps_l1_ca_code_gen_complex(_dest, _prn, _chip_shift); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; - delete[] _dest; ASSERT_LE(0, elapsed_seconds.count()); std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -63,7 +57,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest) const signed int _codeFreqBasis = 1023000; // Hz const signed int _codeLength = 1023; int _samplesPerCode = round(_fs / static_cast(_codeFreqBasis / _codeLength)); - auto* _dest = new std::complex[_samplesPerCode]; + std::vector> _dest(_samplesPerCode); int iterations = 1000; @@ -72,13 +66,12 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest) for (int i = 0; i < iterations; i++) { - gps_l1_ca_code_gen_complex_sampled(own::span>(_dest, _samplesPerCode), _prn, _fs, _chip_shift); + gps_l1_ca_code_gen_complex_sampled(_dest, _prn, _fs, _chip_shift); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; - delete[] _dest; ASSERT_LE(0, elapsed_seconds.count()); std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } @@ -91,7 +84,7 @@ TEST(CodeGenerationTest, ComplexConjugateTest) const signed int _codeFreqBasis = 1023000; // Hz const signed int _codeLength = 1023; int _samplesPerCode = round(_fs / static_cast(_codeFreqBasis / _codeLength)); - auto* _dest = new std::complex[_samplesPerCode]; + std::vector> _dest(_samplesPerCode); int iterations = 1000; @@ -100,13 +93,12 @@ TEST(CodeGenerationTest, ComplexConjugateTest) for (int i = 0; i < iterations; i++) { - complex_exp_gen_conj(own::span>(_dest, _samplesPerCode), _f, _fs); + complex_exp_gen_conj(_dest, _f, _fs); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; - delete[] _dest; ASSERT_LE(0, elapsed_seconds.count()); std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } diff --git a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc index 1ba901475..739e56f30 100644 --- a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc +++ b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc @@ -24,12 +24,6 @@ #include #include -#if HAS_STD_SPAN -#include -namespace gsl = std; -#else -#include -#endif DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); @@ -110,13 +104,14 @@ TEST(ComplexCarrierTest, C11ComplexImplementation) TEST(ComplexCarrierTest, OwnComplexImplementation) { - auto* output = new std::complex[FLAGS_size_carrier_test]; + std::vector> output(FLAGS_size_carrier_test); + double _f = 2000.0; double _fs = 2000000.0; std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - complex_exp_gen(own::span>(output, static_cast(FLAGS_size_carrier_test)), _f, _fs); + complex_exp_gen(output, _f, _fs); end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; @@ -130,7 +125,7 @@ TEST(ComplexCarrierTest, OwnComplexImplementation) { mag[i] = output[i] * std::conj(output[i]); } - delete[] output; + for (int i = 0; i < FLAGS_size_carrier_test; i++) { ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001); diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index d6c16d09e..24e616ed4 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -18,6 +18,7 @@ * ------------------------------------------------------------------------- */ +#include "gnss_sdr_make_unique.h" #include "gnuplot_i.h" #include "test_flags.h" #include @@ -72,9 +73,8 @@ TEST(FFTLengthTest, MeasureExecutionTime) EXPECT_NO_THROW( for (it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it) { - gr::fft::fft_complex* d_fft; d_fft_size = *it; - d_fft = new gr::fft::fft_complex(d_fft_size, true); + auto d_fft = std::make_unique(d_fft_size, true); std::generate_n(d_fft->get_inbuf(), d_fft_size, gen); @@ -88,7 +88,6 @@ TEST(FFTLengthTest, MeasureExecutionTime) double exec_time = elapsed_seconds.count() / static_cast(FLAGS_fft_iterations_test); execution_times.push_back(exec_time * 1e3); std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl; - delete d_fft; if ((d_fft_size & (d_fft_size - 1)) == 0) // if it is a power of two { diff --git a/src/tests/unit-tests/arithmetic/fft_speed_test.cc b/src/tests/unit-tests/arithmetic/fft_speed_test.cc index a96228b91..e919da746 100644 --- a/src/tests/unit-tests/arithmetic/fft_speed_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_speed_test.cc @@ -19,6 +19,7 @@ * ------------------------------------------------------------------------- */ +#include "gnss_sdr_make_unique.h" #include #include #include @@ -38,8 +39,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) for (unsigned int fft_size : fft_sizes) { d_fft_size = fft_size; - gr::fft::fft_complex* d_gr_fft; - d_gr_fft = new gr::fft::fft_complex(d_fft_size, true); + auto d_gr_fft = std::make_unique(d_fft_size, true); arma::arma_rng::set_seed_random(); arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn(); arma::cx_fvec d_arma_fft_result(d_fft_size); @@ -54,7 +54,6 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) elapsed_seconds = end - start; d_execution_time = elapsed_seconds.count() / static_cast(FLAGS_fft_speed_iterations_test); std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl; - delete d_gr_fft; start = std::chrono::system_clock::now(); for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) diff --git a/src/tests/unit-tests/arithmetic/preamble_correlator_test.cc b/src/tests/unit-tests/arithmetic/preamble_correlator_test.cc index 76ca3d681..467379ff7 100644 --- a/src/tests/unit-tests/arithmetic/preamble_correlator_test.cc +++ b/src/tests/unit-tests/arithmetic/preamble_correlator_test.cc @@ -19,6 +19,7 @@ */ #include "GPS_L1_CA.h" +#include #include #include #include @@ -44,10 +45,8 @@ TEST(PreambleCorrelationTest, TestMethods) std::random_device rd; std::default_random_engine e2(rd()); std::uniform_real_distribution<> dist(-1.0, 1.0); - for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++) - { - d_symbol_history[i] = dist(e2); - } + + std::generate(d_symbol_history.begin(), d_symbol_history.end(), [&dist, &e2]() { return dist(e2); }); int32_t n = 0; for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++) diff --git a/src/tests/unit-tests/control-plane/control_thread_test.cc b/src/tests/unit-tests/control-plane/control_thread_test.cc index 1fb3f4209..33d19c6f8 100644 --- a/src/tests/unit-tests/control-plane/control_thread_test.cc +++ b/src/tests/unit-tests/control-plane/control_thread_test.cc @@ -24,6 +24,7 @@ #include "command_event.h" #include "concurrent_queue.h" #include "control_thread.h" +#include "gnss_sdr_make_unique.h" #include "in_memory_configuration.h" #include #include @@ -167,7 +168,7 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/) config->set_property("PVT.item_type", "gr_complex"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - std::unique_ptr control_thread2(new ControlThread(config)); + auto control_thread2 = std::make_unique(config); std::shared_ptr> control_queue2 = std::make_shared>(); control_queue2->push(pmt::make_any(channel_event_make(0, 0))); @@ -176,7 +177,6 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/) control_queue2->push(pmt::make_any(channel_event_make(3, 0))); control_queue2->push(pmt::make_any(command_event_make(200, 0))); - control_thread2->set_control_queue(control_queue2); try diff --git a/src/tests/unit-tests/control-plane/file_configuration_test.cc b/src/tests/unit-tests/control-plane/file_configuration_test.cc index 371d072fc..d42c6e292 100644 --- a/src/tests/unit-tests/control-plane/file_configuration_test.cc +++ b/src/tests/unit-tests/control-plane/file_configuration_test.cc @@ -20,6 +20,7 @@ #include "file_configuration.h" +#include "gnss_sdr_make_unique.h" #include @@ -28,7 +29,7 @@ TEST(FileConfigurationTest, OverridedProperties) std::string path = std::string(TEST_PATH); std::string filename = path + "data/config_file_sample.txt"; // std::shared_ptr configuration = std::make_shared(filename); - std::unique_ptr configuration(new FileConfiguration(filename)); + std::unique_ptr configuration = std::make_unique(filename); std::string default_value = "default_value"; std::string value = configuration->property("NotThere", default_value); EXPECT_STREQ("default_value", value.c_str()); @@ -40,7 +41,7 @@ TEST(FileConfigurationTest, OverridedProperties) TEST(FileConfigurationTest, LoadFromNonExistentFile) { - std::unique_ptr configuration(new FileConfiguration("./i_dont_exist.conf")); + std::unique_ptr configuration = std::make_unique("./i_dont_exist.conf"); std::string default_value = "default_value"; std::string value = configuration->property("whatever.whatever", default_value); EXPECT_STREQ("default_value", value.c_str()); @@ -51,7 +52,7 @@ TEST(FileConfigurationTest, PropertyDoesNotExist) { std::string path = std::string(TEST_PATH); std::string filename = path + "data/config_file_sample.txt"; - std::unique_ptr configuration(new FileConfiguration(filename)); + std::unique_ptr configuration = std::make_unique(filename); std::string default_value = "default_value"; std::string value = configuration->property("whatever.whatever", default_value); EXPECT_STREQ("default_value", value.c_str()); diff --git a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc index 659980c73..0f0ef62f9 100644 --- a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc +++ b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc @@ -47,7 +47,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource) // Example of a factory as a shared_ptr std::shared_ptr factory = std::make_shared(); // Example of a block as a shared_ptr - std::shared_ptr signal_source = factory->GetSignalSource(configuration, queue); + std::shared_ptr signal_source = factory->GetSignalSource(configuration.get(), queue.get()); EXPECT_STREQ("SignalSource", signal_source->role().c_str()); EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str()); } @@ -61,7 +61,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongSignalSource) // Example of a factory as a unique_ptr std::unique_ptr factory; // Example of a block as a unique_ptr - std::unique_ptr signal_source = factory->GetSignalSource(configuration, queue); + std::unique_ptr signal_source = factory->GetSignalSource(configuration.get(), queue.get()); EXPECT_EQ(nullptr, signal_source); } @@ -71,7 +71,7 @@ TEST(GNSSBlockFactoryTest, InstantiateSignalConditioner) std::shared_ptr configuration = std::make_shared(); configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner"); std::unique_ptr factory; - std::unique_ptr signal_conditioner = factory->GetSignalConditioner(configuration); + std::unique_ptr signal_conditioner = factory->GetSignalConditioner(configuration.get()); EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str()); EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str()); } @@ -104,7 +104,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFIRFilter) configuration->set_property("InputFilter.grid_density", "16"); std::unique_ptr factory; - std::unique_ptr input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1, 1); + std::unique_ptr input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Fir_Filter", 1, 1); EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str()); @@ -139,7 +139,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter) configuration->set_property("InputFilter.sampling_frequency", "4000000"); configuration->set_property("InputFilter.IF", "34000"); std::unique_ptr factory; - std::unique_ptr input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1); + std::unique_ptr input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1); EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str()); @@ -152,7 +152,7 @@ TEST(GNSSBlockFactoryTest, InstantiatePulseBlankingFilter) configuration->set_property("InputFilter.implementation", "Pulse_Blanking_Filter"); std::unique_ptr factory; - std::unique_ptr input_filter = factory->GetBlock(configuration, "InputFilter", "Pulse_Blanking_Filter", 1, 1); + std::unique_ptr input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Pulse_Blanking_Filter", 1, 1); EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("Pulse_Blanking_Filter", input_filter->implementation().c_str()); @@ -165,7 +165,7 @@ TEST(GNSSBlockFactoryTest, InstantiateNotchFilter) configuration->set_property("InputFilter.implementation", "Notch_Filter"); std::unique_ptr factory; - std::unique_ptr input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter", 1, 1); + std::unique_ptr input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Notch_Filter", 1, 1); EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("Notch_Filter", input_filter->implementation().c_str()); @@ -178,7 +178,7 @@ TEST(GNSSBlockFactoryTest, InstantiateNotchFilterLite) configuration->set_property("InputFilter.implementation", "Notch_Filter_Lite"); std::unique_ptr factory; - std::unique_ptr input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter_Lite", 1, 1); + std::unique_ptr input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Notch_Filter_Lite", 1, 1); EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("Notch_Filter_Lite", input_filter->implementation().c_str()); @@ -189,7 +189,7 @@ TEST(GNSSBlockFactoryTest, InstantiateDirectResampler) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Resampler.implementation", "Direct_Resampler"); std::unique_ptr factory; - std::unique_ptr resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1, 1); + std::unique_ptr resampler = factory->GetBlock(configuration.get(), "Resampler", "Direct_Resampler", 1, 1); EXPECT_STREQ("Resampler", resampler->role().c_str()); EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str()); } @@ -199,7 +199,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); std::unique_ptr factory; - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str()); @@ -211,7 +211,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsQuickSyncAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); std::shared_ptr factory = std::make_shared(); - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_QuickSync_Acquisition", acquisition->implementation().c_str()); @@ -222,7 +222,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsQuickSyncAmbiguousAcquisition std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); std::shared_ptr factory = std::make_shared(); - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", acquisition->implementation().c_str()); @@ -234,7 +234,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsAmbiguousAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); std::unique_ptr factory; - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); @@ -246,7 +246,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaDllPllTracking) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); std::unique_ptr factory; - std::shared_ptr trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str()); @@ -258,7 +258,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaTcpConnectorTracking) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking"); std::unique_ptr factory; - std::shared_ptr trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str()); @@ -270,7 +270,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1DllPllVemlTracking) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); std::unique_ptr factory; - std::shared_ptr trk_ = factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(configuration.get(), "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); @@ -282,7 +282,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaTelemetryDecoder) std::shared_ptr configuration = std::make_shared(); configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); std::unique_ptr factory; - std::shared_ptr telemetry_decoder = factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1); + std::shared_ptr telemetry_decoder = factory->GetBlock(configuration.get(), "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1); EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str()); EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str()); } @@ -301,7 +301,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels) configuration->set_property("Channel1.item_type", "gr_complex"); std::shared_ptr> queue = std::make_shared>(); std::unique_ptr factory; - std::unique_ptr>> channels = factory->GetChannels(configuration, queue); + std::unique_ptr>> channels = factory->GetChannels(configuration.get(), queue.get()); EXPECT_EQ(static_cast(2), channels->size()); channels->erase(channels->begin(), channels->end()); } @@ -312,7 +312,7 @@ TEST(GNSSBlockFactoryTest, InstantiateObservables) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Observables.implementation", "Pass_Through"); std::unique_ptr factory; - auto observables = factory->GetObservables(configuration); + auto observables = factory->GetObservables(configuration.get()); EXPECT_STREQ("Observables", observables->role().c_str()); EXPECT_STREQ("Pass_Through", observables->implementation().c_str()); } @@ -323,7 +323,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaObservables) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Observables.implementation", "Hybrid_Observables"); std::unique_ptr factory; - std::unique_ptr observables = factory->GetObservables(configuration); + std::unique_ptr observables = factory->GetObservables(configuration.get()); EXPECT_STREQ("Observables", observables->role().c_str()); EXPECT_STREQ("Hybrid_Observables", observables->implementation().c_str()); } @@ -334,7 +334,7 @@ TEST(GNSSBlockFactoryTest, InstantiateRTKLIBPvt) std::shared_ptr configuration = std::make_shared(); configuration->set_property("PVT.implementation", "RTKLIB_PVT"); std::unique_ptr factory; - std::shared_ptr pvt_ = factory->GetPVT(configuration); + std::shared_ptr pvt_ = factory->GetPVT(configuration.get()); std::shared_ptr pvt = std::dynamic_pointer_cast(pvt_); EXPECT_STREQ("PVT", pvt->role().c_str()); EXPECT_STREQ("RTKLIB_PVT", pvt->implementation().c_str()); @@ -346,7 +346,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongPvt) std::shared_ptr configuration = std::make_shared(); configuration->set_property("PVT.implementation", "Pepito"); std::unique_ptr factory; - std::shared_ptr pvt_ = factory->GetPVT(configuration); + std::shared_ptr pvt_ = factory->GetPVT(configuration.get()); std::shared_ptr pvt = std::dynamic_pointer_cast(pvt_); EXPECT_EQ(nullptr, pvt); } diff --git a/src/tests/unit-tests/control-plane/in_memory_configuration_test.cc b/src/tests/unit-tests/control-plane/in_memory_configuration_test.cc index 5c9130bfe..d4a6ea95c 100644 --- a/src/tests/unit-tests/control-plane/in_memory_configuration_test.cc +++ b/src/tests/unit-tests/control-plane/in_memory_configuration_test.cc @@ -19,89 +19,98 @@ */ #include "configuration_interface.h" +#include "gnss_sdr_make_unique.h" #include "in_memory_configuration.h" TEST(InMemoryConfiguration, IsPresent) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); EXPECT_FALSE(configuration->is_present("NotThere")); configuration->set_property("NotThere", "Yes!"); EXPECT_TRUE(configuration->is_present("NotThere")); } + TEST(InMemoryConfiguration, StoreAndRetrieve) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); configuration->set_property("Foo.property1", "value"); std::string default_value = "default_value"; std::string value = configuration->property("Foo.property1", default_value); EXPECT_STREQ("value", value.c_str()); } + TEST(InMemoryConfiguration, NoStoringAndRetrieve) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); std::string default_value = "default_value"; std::string value = configuration->property("Foo.property1", default_value); EXPECT_STREQ("default_value", value.c_str()); } + TEST(InMemoryConfiguration, RetrieveBool) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); configuration->set_property("Foo.property1", "true"); bool value = configuration->property("Foo.property1", false); bool expectedtrue = true; EXPECT_EQ(expectedtrue, value); } + TEST(InMemoryConfiguration, RetrieveBoolFail) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); configuration->set_property("Foo.property1", "tru"); bool value = configuration->property("Foo.property1", false); bool expectedfalse = false; EXPECT_EQ(expectedfalse, value); } + TEST(InMemoryConfiguration, RetrieveBoolNoDefine) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); bool value = configuration->property("Foo.property1", false); bool expectedfalse = false; EXPECT_EQ(expectedfalse, value); } + TEST(InMemoryConfiguration, RetrieveSizeT) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); configuration->set_property("Foo.property1", "8"); unsigned int value = configuration->property("Foo.property1", 4); unsigned int expected8 = 8; EXPECT_EQ(expected8, value); } + TEST(InMemoryConfiguration, RetrieveSizeTFail) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); configuration->set_property("Foo.property1", "true"); unsigned int value = configuration->property("Foo.property1", 4); unsigned int expected4 = 4; EXPECT_EQ(expected4, value); } + TEST(InMemoryConfiguration, RetrieveSizeTNoDefine) { // std::shared_ptr configuration = std::make_shared(); - std::unique_ptr configuration(new InMemoryConfiguration); + auto configuration = std::make_unique(); unsigned int value = configuration->property("Foo.property1", 4); unsigned int expected4 = 4; EXPECT_EQ(expected4, value); diff --git a/src/tests/unit-tests/control-plane/string_converter_test.cc b/src/tests/unit-tests/control-plane/string_converter_test.cc index 7e94fcc6d..ff63de09f 100644 --- a/src/tests/unit-tests/control-plane/string_converter_test.cc +++ b/src/tests/unit-tests/control-plane/string_converter_test.cc @@ -19,12 +19,13 @@ * ------------------------------------------------------------------------- */ +#include "gnss_sdr_make_unique.h" #include "string_converter.h" TEST(StringConverterTest, StringToBool) { - std::unique_ptr converter(new StringConverter()); + auto converter = std::make_unique(); bool conversion_result = converter->convert("false", true); bool expected_false = false; EXPECT_EQ(expected_false, conversion_result); @@ -45,7 +46,7 @@ TEST(StringConverterTest, StringToSizeT) TEST(StringConverterTest, StringToBoolFail) { - std::unique_ptr converter(new StringConverter()); + auto converter = std::make_unique(); bool conversion_result = converter->convert("lse", true); bool expected_true = true; EXPECT_EQ(expected_true, conversion_result); @@ -54,7 +55,7 @@ TEST(StringConverterTest, StringToBoolFail) TEST(StringConverterTest, StringToSizeTFail) { - std::unique_ptr converter(new StringConverter()); + auto converter = std::make_unique(); size_t conversion_result = converter->convert("false", 1); unsigned int expected1 = 1; EXPECT_EQ(expected1, conversion_result); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc index e5a8bbc8e..a89ac0ff1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc @@ -608,7 +608,7 @@ int AcquisitionPerformanceTest::run_receiver() init(); int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); if (implementation == "GPS_L1_CA_PCPS_Acquisition") { acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc index e673da15b..ae15ded1b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc @@ -275,7 +275,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc index f25bcd583..c0f745b3f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc @@ -274,7 +274,7 @@ TEST_F(BeidouB3iPcpsAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index 77db3ad53..203fe6899 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -433,7 +433,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - auto acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); + auto acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); } @@ -447,7 +447,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -474,7 +474,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -497,7 +497,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue.get()); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -528,10 +528,9 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -585,7 +584,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb config_2(); queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -616,10 +615,9 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index b5fd9a326..7d39259b5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -434,7 +434,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -448,14 +448,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) queue = std::make_shared>(); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -477,7 +477,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -504,10 +504,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -558,7 +557,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi config_2(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -585,10 +584,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 50a5087b3..c241a42d6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -216,7 +216,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); } @@ -232,14 +232,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -263,7 +263,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) top_block = gr::make_top_block("Acquisition test"); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 182b61f82..0f6828b8d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -268,7 +268,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); } @@ -282,14 +282,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); std::shared_ptr> queue = std::make_shared>(); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -324,7 +324,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) double expected_doppler_hz = -632; init(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index 983b64bb5..ec1235deb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -436,7 +436,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue() TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -451,14 +451,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -480,7 +480,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -512,10 +512,9 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -573,7 +572,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili config_2(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -605,10 +604,9 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 574fb1d62..67ca50933 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -555,7 +555,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue() TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -571,7 +571,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -580,7 +580,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto valve = - gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -606,7 +606,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -638,10 +638,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -697,7 +696,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -729,10 +728,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -785,7 +783,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -816,10 +814,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index 958a7e077..a87e5657b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -434,7 +434,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -447,13 +447,13 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; @@ -474,7 +474,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -506,10 +506,9 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -563,7 +562,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro config_2(); top_block = gr::make_top_block("Acquisition test"); queue = std::make_shared>(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); + std::shared_ptr acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -594,10 +593,9 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 93d176472..d84c99051 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -553,7 +553,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -605,11 +605,10 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) // USING THE SIGNAL GENERATOR ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); filter->connect(top_block); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc index 4e74d04f7..860c1af34 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc @@ -149,7 +149,7 @@ protected: std::shared_ptr> queue; gr::top_block_sptr top_block; - GlonassL1CaPcpsAcquisition* acquisition; + std::shared_ptr acquisition; std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; @@ -440,8 +440,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::stop_queue() TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, Instantiate) { config_1(); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); - delete acquisition; + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } @@ -454,13 +453,13 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -474,8 +473,6 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun) }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; - - delete acquisition; } @@ -485,7 +482,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); + acquisition = acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -512,7 +509,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); signal_generator->connect(top_block); top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); @@ -559,8 +556,6 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) ch_thread.join(); }) << "Failure while waiting the queue to stop"; } - - delete acquisition; } @@ -569,7 +564,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) config_2(); queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -596,7 +591,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); signal_generator->connect(top_block); top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); @@ -646,6 +641,4 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) }) << "Failure while waiting the queue to stop" << std::endl; } - - delete acquisition; } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc index 4a79fe557..3aa0f4377 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc @@ -210,7 +210,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc index 2a388c687..97bb911b5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc @@ -151,7 +151,7 @@ protected: std::shared_ptr > queue; gr::top_block_sptr top_block; - GlonassL2CaPcpsAcquisition* acquisition; + std::shared_ptr acquisition; std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; @@ -437,8 +437,7 @@ void GlonassL2CaPcpsAcquisitionTest::stop_queue() TEST_F(GlonassL2CaPcpsAcquisitionTest, Instantiate) { config_1(); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); - delete acquisition; + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } @@ -451,13 +450,13 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_2G", 1, 0); auto msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -471,8 +470,6 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun) }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; - - delete acquisition; } @@ -482,7 +479,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) queue = std::make_shared >(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_2G", 1, 0); auto msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -513,10 +510,9 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; @@ -561,8 +557,6 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) ch_thread.join(); }) << "Failure while waiting the queue to stop"; } - - delete acquisition; } @@ -571,7 +565,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities) config_2(); queue = std::make_shared >(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_2G", 1, 0); auto msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -602,10 +596,9 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; @@ -651,6 +644,4 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities) ch_thread.join(); }) << "Failure while waiting the queue to stop"; } - - delete acquisition; } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index fa358e582..911eb5b4e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -149,7 +149,7 @@ protected: std::shared_ptr> queue; gr::top_block_sptr top_block; - GpsL1CaPcpsAcquisition* acquisition; + std::shared_ptr acquisition; std::shared_ptr config; Gnss_Synchro gnss_synchro; size_t item_size; @@ -433,8 +433,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); - delete acquisition; + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } @@ -447,13 +446,13 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); auto msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -467,8 +466,6 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) }) << "Failure running the top_block."; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; - - delete acquisition; } @@ -478,7 +475,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); auto msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -505,10 +502,9 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; @@ -553,8 +549,6 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) ch_thread.join(); }) << "Failure while waiting the queue to stop"; } - - delete acquisition; } @@ -563,7 +557,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) config_2(); queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); auto msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -590,10 +584,9 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; @@ -639,6 +632,4 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) ch_thread.join(); }) << "Failure while waiting the queue to stop"; } - - delete acquisition; } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 72ed9373e..5f185af40 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -291,10 +291,10 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ConnectAndRun /*unused*/) acquisition->connect(top_block); #if GNURADIO_USES_STD_POINTERS auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); #else boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); #endif top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index cf39e8858..41abc4dc1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -450,7 +450,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -507,10 +507,9 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) else { ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -595,10 +594,9 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie else { ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index 28882e13e..9e9395e78 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -560,7 +560,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -613,10 +613,9 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -707,10 +706,9 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -786,10 +784,9 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili acquisition->reset(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index 7cefc205f..44797e866 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -446,7 +446,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -499,10 +499,9 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); @@ -587,10 +586,9 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) acquisition->init(); ASSERT_NO_THROW({ - std::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue.get()); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + std::shared_ptr signal_source = std::make_shared(signal_generator, filter, "SignalSource", queue.get()); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index 0f896c6cd..400150a22 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -280,7 +280,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW({ acquisition->connect(top_block); auto source = gr::analog::sig_source_c::make(sampling_frequency_hz, gr::analog::GR_SIN_WAVE, 2000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); auto msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make(); @@ -353,7 +353,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); // gr::blocks::interleaved_short_to_complex::sptr gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make(); // gr::blocks::char_to_short::sptr gr_char_to_short_ = gr::blocks::char_to_short::make(); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); // top_block->connect(file_source, 0, gr_char_to_short_, 0); // top_block->connect(gr_char_to_short_, 0, gr_interleaved_short_to_complex_ , 0); top_block->connect(file_source, 0, valve, 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc index ee1c5f410..a1003ae88 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc @@ -33,6 +33,7 @@ #include "fir_filter.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gnss_sdr_valve.h" #include "in_memory_configuration.h" #include "interleaved_byte_to_complex_byte.h" @@ -124,7 +125,7 @@ TEST_F(FirFilterTest, InstantiateGrComplexGrComplex) { init(); configure_gr_complex_gr_complex(); - std::unique_ptr filter(new FirFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -133,11 +134,12 @@ TEST_F(FirFilterTest, InstantiateGrComplexGrComplex) ASSERT_EQ(1, res); } + TEST_F(FirFilterTest, InstantiateCshortCshort) { init(); configure_cshort_cshort(); - std::unique_ptr filter(new FirFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -151,7 +153,7 @@ TEST_F(FirFilterTest, InstantiateCbyteCbyte) { init(); configure_cbyte_cbyte(); - std::unique_ptr filter(new FirFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -165,7 +167,7 @@ TEST_F(FirFilterTest, InstantiateCbyteGrComplex) { init(); configure_cbyte_gr_complex(); - std::unique_ptr filter(new FirFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -185,12 +187,12 @@ TEST_F(FirFilterTest, ConnectAndRun) init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); item_size = sizeof(gr_complex); ASSERT_NO_THROW({ filter->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); auto null_sink = gr::blocks::null_sink::make(item_size); top_block->connect(source, 0, valve, 0); @@ -217,8 +219,8 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex) init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -232,7 +234,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); auto null_sink = gr::blocks::null_sink::make(item_size); @@ -250,6 +252,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex) std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(FirFilterTest, ConnectAndRunCshorts) { std::chrono::time_point start; @@ -259,8 +262,8 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts) init(); configure_cshort_cshort(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -274,7 +277,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); interleaved_short_to_complex_short_sptr ishort_to_cshort_ = make_interleaved_short_to_complex_short(); @@ -304,8 +307,8 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes) init(); configure_cbyte_cbyte(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -319,7 +322,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); @@ -349,8 +352,8 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex) init(); configure_cbyte_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -364,7 +367,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc index 64f9c46eb..59a9e2ce7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc @@ -32,6 +32,7 @@ #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gnss_sdr_valve.h" #include "in_memory_configuration.h" #include "notch_filter_lite.h" @@ -72,17 +73,19 @@ void NotchFilterLiteTest::init() config->set_property("InputFilter.segments_reset", "5000000"); } + void NotchFilterLiteTest::configure_gr_complex_gr_complex() { config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); } + TEST_F(NotchFilterLiteTest, InstantiateGrComplexGrComplex) { init(); configure_gr_complex_gr_complex(); - std::unique_ptr filter(new NotchFilterLite(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -91,6 +94,7 @@ TEST_F(NotchFilterLiteTest, InstantiateGrComplexGrComplex) ASSERT_EQ(1, res); } + TEST_F(NotchFilterLiteTest, ConnectAndRun) { int fs_in = 4000000; @@ -100,12 +104,12 @@ TEST_F(NotchFilterLiteTest, ConnectAndRun) top_block = gr::make_top_block("Notch filter lite test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); item_size = sizeof(gr_complex); ASSERT_NO_THROW({ filter->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); auto null_sink = gr::blocks::null_sink::make(item_size); top_block->connect(source, 0, valve, 0); @@ -131,8 +135,8 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex) top_block = gr::make_top_block("Notch filter lite test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -146,7 +150,7 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); auto null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc index 317ba6cd8..adbd8a4bf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc @@ -32,6 +32,7 @@ #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gnss_sdr_valve.h" #include "in_memory_configuration.h" #include "notch_filter.h" @@ -72,17 +73,19 @@ void NotchFilterTest::init() config->set_property("InputFilter.segments_reset", "5000000"); } + void NotchFilterTest::configure_gr_complex_gr_complex() { config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); } + TEST_F(NotchFilterTest, InstantiateGrComplexGrComplex) { init(); configure_gr_complex_gr_complex(); - std::unique_ptr filter(new NotchFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -91,6 +94,7 @@ TEST_F(NotchFilterTest, InstantiateGrComplexGrComplex) ASSERT_EQ(1, res); } + TEST_F(NotchFilterTest, ConnectAndRun) { int fs_in = 4000000; @@ -100,12 +104,12 @@ TEST_F(NotchFilterTest, ConnectAndRun) top_block = gr::make_top_block("Notch filter test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); item_size = sizeof(gr_complex); ASSERT_NO_THROW({ filter->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); auto null_sink = gr::blocks::null_sink::make(item_size); top_block->connect(source, 0, valve, 0); @@ -131,8 +135,8 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex) top_block = gr::make_top_block("Notch filter test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -146,7 +150,7 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); auto null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc index 79dfa4521..187a0ddb3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc @@ -32,6 +32,7 @@ #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gnss_sdr_valve.h" #include "in_memory_configuration.h" #include "pulse_blanking_filter.h" @@ -71,17 +72,19 @@ void PulseBlankingFilterTest::init() config->set_property("InputFilter.segments_reset", "5000000"); } + void PulseBlankingFilterTest::configure_gr_complex_gr_complex() { config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); } + TEST_F(PulseBlankingFilterTest, InstantiateGrComplexGrComplex) { init(); configure_gr_complex_gr_complex(); - std::unique_ptr filter(new PulseBlankingFilter(config.get(), "InputFilter", 1, 1)); + auto filter = std::make_unique(config.get(), "InputFilter", 1, 1); int res = 0; if (filter) { @@ -90,6 +93,7 @@ TEST_F(PulseBlankingFilterTest, InstantiateGrComplexGrComplex) ASSERT_EQ(1, res); } + TEST_F(PulseBlankingFilterTest, ConnectAndRun) { int fs_in = 4000000; @@ -99,12 +103,12 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRun) top_block = gr::make_top_block("Pulse Blanking filter test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); item_size = sizeof(gr_complex); ASSERT_NO_THROW({ filter->connect(top_block); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); auto null_sink = gr::blocks::null_sink::make(item_size); top_block->connect(source, 0, valve, 0); @@ -130,8 +134,8 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex) top_block = gr::make_top_block("Pulse Blanking filter test"); init(); configure_gr_complex_gr_complex(); - std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); - std::shared_ptr config2 = std::make_shared(); + auto filter = std::make_shared(config.get(), "InputFilter", 1, 1); + auto config2 = std::make_shared(); config2->set_property("Test_Source.samples", std::to_string(nsamples)); config2->set_property("Test_Source.sampling_frequency", "4000000"); @@ -145,7 +149,7 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - std::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); + auto source = std::make_shared(config2.get(), "Test_Source", 0, 1, queue.get()); source->connect(top_block); auto null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc b/src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc index 461bc068c..5cdd24fdd 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc @@ -21,6 +21,7 @@ #include "item_type_helpers.h" #include +#include #include class ItemTypeHelpersTest : public ::testing::Test diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc index d5a672e6c..5497815c1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc @@ -109,13 +109,13 @@ void Observables_Dump_Reader::close_obs_file() Observables_Dump_Reader::Observables_Dump_Reader(int n_channels_) { n_channels = n_channels_; - RX_time = new double[n_channels]; - TOW_at_current_symbol_s = new double[n_channels]; - Carrier_Doppler_hz = new double[n_channels]; - Acc_carrier_phase_hz = new double[n_channels]; - Pseudorange_m = new double[n_channels]; - PRN = new double[n_channels]; - valid = new double[n_channels]; + RX_time = std::vector(n_channels); + TOW_at_current_symbol_s = std::vector(n_channels); + Carrier_Doppler_hz = std::vector(n_channels); + Acc_carrier_phase_hz = std::vector(n_channels); + Pseudorange_m = std::vector(n_channels); + PRN = std::vector(n_channels); + valid = std::vector(n_channels); } @@ -136,11 +136,4 @@ Observables_Dump_Reader::~Observables_Dump_Reader() { std::cerr << e.what() << '\n'; } - delete[] RX_time; - delete[] TOW_at_current_symbol_s; - delete[] Carrier_Doppler_hz; - delete[] Acc_carrier_phase_hz; - delete[] Pseudorange_m; - delete[] PRN; - delete[] valid; } diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h index 121a3ba73..23997a577 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h @@ -37,13 +37,13 @@ public: void close_obs_file(); // dump variables - double* RX_time; - double* TOW_at_current_symbol_s; - double* Carrier_Doppler_hz; - double* Acc_carrier_phase_hz; - double* Pseudorange_m; - double* PRN; - double* valid; + std::vector RX_time; + std::vector TOW_at_current_symbol_s; + std::vector Carrier_Doppler_hz; + std::vector Acc_carrier_phase_hz; + std::vector Pseudorange_m; + std::vector PRN; + std::vector valid; private: int n_channels; diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 858a651e1..07e2d20aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -1806,9 +1806,9 @@ TEST_F(HybridObservablesTest, ValidationOfResults) // create the tracking channels and create the telemetry decoders - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); tracking_ch_vec.push_back(std::dynamic_pointer_cast(trk_)); - std::shared_ptr tlm_ = factory->GetBlock(config, "TelemetryDecoder", config->property("TelemetryDecoder.implementation", std::string("undefined")), 1, 1); + std::shared_ptr tlm_ = factory->GetBlock(config.get(), "TelemetryDecoder", config->property("TelemetryDecoder.implementation", std::string("undefined")), 1, 1); tlm_ch_vec.push_back(std::dynamic_pointer_cast(tlm_)); // create null sinks for observables output @@ -1843,7 +1843,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) auto dummy_msg_rx_trk = HybridObservablesTest_msg_rx_make(); auto dummy_tlm_msg_rx = HybridObservablesTest_tlm_msg_rx_make(); // Observables - std::shared_ptr observables(new HybridObservables(config.get(), "Observables", tracking_ch_vec.size() + 1, tracking_ch_vec.size())); + std::shared_ptr observables = std::make_shared(config.get(), "Observables", tracking_ch_vec.size() + 1, tracking_ch_vec.size()); for (auto& n : tracking_ch_vec) { diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc index a32c764c1..2de1e8695 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc @@ -1935,9 +1935,9 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) gnss_synchro_vec.at(n).Channel_ID = n; // create the tracking channels and create the telemetry decoders - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); tracking_ch_vec.push_back(std::dynamic_pointer_cast(trk_)); - std::shared_ptr tlm_ = factory->GetBlock(config, "TelemetryDecoder", config->property("TelemetryDecoder.implementation", std::string("undefined")), 1, 1); + std::shared_ptr tlm_ = factory->GetBlock(config.get(), "TelemetryDecoder", config->property("TelemetryDecoder.implementation", std::string("undefined")), 1, 1); tlm_ch_vec.push_back(std::dynamic_pointer_cast(tlm_)); // create null sinks for observables output diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc index ac47babca..2eefc1e2c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc @@ -184,7 +184,7 @@ TEST_F(NmeaPrinterTest, PrintLine) bool flag_nmea_output_file = true; ASSERT_NO_THROW({ std::shared_ptr nmea_printer = std::make_shared(filename, flag_nmea_output_file, false, ""); - nmea_printer->Print_Nmea_Line(pvt_solution, false); + nmea_printer->Print_Nmea_Line(pvt_solution.get(), false); }) << "Failure printing NMEA messages."; std::ifstream test_file(filename); diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc index 039bbf0d2..d8332d2ee 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc @@ -18,6 +18,7 @@ */ +#include "gnss_sdr_make_unique.h" #include "rtcm_printer.h" #include @@ -31,7 +32,7 @@ TEST(RtcmPrinterTest, Instantiate) bool rtcm_file_output_enabled = false; unsigned short rtcm_tcp_port = 2101; unsigned short rtcm_station_id = 1234; - std::unique_ptr RTCM_printer(new Rtcm_Printer(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname)); + auto RTCM_printer = std::make_unique(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname); } @@ -45,7 +46,7 @@ TEST(RtcmPrinterTest, Run) unsigned short rtcm_tcp_port = 2101; unsigned short rtcm_station_id = 1234; - std::unique_ptr RTCM_printer(new Rtcm_Printer(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname)); + auto RTCM_printer = std::make_unique(filename, rtcm_file_output_enabled, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname); std::string reference_msg = "D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98"; diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc index 5e6da928e..06bc503aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc @@ -18,6 +18,7 @@ */ #include "geofunctions.h" +#include "gnss_sdr_make_unique.h" #include "gnss_sdr_supl_client.h" #include "in_memory_configuration.h" #include "rtklib_solver.h" @@ -385,7 +386,7 @@ TEST(RTKLibSolverTest, test1) bool save_to_mat = false; rtk_t rtk = configure_rtklib_options(); - std::unique_ptr d_ls_pvt(new Rtklib_Solver(nchannels, dump_filename, flag_dump_to_file, save_to_mat, rtk)); + auto d_ls_pvt = std::make_unique(nchannels, dump_filename, flag_dump_to_file, save_to_mat, rtk); d_ls_pvt->set_averaging_depth(1); // load ephemeris diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc index 11074e75c..31157617c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc @@ -41,17 +41,17 @@ TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; // Number of samples to be computed - std::shared_ptr> queue = std::make_shared>(); - gr::top_block_sptr top_block = gr::make_top_block("direct_resampler_conditioner_cc_test"); + auto queue = std::make_shared>(); + auto top_block = gr::make_top_block("direct_resampler_conditioner_cc_test"); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); EXPECT_NO_THROW({ direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); }) << "Failure in instantiation of direct_resampler_conditioner."; - direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex)); + auto resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); + auto sink = gr::blocks::null_sink::make(sizeof(gr_complex)); EXPECT_NO_THROW({ top_block->connect(source, 0, valve, 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc b/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc index 90429530c..4018380a2 100644 --- a/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc @@ -38,10 +38,10 @@ TEST(MmseResamplerTest, InstantiationAndRunTestWarning) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; // Number of samples to be computed - std::shared_ptr> queue = std::make_shared>(); - gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); + auto queue = std::make_shared>(); + auto top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); std::shared_ptr config; config = std::make_shared(); @@ -49,9 +49,9 @@ TEST(MmseResamplerTest, InstantiationAndRunTestWarning) config->set_property("Resampler.sample_freq_in", std::to_string(fs_in)); config->set_property("Resampler.sample_freq_out", std::to_string(fs_out)); - std::shared_ptr resampler = std::make_shared(config.get(), "Resampler", 1, 1); + auto resampler = std::make_shared(config.get(), "Resampler", 1, 1); - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex)); + auto sink = gr::blocks::null_sink::make(sizeof(gr_complex)); EXPECT_NO_THROW({ resampler->connect(top_block); @@ -79,10 +79,10 @@ TEST(MmseResamplerTest, InstantiationAndRunTest2) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; // Number of samples to be computed - std::shared_ptr> queue = std::make_shared>(); - gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); + auto queue = std::make_shared>(); + auto top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); std::shared_ptr config; config = std::make_shared(); @@ -90,9 +90,9 @@ TEST(MmseResamplerTest, InstantiationAndRunTest2) config->set_property("Resampler.sample_freq_in", std::to_string(fs_in)); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_out)); - std::shared_ptr resampler = std::make_shared(config.get(), "Resampler", 1, 1); + auto resampler = std::make_shared(config.get(), "Resampler", 1, 1); - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex)); + auto sink = gr::blocks::null_sink::make(sizeof(gr_complex)); EXPECT_NO_THROW({ resampler->connect(top_block); diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc index b723fa3e0..d0c8a43e4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc @@ -20,6 +20,7 @@ #include "concurrent_queue.h" #include "file_signal_source.h" +#include "gnss_sdr_make_unique.h" #include "in_memory_configuration.h" #include #include @@ -27,8 +28,8 @@ TEST(FileSignalSource, Instantiate) { - std::shared_ptr> queue = std::make_shared>(); - std::shared_ptr config = std::make_shared(); + auto queue = std::make_shared>(); + auto config = std::make_shared(); config->set_property("Test.samples", "0"); config->set_property("Test.sampling_frequency", "0"); @@ -38,7 +39,7 @@ TEST(FileSignalSource, Instantiate) config->set_property("Test.item_type", "gr_complex"); config->set_property("Test.repeat", "false"); - std::unique_ptr signal_source(new FileSignalSource(config.get(), "Test", 0, 1, queue)); + auto signal_source = std::make_unique(config.get(), "Test", 0, 1, queue.get()); EXPECT_STREQ("gr_complex", signal_source->item_type().c_str()); EXPECT_TRUE(signal_source->repeat() == false); @@ -46,8 +47,8 @@ TEST(FileSignalSource, Instantiate) TEST(FileSignalSource, InstantiateFileNotExists) { - std::shared_ptr> queue = std::make_shared>(); - std::shared_ptr config = std::make_shared(); + auto queue = std::make_shared>(); + auto config = std::make_shared(); config->set_property("Test.samples", "0"); config->set_property("Test.sampling_frequency", "0"); @@ -55,5 +56,5 @@ TEST(FileSignalSource, InstantiateFileNotExists) config->set_property("Test.item_type", "gr_complex"); config->set_property("Test.repeat", "false"); - EXPECT_THROW({ auto uptr = std::make_shared(config.get(), "Test", 0, 1, queue); }, std::exception); + EXPECT_THROW({ auto uptr = std::make_shared(config.get(), "Test", 0, 1, queue.get()); }, std::exception); } diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc index 187d63219..051ce348e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc @@ -34,13 +34,13 @@ TEST(ValveTest, CheckEventSentAfter100Samples) { - std::shared_ptr> queue = std::make_shared>(); + auto queue = std::make_shared>(); - gr::top_block_sptr top_block = gr::make_top_block("gnss_sdr_valve_test"); + auto top_block = gr::make_top_block("gnss_sdr_valve_test"); - gr::analog::sig_source_f::sptr source = gr::analog::sig_source_f::make(100, gr::analog::GR_CONST_WAVE, 100, 1, 0); - auto valve = gnss_sdr_make_valve(sizeof(float), 100, queue); - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(float)); + auto source = gr::analog::sig_source_f::make(100, gr::analog::GR_CONST_WAVE, 100, 1, 0); + auto valve = gnss_sdr_make_valve(sizeof(float), 100, queue.get()); + auto sink = gr::blocks::null_sink::make(sizeof(float)); bool expected0 = false; pmt::pmt_t msg; diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index ac078155b..e55639437 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -393,7 +393,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz; gnss_synchro.Acq_samplestamp_samples = 0; - std::shared_ptr tlm(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C", 1, 1)); + std::shared_ptr tlm = std::make_shared(config.get(), "TelemetryDecoder_1C", 1, 1); tlm->set_channel(0); std::shared_ptr tlm_msg_rx = GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index 51411a78c..76e1df291 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -91,7 +91,7 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) { init(); - auto tracking = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + auto tracking = factory->GetBlock(config.get(), "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); } @@ -108,7 +108,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); ASSERT_NO_THROW({ @@ -122,7 +122,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) ASSERT_NO_THROW({ tracking->connect(top_block); gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); @@ -156,7 +156,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); // gnss_synchro.Acq_delay_samples = 1753; // 4 Msps @@ -183,7 +183,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(file_source, 0, skip_head, 0); top_block->connect(skip_head, 0, valve, 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index c545fdcef..307d35945 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -103,7 +103,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_5X", "Galileo_E5a_DLL_PLL_Tracking", 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_5X", "Galileo_E5a_DLL_PLL_Tracking", 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); // REAL @@ -127,7 +127,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) ASSERT_NO_THROW({ gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc index 99b579119..cd01585bf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc @@ -183,7 +183,7 @@ TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults) std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin"; const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(file_source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc index e7679b61a..ae99757d1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc @@ -190,7 +190,7 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults) std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin"; const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(file_source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index e47ec2875..61d0c82bf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -610,7 +610,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) top_block = gr::make_top_block("Tracking test"); - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_1C", implementation, 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); auto msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc index 35911319f..5e7955106 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc @@ -411,7 +411,7 @@ TEST_F(GpsL1CAKfTrackingTest, ValidationOfResults) top_block = gr::make_top_block("Tracking test"); - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_1C", implementation, 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); // std::make_shared(config.get(), "Tracking_1C", 1, 1); auto msg_rx = GpsL1CAKfTrackingTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index b73d73ebb..9e678dbed 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -197,7 +197,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) std::string file = path + "signal_samples/gps_l2c_m_prn7_5msps.dat"; const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); - auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get()); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(file_source, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index bf191adb8..4186e7d5f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -808,7 +808,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // create the msg queue for valve queue = std::make_shared>(); long long int acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); - auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue, false); + auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue.get(), false); // CN0 LOOP std::vector> pull_in_results_v_v; @@ -828,7 +828,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // create flowgraph auto top_block_trk = gr::make_top_block("Tracking test"); - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); auto msg_rx = TrackingPullInTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index 2268121a5..80b11e4d9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -295,7 +295,6 @@ void* handler_DMA_trk_pull_in_test(void* arguments) // Throttle the DMA std::this_thread::sleep_for(std::chrono::milliseconds(1)); - nsamples_remaining -= nsamples_block_size; if (nsamples_remaining == 0) @@ -474,14 +473,12 @@ public: return true; } - bool Event_failed_acquisition_repeat() override { acquisition_successful = false; return true; } - bool Event_failed_acquisition_no_repeat() override { acquisition_successful = false; @@ -882,7 +879,6 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } } - // use generator or use an external capture file if (FLAGS_enable_external_signal_file) { @@ -1011,7 +1007,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // create flowgraph top_block = gr::make_top_block("Tracking test"); - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); + std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); auto msg_rx = TrackingPullInTest_msg_rx_Fpga_make(); diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 2d9d944bd..39c15ce68 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -92,10 +92,8 @@ Concurrent_Map global_gps_acq_assist_map; bool stop; Concurrent_Queue channel_internal_queue; -GpsL1CaPcpsAcquisitionFineDoppler* acquisition; -Gnss_Synchro* gnss_synchro; std::vector gnss_sync_vector; - +Gnss_Synchro gnss_synchro{}; // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class FrontEndCal_msg_rx; @@ -170,7 +168,7 @@ void wait_message() switch (message) { case 1: // Positive acq - gnss_sync_vector.push_back(*gnss_synchro); + gnss_sync_vector.push_back(gnss_synchro); // acquisition->reset(); break; case 2: // negative acq @@ -198,7 +196,7 @@ bool front_end_capture(const std::shared_ptr& configurat std::shared_ptr source; try { - source = block_factory.GetSignalSource(configuration, queue); + source = block_factory.GetSignalSource(configuration.get(), queue.get()); } catch (const boost::exception_ptr& e) { @@ -209,7 +207,7 @@ bool front_end_capture(const std::shared_ptr& configurat std::shared_ptr conditioner; try { - conditioner = block_factory.GetSignalConditioner(configuration); + conditioner = block_factory.GetSignalConditioner(configuration.get()); } catch (const boost::exception_ptr& e) { @@ -359,20 +357,20 @@ int main(int argc, char** argv) top_block = gr::make_top_block("Acquisition test"); // Satellite signal definition - gnss_synchro = new Gnss_Synchro(); - gnss_synchro->Channel_ID = 0; - gnss_synchro->System = 'G'; + gnss_synchro = Gnss_Synchro(); + gnss_synchro.Channel_ID = 0; + gnss_synchro.System = 'G'; std::string signal = "1C"; - signal.copy(gnss_synchro->Signal, 2, 0); - gnss_synchro->PRN = 1; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = 1; int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000); configuration->set_property("Acquisition.max_dwells", "10"); - acquisition = new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), "Acquisition", 1, 1); + auto acquisition = std::make_shared(configuration.get(), "Acquisition", 1, 1); acquisition->set_channel(1); - acquisition->set_gnss_synchro(gnss_synchro); + acquisition->set_gnss_synchro(&gnss_synchro); acquisition->set_threshold(configuration->property("Acquisition.threshold", 2.0)); acquisition->set_doppler_max(configuration->property("Acquisition.doppler_max", 10000)); acquisition->set_doppler_step(configuration->property("Acquisition.doppler_step", 250)); @@ -425,8 +423,8 @@ int main(int argc, char** argv) for (unsigned int PRN = 1; PRN < 33; PRN++) { - gnss_synchro->PRN = PRN; - acquisition->set_gnss_synchro(gnss_synchro); + gnss_synchro.PRN = PRN; + acquisition->set_gnss_synchro(&gnss_synchro); acquisition->init(); acquisition->set_local_code(); acquisition->reset(); @@ -515,8 +513,6 @@ int main(int argc, char** argv) else { std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!" << std::endl; - delete acquisition; - delete gnss_synchro; google::ShutDownCommandLineFlags(); std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; return 0; @@ -525,8 +521,6 @@ int main(int argc, char** argv) catch (const boost::exception& e) { std::cout << "Exception in getting Global ephemeris map" << std::endl; - delete acquisition; - delete gnss_synchro; google::ShutDownCommandLineFlags(); std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; return 0; @@ -546,8 +540,6 @@ int main(int argc, char** argv) if (doppler_measurements_map.empty()) { std::cout << "Sorry, no GPS satellites detected in the front-end capture, please check the antenna setup..." << std::endl; - delete acquisition; - delete gnss_synchro; google::ShutDownCommandLineFlags(); std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; return 0; @@ -642,9 +634,6 @@ int main(int argc, char** argv) } } - delete acquisition; - delete gnss_synchro; - google::ShutDownCommandLineFlags(); std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; }