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
This commit is contained in:
Carles Fernandez 2020-06-18 11:49:28 +02:00
parent 7307e82d48
commit 81af1a531b
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
135 changed files with 1295 additions and 1302 deletions

View File

@ -26,6 +26,9 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
smart pointers instead of Boost smart pointers.
- The software can now be built against Boost <= 1.73 (minimum version: 1.53).
- Removed python six module as a dependency if using Python 3.x.
- Improved usage of smart pointers to better express ownership.
- Add definition of std::make_unique for buidings with C++11, and make use of it
along the source code.
- Fixed building with GCC 10 (gcc-10 and above flipped a default from `-fcommon`
to `-fno-common`, causing an error due to multiple defined lambda functions).
- Fixed warnings risen by GCC 10 and Clang 10.

View File

@ -35,6 +35,7 @@
#include "glonass_gnav_utc_model.h"
#include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gps_almanac.h"
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
@ -137,13 +138,11 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
mapStringValues_["B2"] = evBDS_B2;
mapStringValues_["B3"] = evBDS_B3;
initial_carrier_phase_offset_estimation_rads = std::vector<double>(nchannels, 0.0);
channel_initialized = std::vector<bool>(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<Kml_Printer>(conf_.kml_output_path);
d_kml_dump = std::make_unique<Kml_Printer>(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<Gpx_Printer>(conf_.gpx_output_path);
d_gpx_dump = std::make_unique<Gpx_Printer>(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<GeoJSON_Printer>(conf_.geojson_output_path);
d_geojson_printer = std::make_unique<GeoJSON_Printer>(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<Nmea_Printer>(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<Nmea_Printer>(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_Printer>(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_Printer>(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<int, int> 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<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name);
rp = std::make_unique<Rinex_Printer>(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<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled));
udp_sink_ptr = std::make_unique<Monitor_Pvt_Udp_Sink>(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);
}
}

View File

@ -191,12 +191,12 @@ private:
int32_t d_display_rate_ms;
int32_t d_report_rate_ms;
std::shared_ptr<Rinex_Printer> rp;
std::shared_ptr<Kml_Printer> d_kml_dump;
std::shared_ptr<Gpx_Printer> d_gpx_dump;
std::shared_ptr<Nmea_Printer> d_nmea_printer;
std::shared_ptr<GeoJSON_Printer> d_geojson_printer;
std::shared_ptr<Rtcm_Printer> d_rtcm_printer;
std::unique_ptr<Rinex_Printer> rp;
std::unique_ptr<Kml_Printer> d_kml_dump;
std::unique_ptr<Gpx_Printer> d_gpx_dump;
std::unique_ptr<Nmea_Printer> d_nmea_printer;
std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
double d_rx_time;
bool d_geojson_output_enabled;

View File

@ -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<Pvt_Solution>& 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<Pvt_Solution>& 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())

View File

@ -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<Pvt_Solution>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@ -20,7 +20,7 @@
#include "gpx_printer.h"
#include "rtklib_solver.h"
#include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <ctime> // 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<Rtklib_Solver>& 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<Rtklib_Solver>& 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<Rtklib_Solver>& 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())

View File

@ -27,7 +27,7 @@
#include <memory>
#include <string>
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<Rtklib_Solver>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@ -20,7 +20,7 @@
*/
#include "kml_printer.h"
#include "rtklib_solver.h"
#include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <cstdlib> // 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<Rtklib_Solver>& 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<Rtklib_Solver>& position,
positions_printed = true;
const std::shared_ptr<Rtklib_Solver>& 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<Rtklib_Solver>& 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())

View File

@ -26,7 +26,7 @@
#include <memory> // for shared_ptr
#include <string>
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<Rtklib_Solver>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@ -22,6 +22,7 @@
#include <boost/archive/binary_oarchive.hpp>
#include <iostream>
#include <sstream>
#include <utility>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& 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<std::string>& addre
}
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const std::shared_ptr<Monitor_Pvt>& monitor_pvt)
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr<Monitor_Pvt> 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)

View File

@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{
public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(const std::shared_ptr<Monitor_Pvt>& monitor_pvt);
bool write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt);
private:
b_io_context io_context;
@ -46,6 +46,7 @@ private:
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
bool use_protobuf;
};

View File

@ -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<Rtklib_Solver>& 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;

View File

@ -49,7 +49,7 @@ public:
/*!
* \brief Print NMEA PVT and satellite info to the initialized device
*/
bool Print_Nmea_Line(const std::shared_ptr<Rtklib_Solver>& 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<Rtklib_Solver> 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

View File

@ -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:

View File

@ -75,10 +75,10 @@ public:
sol_t pvt_sol{};
std::array<ssat_t, MAXSAT> 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<int, Galileo_Ephemeris> galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris

View File

@ -118,6 +118,7 @@ endif()
if(ENABLE_FPGA)
target_link_libraries(acquisition_adapters
PRIVATE
algorithms_libs
Gnuradio::fft
Volk::volk
Volkgnsssdr::volkgnsssdr

View File

@ -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 <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // 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<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
volk_gnsssdr::vector<gr_complex> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -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 <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // 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<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -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 <glog/logging.h>
#include <gnuradio/fft/fft.h>
@ -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<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true);
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -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 <glog/logging.h>
@ -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<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -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 <glog/logging.h>
#include <gnuradio/fft/fft.h> // 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<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -29,17 +29,17 @@
#include <utility> // for std::move
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr<AcquisitionInterface>& acq,
const std::shared_ptr<TrackingInterface>& trk, const std::shared_ptr<TelemetryDecoderInterface>& nav,
const std::string& role, const std::string& implementation, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t> >& queue)
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* 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<ChannelFsm>();
flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false);

View File

@ -54,9 +54,9 @@ class Channel : public ChannelInterface
{
public:
//! Constructor
Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr<AcquisitionInterface>& acq,
const std::shared_ptr<TrackingInterface>& trk, const std::shared_ptr<TelemetryDecoderInterface>& nav,
const std::string& role, const std::string& implementation, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue);
~Channel() = default; //!< Destructor
@ -97,7 +97,7 @@ private:
bool connected_;
bool repeat_;
std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
Concurrent_Queue<pmt::pmt_t>* queue_;
std::mutex mx;
};

View File

@ -30,6 +30,7 @@ ChannelFsm::ChannelFsm()
trk_ = nullptr;
channel_ = 0U;
d_state = 0U;
queue_ = nullptr;
}
@ -38,6 +39,7 @@ ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_
trk_ = nullptr;
channel_ = 0U;
d_state = 0U;
queue_ = nullptr;
}
@ -168,10 +170,10 @@ void ChannelFsm::set_telemetry(std::shared_ptr<TelemetryDecoderInterface> teleme
}
void ChannelFsm::set_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
void ChannelFsm::set_queue(Concurrent_Queue<pmt::pmt_t>* queue)
{
std::lock_guard<std::mutex> lk(mx);
queue_ = std::move(queue);
queue_ = queue;
}

View File

@ -45,7 +45,7 @@ public:
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry);
void set_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
void set_queue(Concurrent_Queue<pmt::pmt_t>* queue);
void set_channel(uint32_t channel);
void start_acquisition();
// FSM EVENTS
@ -67,7 +67,7 @@ private:
std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_;
std::shared_ptr<TelemetryDecoderInterface> nav_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
Concurrent_Queue<pmt::pmt_t>* queue_;
uint32_t channel_;
uint32_t d_state;
std::mutex mx;

View File

@ -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

View File

@ -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 <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
namespace std
{
template <class T>
struct _Unique_if
{
typedef unique_ptr<T> _Single_object;
};
template <class T>
struct _Unique_if<T[]>
{
typedef unique_ptr<T[]> _Unknown_bound;
};
template <class T, size_t N>
struct _Unique_if<T[N]>
{
typedef void _Known_bound;
};
template <class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args)
{
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n)
{
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template <class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
} // namespace std
#endif // __cplusplus == 201103L
#endif // GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H

View File

@ -33,7 +33,8 @@
SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t> > queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
unsigned int out_stream,
Concurrent_Queue<pmt::pmt_t>* 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";

View File

@ -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<Concurrent_Queue<pmt::pmt_t> > queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t> > queue_;
};
#endif // GNSS_SDR_SIGNAL_GENERATOR_H

View File

@ -40,238 +40,10 @@
#include <utility>
#include <vector>
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<int8_t> input_samples(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> 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<char *>(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<char *>(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<char *>(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<char *>(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<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t> *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<int8_t> input_samples(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> 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<char *>(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<char *>(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<char *>(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<char *>(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)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
Ad9361FpgaSignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream,
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t> *queue);
~Ad9361FpgaSignalSource();
@ -102,8 +102,6 @@ private:
size_t item_size_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
std::shared_ptr<Fpga_Switch> 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

View File

@ -29,7 +29,7 @@
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
// DUMP PARAMETERS
std::string empty = "";

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~CustomUDPSignalSource() = default;
@ -98,8 +98,6 @@ private:
#endif
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H

View File

@ -33,7 +33,7 @@
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~FileSignalSource() = default;
@ -121,7 +121,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@ -31,10 +31,7 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role),
in_stream_(in_stream),
out_stream_(out_stream),
queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* 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);

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~FlexibandSignalSource() = default;
@ -94,13 +94,11 @@ private:
int n_channels_;
int sel_ch_;
gr::block_sptr flexiband_source_;
boost::shared_ptr<gr::block> flexiband_source_;
std::vector<std::shared_ptr<gr::block>> char_to_float;
std::vector<std::shared_ptr<gr::block>> float_to_complex_;
std::vector<boost::shared_ptr<gr::block>> char_to_float;
std::vector<boost::shared_ptr<gr::block>> float_to_complex_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H

View File

@ -34,7 +34,7 @@
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t> *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() << ")";
}

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~Fmcomms2SignalSource();
@ -127,7 +127,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H

View File

@ -29,24 +29,17 @@
// Constructor
GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter,
std::string role, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : signal_generator_(signal_generator),
filter_(filter),
role_(std::move(role)),
queue_(std::move(queue))
GenSignalSource::GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator,
std::shared_ptr<GNSSBlockInterface> filter,
std::string role,
Concurrent_Queue<pmt::pmt_t> *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_)

View File

@ -37,11 +37,11 @@ class GenSignalSource : public GNSSBlockInterface
{
public:
//! Constructor
GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter,
std::string role, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator, std::shared_ptr<GNSSBlockInterface> filter,
std::string role, Concurrent_Queue<pmt::pmt_t> *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<GNSSBlockInterface> signal_generator() const { return signal_generator_; }
private:
GNSSBlockInterface *signal_generator_;
GNSSBlockInterface *filter_;
std::shared_ptr<GNSSBlockInterface> signal_generator_;
std::shared_ptr<GNSSBlockInterface> filter_;
std::string role_;
std::string implementation_;
bool connected_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_GEN_SIGNAL_SOURCE_H

View File

@ -25,7 +25,10 @@
Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> 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<pmt::pmt_t>* 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";

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_GN3S_SIGNAL_SOURCE_H

View File

@ -26,7 +26,7 @@
LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> 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<pmt::pmt_t>* 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() << ")";
}

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_LABSAT_SIGNAL_SOURCE_H

View File

@ -32,7 +32,7 @@
MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~MultichannelFileSignalSource() = default;
@ -121,7 +121,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@ -33,7 +33,7 @@
NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@ -31,7 +31,7 @@
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* 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() << ")";
}

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~OsmosdrSignalSource() = default;
@ -108,7 +108,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H

View File

@ -28,7 +28,7 @@
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* 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() << ")";
}

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~PlutosdrSignalSource() = default;
@ -112,7 +112,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H

View File

@ -27,7 +27,7 @@
RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> 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<pmt::pmt_t>* 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";

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H

View File

@ -34,10 +34,9 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role),
in_stream_(in_stream),
out_stream_(out_stream),
queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* 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() << ")";
}

View File

@ -51,7 +51,7 @@ public:
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~RtlTcpSignalSource() = default;
@ -111,7 +111,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H

View File

@ -32,7 +32,7 @@
SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@ -29,7 +29,7 @@
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration,
const std::string& role, uint32_t in_streams, uint32_t out_streams, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> 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<pmt::pmt_t>* 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);

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue);
~SpirGSS6450FileSignalSource() = default;
inline std::string role() override
@ -130,7 +130,6 @@ private:
#endif
std::vector<gr::blocks::file_sink::sptr> sink_vec_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
};

View File

@ -34,10 +34,9 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -54,7 +54,7 @@ public:
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@ -36,10 +36,9 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
Concurrent_Queue<pmt::pmt_t>* 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_)

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* 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<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
bool big_endian_items_;
bool big_endian_bytes_;

View File

@ -31,7 +31,7 @@
UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* 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() << ")";
}

View File

@ -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<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~UhdSignalSource() = default;
@ -103,8 +103,6 @@ private:
std::vector<boost::shared_ptr<gr::block>> valve_;
#endif
std::vector<gr::blocks::file_sink::sptr> file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_UHD_SIGNAL_SOURCE_H

View File

@ -30,18 +30,18 @@
#include <vector>
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, Concurrent_Queue<pmt::pmt_t> *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<Concurrent_Queue<pmt::pmt_t>> 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<pmt::pmt_t> *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<char, 1024> 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<int16_t> memblock(n_int16_to_read);
binary_input_file->read(reinterpret_cast<char *>(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<char *>(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<int16_t> memblock(n_int16_to_read);
binary_input_file->read(reinterpret_cast<char *>(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<char *>(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;

View File

@ -43,7 +43,7 @@ using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *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<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *queue);
labsat23_source(const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *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<Concurrent_Queue<pmt::pmt_t>> d_queue;
Concurrent_Queue<pmt::pmt_t> *d_queue;
};
#endif // GNSS_SDR_LABSAT23_SOURCE_H

View File

@ -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_)

View File

@ -31,42 +31,43 @@
Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* 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_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph)
{
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
return valve_;
}
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue)
{
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, true));
return valve_;
}
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
return valve_;
}
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
boost::shared_ptr<Gnss_Sdr_Valve> 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)
{

View File

@ -41,23 +41,23 @@ class Gnss_Sdr_Valve;
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* 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_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#else
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#endif
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph);
Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph);
uint64_t d_nitems;
uint64_t d_ncopied_items;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> d_queue;
Concurrent_Queue<pmt::pmt_t>* d_queue;
bool d_stop_flowgraph;
bool d_open_valve;
};

File diff suppressed because it is too large Load Diff

View File

@ -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 <pmt/pmt.h>
#include <memory> // for unique_ptr, shared_ptr
#include <memory> // for unique_ptr
#include <string> // for string
#include <vector> // for vector
@ -48,77 +49,77 @@ public:
GNSSBlockFactory() = default;
~GNSSBlockFactory() = default;
std::unique_ptr<GNSSBlockInterface> GetSignalSource(const std::shared_ptr<ConfigurationInterface>& configuration,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, int ID = -1); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetSignalSource(ConfigurationInterface* configuration,
Concurrent_Queue<pmt::pmt_t>* queue, int ID = -1); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(const std::shared_ptr<ConfigurationInterface>& configuration, int ID = -1);
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(ConfigurationInterface* configuration, int ID = -1);
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(const std::shared_ptr<ConfigurationInterface>& configuration,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(ConfigurationInterface* configuration,
Concurrent_Queue<pmt::pmt_t>* queue); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetObservables(const std::shared_ptr<ConfigurationInterface>& configuration);
std::unique_ptr<GNSSBlockInterface> GetObservables(ConfigurationInterface* configuration);
std::unique_ptr<GNSSBlockInterface> GetPVT(const std::shared_ptr<ConfigurationInterface>& configuration);
std::unique_ptr<GNSSBlockInterface> GetPVT(ConfigurationInterface* configuration);
/*!
* \brief Returns the block with the required configuration and implementation
*/
std::unique_ptr<GNSSBlockInterface> GetBlock(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetBlock(ConfigurationInterface* configuration,
const std::string& role, const std::string& implementation,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = nullptr); // NOLINT(performance-unnecessary-value-param)
Concurrent_Queue<pmt::pmt_t>* queue = nullptr); // NOLINT(performance-unnecessary-value-param)
private:
std::unique_ptr<GNSSBlockInterface> GetChannel_1C(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_1C(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_2S(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_2S(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_1B(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_1B(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_5X(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_5X(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_L5(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_L5(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_1G(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_1G(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_2G(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_2G(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_B1(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_B1(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_B3(const std::shared_ptr<ConfigurationInterface>& configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel_B3(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<AcquisitionInterface> GetAcqBlock(
const std::shared_ptr<ConfigurationInterface>& configuration,
ConfigurationInterface* configuration,
const std::string& role,
const std::string& implementation, unsigned int in_streams,
unsigned int out_streams);
std::unique_ptr<TrackingInterface> GetTrkBlock(
const std::shared_ptr<ConfigurationInterface>& configuration,
ConfigurationInterface* configuration,
const std::string& role,
const std::string& implementation, unsigned int in_streams,
unsigned int out_streams);
std::unique_ptr<TelemetryDecoderInterface> GetTlmBlock(
const std::shared_ptr<ConfigurationInterface>& configuration,
ConfigurationInterface* configuration,
const std::string& role,
const std::string& implementation, unsigned int in_streams,
unsigned int out_streams);

View File

@ -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 <boost/lexical_cast.hpp> // for boost::lexical_cast
#include <boost/tokenizer.hpp> // for boost::tokenizer
@ -52,7 +54,10 @@
#include <memory> // for std::shared_ptr
#include <set> // for set
#include <stdexcept> // for invalid_argument
#include <thread> // for thread
#include <thread> // for std::thread
#include <utility> // for std::move
#ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h>
#else
@ -63,12 +68,12 @@
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) // NOLINT(performance-unnecessary-value-param)
GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> 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<GNSSBlockFactory> block_factory_(new GNSSBlockFactory());
auto block_factory_ = std::make_unique<GNSSBlockFactory>();
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<std::vector<std::unique_ptr<GNSSBlockInterface>>> 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++)

View File

@ -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<ConfigurationInterface> configuration, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param)
GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param)
/*!
* \brief Destructor

View File

@ -27,6 +27,7 @@ endif()
target_link_libraries(gnss-sdr
PRIVATE
algorithms_libs
core_receiver
Boost::headers
Boost::thread

View File

@ -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 <boost/exception/diagnostic_information.hpp> // for diagnostic_information
#include <boost/exception/exception.hpp> // for exception
@ -139,7 +140,7 @@ int main(int argc, char** argv)
int return_code = 0;
try
{
std::unique_ptr<ControlThread> control_thread(new ControlThread());
auto control_thread = std::make_unique<ControlThread>();
// record startup time
start = std::chrono::system_clock::now();
return_code = control_thread->run();

View File

@ -20,19 +20,14 @@
#include "gnss_signal_processing.h"
#include "gps_sdr_signal_processing.h"
#include <array>
#include <chrono>
#include <complex>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
#include <vector>
TEST(CodeGenerationTest, CodeGenGPSL1Test)
{
auto* _dest = new std::complex<float>[1023];
std::array<std::complex<float>, 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<std::complex<float>>(_dest, 1023), _prn, _chip_shift);
gps_l1_ca_code_gen_complex(_dest, _prn, _chip_shift);
}
end = std::chrono::system_clock::now();
std::chrono::duration<double> 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<double>(_codeFreqBasis / _codeLength));
auto* _dest = new std::complex<float>[_samplesPerCode];
std::vector<std::complex<float>> _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<std::complex<float>>(_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<double> 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<double>(_codeFreqBasis / _codeLength));
auto* _dest = new std::complex<float>[_samplesPerCode];
std::vector<std::complex<float>> _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<std::complex<float>>(_dest, _samplesPerCode), _f, _fs);
complex_exp_gen_conj(_dest, _f, _fs);
}
end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start;
delete[] _dest;
ASSERT_LE(0, elapsed_seconds.count());
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
}

View File

@ -24,12 +24,6 @@
#include <chrono>
#include <complex>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#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<float>[FLAGS_size_carrier_test];
std::vector<std::complex<float>> output(FLAGS_size_carrier_test);
double _f = 2000.0;
double _fs = 2000000.0;
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
complex_exp_gen(own::span<std::complex<float>>(output, static_cast<unsigned int>(FLAGS_size_carrier_test)), _f, _fs);
complex_exp_gen(output, _f, _fs);
end = std::chrono::system_clock::now();
std::chrono::duration<double> 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);

View File

@ -18,6 +18,7 @@
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_make_unique.h"
#include "gnuplot_i.h"
#include "test_flags.h"
#include <gnuradio/fft/fft.h>
@ -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<gr::fft::fft_complex>(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<double>(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
{

View File

@ -19,6 +19,7 @@
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_make_unique.h"
#include <armadillo>
#include <gnuradio/fft/fft.h>
#include <chrono>
@ -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<gr::fft::fft_complex>(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<double>(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++)

View File

@ -19,6 +19,7 @@
*/
#include "GPS_L1_CA.h"
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
@ -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++)

View File

@ -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 <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp>
@ -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<ControlThread> control_thread2(new ControlThread(config));
auto control_thread2 = std::make_unique<ControlThread>(config);
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue2 = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
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

View File

@ -20,6 +20,7 @@
#include "file_configuration.h"
#include "gnss_sdr_make_unique.h"
#include <string>
@ -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<ConfigurationInterface> configuration = std::make_shared<FileConfiguration>(filename);
std::unique_ptr<ConfigurationInterface> configuration(new FileConfiguration(filename));
std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>(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<ConfigurationInterface> configuration(new FileConfiguration("./i_dont_exist.conf"));
std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>("./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<ConfigurationInterface> configuration(new FileConfiguration(filename));
std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>(filename);
std::string default_value = "default_value";
std::string value = configuration->property("whatever.whatever", default_value);
EXPECT_STREQ("default_value", value.c_str());

View File

@ -47,7 +47,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource)
// Example of a factory as a shared_ptr
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
// Example of a block as a shared_ptr
std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue);
std::shared_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
// Example of a block as a unique_ptr
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue);
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
EXPECT_EQ(nullptr, signal_source);
}
@ -71,7 +71,7 @@ TEST(GNSSBlockFactoryTest, InstantiateSignalConditioner)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner");
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> signal_conditioner = factory->GetSignalConditioner(configuration);
std::unique_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Pulse_Blanking_Filter", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter_Lite", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Resampler.implementation", "Direct_Resampler");
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1, 1);
std::unique_ptr<GNSSBlockInterface> 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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1);
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1);
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> telemetry_decoder = factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1);
std::shared_ptr<GNSSBlockInterface> 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<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = factory->GetChannels(configuration, queue);
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = factory->GetChannels(configuration.get(), queue.get());
EXPECT_EQ(static_cast<unsigned int>(2), channels->size());
channels->erase(channels->begin(), channels->end());
}
@ -312,7 +312,7 @@ TEST(GNSSBlockFactoryTest, InstantiateObservables)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Pass_Through");
std::unique_ptr<GNSSBlockFactory> 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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Hybrid_Observables");
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> observables = factory->GetObservables(configuration);
std::unique_ptr<GNSSBlockInterface> 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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "RTKLIB_PVT");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration);
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration.get());
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "Pepito");
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration);
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration.get());
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
EXPECT_EQ(nullptr, pvt);
}

View File

@ -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<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<InMemoryConfiguration> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
EXPECT_FALSE(configuration->is_present("NotThere"));
configuration->set_property("NotThere", "Yes!");
EXPECT_TRUE(configuration->is_present("NotThere"));
}
TEST(InMemoryConfiguration, StoreAndRetrieve)
{
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
bool value = configuration->property("Foo.property1", false);
bool expectedfalse = false;
EXPECT_EQ(expectedfalse, value);
}
TEST(InMemoryConfiguration, RetrieveSizeT)
{
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
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<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration);
auto configuration = std::make_unique<InMemoryConfiguration>();
unsigned int value = configuration->property("Foo.property1", 4);
unsigned int expected4 = 4;
EXPECT_EQ(expected4, value);

View File

@ -19,12 +19,13 @@
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_make_unique.h"
#include "string_converter.h"
TEST(StringConverterTest, StringToBool)
{
std::unique_ptr<StringConverter> converter(new StringConverter());
auto converter = std::make_unique<StringConverter>();
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<StringConverter> converter(new StringConverter());
auto converter = std::make_unique<StringConverter>();
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<StringConverter> converter(new StringConverter());
auto converter = std::make_unique<StringConverter>();
size_t conversion_result = converter->convert("false", 1);
unsigned int expected1 = 1;
EXPECT_EQ(expected1, conversion_result);

View File

@ -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<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);

View File

@ -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"));

View File

@ -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"));

View File

@ -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<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue.get());
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -434,7 +434,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
{
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
}
@ -448,14 +448,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -216,7 +216,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
{
init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);

View File

@ -268,7 +268,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
{
init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
}
@ -282,14 +282,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(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<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();

View File

@ -436,7 +436,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue()
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
{
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
}
@ -451,14 +451,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -555,7 +555,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue()
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
{
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
}
@ -571,7 +571,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -434,7 +434,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue()
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
{
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
}
@ -447,13 +447,13 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -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<GenSignalSource> 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<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(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"));

View File

@ -149,7 +149,7 @@ protected:
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block;
GlonassL1CaPcpsAcquisition* acquisition;
std::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition;
std::shared_ptr<InMemoryConfiguration> 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<GlonassL1CaPcpsAcquisition>(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<GlonassL1CaPcpsAcquisition>(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<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test");
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
acquisition = acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(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<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue);
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(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<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test");
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0);
acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(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<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue);
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(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;
}

Some files were not shown because too many files have changed in this diff Show More