From 141e1013631384cbd362cfd6eb3fb45e003bdc22 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Tue, 9 Apr 2019 17:39:48 +0200 Subject: [PATCH] Bug fix that restores the acquisition and tracking destructor calls due to circular smart pointer references --- .../acquisition/adapters/beidou_b1i_pcps_acquisition.cc | 2 +- .../acquisition/adapters/beidou_b1i_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/beidou_b3i_pcps_acquisition.cc | 2 +- .../acquisition/adapters/beidou_b3i_pcps_acquisition.h | 4 ++-- .../adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc | 2 +- .../adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h | 4 ++-- .../adapters/galileo_e1_pcps_ambiguous_acquisition.cc | 2 +- .../adapters/galileo_e1_pcps_ambiguous_acquisition.h | 4 ++-- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc | 2 +- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h | 4 ++-- .../adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 2 +- .../adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h | 4 ++-- .../galileo_e1_pcps_quicksync_ambiguous_acquisition.cc | 2 +- .../galileo_e1_pcps_quicksync_ambiguous_acquisition.h | 4 ++-- .../adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc | 2 +- .../adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h | 4 ++-- .../adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc | 2 +- .../adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h | 4 ++-- .../acquisition/adapters/galileo_e5a_pcps_acquisition.cc | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition.h | 4 ++-- .../adapters/galileo_e5a_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h | 4 ++-- .../acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc | 2 +- .../acquisition/adapters/glonass_l1_ca_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc | 2 +- .../acquisition/adapters/glonass_l2_ca_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.h | 4 ++-- .../adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc | 2 +- .../adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h | 4 ++-- .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h | 4 ++-- .../adapters/gps_l1_ca_pcps_assisted_acquisition.cc | 2 +- .../adapters/gps_l1_ca_pcps_assisted_acquisition.h | 4 ++-- .../adapters/gps_l1_ca_pcps_opencl_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h | 4 ++-- .../adapters/gps_l1_ca_pcps_quicksync_acquisition.cc | 2 +- .../adapters/gps_l1_ca_pcps_quicksync_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l2_m_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h | 4 ++-- .../acquisition/adapters/gps_l5i_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h | 4 ++-- .../galileo_e5a_noncoherent_iq_acquisition_caf_cc.h | 4 ++-- .../gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h | 4 ++-- .../acquisition/gnuradio_blocks/pcps_acquisition.cc | 5 +++-- .../acquisition/gnuradio_blocks/pcps_acquisition.h | 4 ++-- .../gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h | 4 ++-- .../acquisition/gnuradio_blocks/pcps_acquisition_fpga.h | 4 ++-- .../gnuradio_blocks/pcps_assisted_acquisition_cc.h | 4 ++-- .../acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h | 4 ++-- .../acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h | 4 ++-- .../gnuradio_blocks/pcps_quicksync_acquisition_cc.h | 4 ++-- .../acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h | 4 ++-- src/core/interfaces/acquisition_interface.h | 2 +- 60 files changed, 96 insertions(+), 95 deletions(-) diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc index b5423c471..7317dbc0b 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc @@ -123,7 +123,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h index 05965a97f..f274d3ee6 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h @@ -102,7 +102,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -173,7 +173,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; uint32_t channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; uint32_t doppler_max_; uint32_t doppler_step_; diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc index 7d458c855..6855d11fb 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc @@ -121,7 +121,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h index 93f65a89d..d824c132a 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -172,7 +172,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 25ff95866..6c0f61c30 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -110,7 +110,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index 265bf9701..27e9049de 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -156,7 +156,7 @@ private: unsigned int vector_length_; unsigned int code_length_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 4d9df2c64..ea1b9ea73 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -154,7 +154,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index ea2d18b27..12aebab73 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -100,7 +100,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -171,7 +171,7 @@ private: bool use_CFAR_algorithm_flag_; bool acquire_pilot_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index bdfc0bed7..e153aff18 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -187,7 +187,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + // temporary buffers that we can delete delete[] code; delete fft_if; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index ff63d49c9..83c3f66f5 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -99,7 +99,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -157,7 +157,7 @@ private: pcps_acquisition_fpga_sptr acquisition_fpga_; bool acquire_pilot_; uint32_t channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; uint32_t doppler_max_; uint32_t doppler_step_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 212d739cc..1375a22a8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -111,7 +111,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h index 46957d533..b79fe2d33 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -155,7 +155,7 @@ private: unsigned int code_length_; //unsigned int satellite_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index f3a1cc016..a64b3abda 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -144,7 +144,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h index b29b808a8..c717c4ed7 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -159,7 +159,7 @@ private: unsigned int code_length_; bool bit_transition_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index cc087c4a7..6bc6b8ad3 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -114,7 +114,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index 0893f731c..2cb201866 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -157,7 +157,7 @@ private: unsigned int vector_length_; unsigned int code_length_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 6f971d094..3828c58e6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -119,7 +119,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h index 6d709894f..aefcd7a23 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -160,7 +160,7 @@ private: unsigned int code_length_; bool bit_transition_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 102854469..20880ba15 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -152,7 +152,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h index b3c43d542..832f3223a 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h @@ -88,7 +88,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -169,7 +169,7 @@ private: unsigned int vector_length_; unsigned int code_length_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; unsigned int doppler_max_; unsigned int doppler_step_; unsigned int sampled_ms_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index ed47a80ce..24d48be8f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -189,7 +189,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + // temporary buffers that we can delete delete[] code; delete fft_if; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 8863355bb..d30868547 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -176,7 +176,7 @@ private: bool acq_iq_; uint32_t channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; uint32_t doppler_max_; uint32_t doppler_step_; unsigned int in_streams_; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index 0f3b63feb..c12ec73c2 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -125,7 +125,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h index 91229faa8..a9a6fd18a 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -162,7 +162,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc index bb82680b6..0b7056da3 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -124,7 +124,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h index a063d0532..09b66fbe7 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -162,7 +162,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 32dce833f..0c6b9b2d5 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -147,7 +147,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index ab2ed82d7..8d3f0fb64 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -104,7 +104,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -174,7 +174,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index da2b73132..6dfcd6452 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -97,7 +97,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h index 2b7daf80e..d310bcfbb 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -152,7 +152,7 @@ private: std::string item_type_; unsigned int vector_length_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 9cb95ba34..50953fcc9 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -169,7 +169,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + // temporary buffers that we can delete delete[] code; delete fft_if; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index 2b627ec00..f0f652a99 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -103,7 +103,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -160,7 +160,7 @@ private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; uint32_t channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; uint32_t doppler_max_; uint32_t doppler_step_; Gnss_Synchro* gnss_synchro_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 2880d3c74..efe1dcb1a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -89,7 +89,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 13560238e..222bfafe8 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -149,7 +149,7 @@ private: unsigned int vector_length_; //unsigned int satellite_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc index 277db1fac..90abee071 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc @@ -105,7 +105,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index 29da366a6..cb481fb46 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -154,7 +154,7 @@ private: unsigned int code_length_; bool bit_transition_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 578a01d4f..37a91768d 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -137,7 +137,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h index fadd57f73..110589952 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -160,7 +160,7 @@ private: unsigned int code_length_; bool bit_transition_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index d1fdeb95d..b81877010 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -99,7 +99,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index 5fac3c436..856b1c603 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); @@ -158,7 +158,7 @@ private: unsigned int vector_length_; unsigned int code_length_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index bb796e769..6e529684c 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -151,7 +151,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code; if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index 1c7c591bb..d189a3032 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -171,7 +171,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 2e289b440..ac9517db2 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -161,7 +161,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + threshold_ = 0.0; } diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index e99b40508..7c30efb85 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -100,7 +100,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -158,7 +158,7 @@ private: pcps_acquisition_fpga_sptr acquisition_fpga_; std::string item_type_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 376e3b00c..7a587598a 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -147,7 +147,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index fa157024e..576c86e33 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); @@ -170,7 +170,7 @@ private: bool bit_transition_flag_; bool use_CFAR_algorithm_flag_; unsigned int channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; float threshold_; unsigned int doppler_max_; unsigned int doppler_step_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index ceeaed722..32cbf6477 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -172,7 +172,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; - channel_fsm_ = nullptr; + // temporary buffers that we can delete delete[] code; delete fft_if; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index cf1c9e856..ebcbe5f31 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) override + inline void set_channel_fsm(std::weak_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -159,7 +159,7 @@ private: pcps_acquisition_fpga_sptr acquisition_fpga_; std::string item_type_; uint32_t channel_; - std::shared_ptr channel_fsm_; + std::weak_ptr channel_fsm_; uint32_t doppler_max_; uint32_t doppler_step_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h index 8604478b3..3e635797f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h @@ -100,7 +100,7 @@ private: int doppler_offset); float estimate_input_power(gr_complex* in); - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; int64_t d_fs_in; int d_samples_per_ms; int d_sampled_ms; @@ -216,7 +216,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h index 9e8ad5e0f..79c6719a5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h @@ -118,7 +118,7 @@ private: int32_t d_state; bool d_dump; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; public: @@ -186,7 +186,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 92b72f774..a13794974 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -429,10 +429,11 @@ void pcps_acquisition::send_positive_acquisition() << ", magnitude " << d_mag << ", input signal power " << d_input_power; d_positive_acq = 1; - if (d_channel_fsm) + + if (!d_channel_fsm.expired()) { //the channel FSM is set, so, notify it directly the positive acquisition to minimize delays - d_channel_fsm->Event_valid_acquisition(); + d_channel_fsm.lock()->Event_valid_acquisition(); } else { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index eeb56b66c..f7fa05ddd 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -124,7 +124,7 @@ private: int64_t d_old_freq; int32_t d_state; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; uint32_t d_doppler_step; float d_doppler_center_step_two; uint32_t d_num_noncoherent_integrations_counter; @@ -213,7 +213,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h index e1d8d1412..358d23d25 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h @@ -122,7 +122,7 @@ private: int d_n_samples_in_buffer; bool d_dump; unsigned int d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; @@ -189,7 +189,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index cf2ff1111..307dcba45 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -111,7 +111,7 @@ private: float d_test_statistics; int32_t d_state; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; uint32_t d_doppler_step; uint32_t d_doppler_max; uint32_t d_fft_size; @@ -190,7 +190,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h index 1fcda44ea..d27daf16b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h @@ -138,7 +138,7 @@ private: int32_t d_well_count; bool d_dump; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; public: @@ -199,7 +199,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h index 341207dbf..2ff002481 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h @@ -117,7 +117,7 @@ private: int32_t d_state; bool d_dump; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; public: @@ -186,7 +186,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h index 230338d09..71501400c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h @@ -162,7 +162,7 @@ private: cl::CommandQueue* d_cl_queue; clFFT_Plan d_cl_fft_plan; cl_int d_cl_fft_batch_size; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; int d_opencl; public: @@ -230,7 +230,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h index d4626aa5e..cf610c8f3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h @@ -151,7 +151,7 @@ private: int32_t d_state; bool d_dump; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; public: @@ -219,7 +219,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h index 8b38da0b7..9288a83dd 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h @@ -134,7 +134,7 @@ private: int32_t d_state; bool d_dump; uint32_t d_channel; - std::shared_ptr d_channel_fsm; + std::weak_ptr d_channel_fsm; std::string d_dump_filename; public: @@ -202,7 +202,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::weak_ptr channel_fsm) { d_channel_fsm = channel_fsm; } diff --git a/src/core/interfaces/acquisition_interface.h b/src/core/interfaces/acquisition_interface.h index 8e8fdbb43..641df0792 100644 --- a/src/core/interfaces/acquisition_interface.h +++ b/src/core/interfaces/acquisition_interface.h @@ -58,7 +58,7 @@ class AcquisitionInterface : public GNSSBlockInterface public: virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; virtual void set_channel(unsigned int channel_id) = 0; - virtual void set_channel_fsm(std::shared_ptr channel_fsm) = 0; + virtual void set_channel_fsm(std::weak_ptr channel_fsm) = 0; virtual void set_threshold(float threshold) = 0; virtual void set_doppler_max(unsigned int doppler_max) = 0; virtual void set_doppler_step(unsigned int doppler_step) = 0;