1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-23 11:37:40 +00:00

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
135 changed files with 1295 additions and 1302 deletions

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