From 307373e362a1734e010dd71f15b131a4242abdd1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2019 13:03:01 +0200 Subject: [PATCH] Avoid unnecessary copy of channel_fsm --- ...eo_e5a_noncoherent_iq_acquisition_caf_cc.h | 76 +++++++++--------- .../galileo_pcps_8ms_acquisition_cc.h | 9 ++- .../gnuradio_blocks/pcps_acquisition.h | 72 ++++++++--------- .../pcps_acquisition_fine_doppler_cc.h | 9 ++- .../pcps_assisted_acquisition_cc.h | 8 +- .../pcps_cccwsr_acquisition_cc.h | 71 ++++++++--------- .../pcps_quicksync_acquisition_cc.h | 9 ++- .../pcps_tong_acquisition_cc.h | 77 ++++++++++--------- 8 files changed, 169 insertions(+), 162 deletions(-) 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 3e635797f..adecd3a87 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 @@ -45,6 +45,7 @@ #include #include #include +#include class galileo_e5a_noncoherentIQ_acquisition_caf_cc; @@ -159,98 +160,99 @@ public: ~galileo_e5a_noncoherentIQ_acquisition_caf_cc(); /*! - * \brief Set acquisition/tracking common Gnss_Synchro object pointer - * to exchange synchronization data between acquisition and tracking blocks. - * \param p_gnss_synchro Satellite information shared by the processing blocks. - */ + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to exchange synchronization data between acquisition and tracking blocks. + * \param p_gnss_synchro Satellite information shared by the processing blocks. + */ inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { d_gnss_synchro = p_gnss_synchro; } /*! - * \brief Returns the maximum peak of grid search. - */ + * \brief Returns the maximum peak of grid search. + */ inline unsigned int mag() const { return d_mag; } /*! - * \brief Initializes acquisition algorithm. - */ + * \brief Initializes acquisition algorithm. + */ void init(); /*! - * \brief Sets local code for PCPS acquisition algorithm. - * \param code - Pointer to the PRN code. - */ + * \brief Sets local code for PCPS acquisition algorithm. + * \param code - Pointer to the PRN code. + */ void set_local_code(std::complex* code, std::complex* codeQ); /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ inline void set_active(bool active) { d_active = active; } /*! - * \brief If set to 1, ensures that acquisition starts at the - * first available sample. - * \param state - int=1 forces start of acquisition - */ + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ void set_state(int state); /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ inline void set_channel(unsigned int channel) { d_channel = channel; } /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! - * \brief Set statistics threshold of PCPS algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ + * \brief Set statistics threshold of PCPS algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ inline void set_threshold(float threshold) { d_threshold = threshold; } /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ inline void set_doppler_max(unsigned int doppler_max) { d_doppler_max = doppler_max; } /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ inline void set_doppler_step(unsigned int doppler_step) { d_doppler_step = doppler_step; } /*! - * \brief Parallel Code Phase Search Acquisition signal processing. - */ + * \brief Parallel Code Phase Search Acquisition signal processing. + */ int general_work(int noutput_items, gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items); 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 79c6719a5..b080c1ef4 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 @@ -39,6 +39,7 @@ #include #include #include +#include class galileo_pcps_8ms_acquisition_cc; @@ -182,14 +183,14 @@ public: d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm. * \param threshold - Threshold for signal detection (check \ref Navitec2012, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index f7fa05ddd..42e2df1bc 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -63,6 +63,7 @@ #include // for lv_16sc_t #include #include +#include class Gnss_Synchro; class pcps_acquisition; @@ -153,10 +154,10 @@ public: ~pcps_acquisition(); /*! - * \brief Set acquisition/tracking common Gnss_Synchro object pointer - * to exchange synchronization data between acquisition and tracking blocks. - * \param p_gnss_synchro Satellite information shared by the processing blocks. - */ + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to exchange synchronization data between acquisition and tracking blocks. + * \param p_gnss_synchro Satellite information shared by the processing blocks. + */ inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler @@ -172,21 +173,21 @@ public: } /*! - * \brief Initializes acquisition algorithm and reserves memory. - */ + * \brief Initializes acquisition algorithm and reserves memory. + */ void init(); /*! - * \brief Sets local code for PCPS acquisition algorithm. - * \param code - Pointer to the PRN code. - */ + * \brief Sets local code for PCPS acquisition algorithm. + * \param code - Pointer to the PRN code. + */ void set_local_code(std::complex* code); /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ inline void set_active(bool active) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler @@ -194,35 +195,34 @@ public: } /*! - * \brief If set to 1, ensures that acquisition starts at the - * first available sample. - * \param state - int=1 forces start of acquisition - */ + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ void set_state(int32_t state); /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ inline void set_channel(uint32_t channel) { d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } /*! - * \brief Set statistics threshold of PCPS algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ + * \brief Set statistics threshold of PCPS algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ inline void set_threshold(float threshold) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler @@ -230,9 +230,9 @@ public: } /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ inline void set_doppler_max(uint32_t doppler_max) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler @@ -240,9 +240,9 @@ public: } /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ inline void set_doppler_step(uint32_t doppler_step) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler @@ -253,8 +253,8 @@ public: void set_resampler_latency(uint32_t latency_samples); /*! - * \brief Parallel Code Phase Search Acquisition signal processing. - */ + * \brief Parallel Code Phase Search Acquisition signal processing. + */ int general_work(int noutput_items, gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items); 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 358d23d25..2f992c1fc 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 @@ -59,6 +59,7 @@ #include #include #include +#include class pcps_acquisition_fine_doppler_cc; @@ -185,14 +186,14 @@ public: d_dump_channel = d_channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm. * \param threshold - Threshold for signal detection (check \ref Navitec2012, 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 d27daf16b..e05aa2266 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h @@ -55,6 +55,7 @@ #include #include #include +#include class pcps_assisted_acquisition_cc; @@ -195,13 +196,12 @@ public: d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(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 2ff002481..3c53c54cc 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h @@ -44,6 +44,7 @@ #include #include #include +#include class pcps_cccwsr_acquisition_cc; @@ -137,90 +138,90 @@ public: } /*! - * \brief Returns the maximum peak of grid search. - */ + * \brief Returns the maximum peak of grid search. + */ inline uint32_t mag() const { return d_mag; } /*! - * \brief Initializes acquisition algorithm. - */ + * \brief Initializes acquisition algorithm. + */ void init(); /*! - * \brief Sets local code for CCCWSR acquisition algorithm. - * \param data_code - Pointer to the data PRN code. - * \param pilot_code - Pointer to the pilot PRN code. - */ + * \brief Sets local code for CCCWSR acquisition algorithm. + * \param data_code - Pointer to the data PRN code. + * \param pilot_code - Pointer to the pilot PRN code. + */ void set_local_code(std::complex* code_data, std::complex* code_pilot); /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ inline void set_active(bool active) { d_active = active; } /*! - * \brief If set to 1, ensures that acquisition starts at the - * first available sample. - * \param state - int=1 forces start of acquisition - */ + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ void set_state(int32_t state); /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ inline void set_channel(uint32_t channel) { d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! - * \brief Set statistics threshold of CCCWSR algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ + * \brief Set statistics threshold of CCCWSR algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ inline void set_threshold(float threshold) { d_threshold = threshold; } /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ inline void set_doppler_max(uint32_t doppler_max) { d_doppler_max = doppler_max; } /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ inline void set_doppler_step(uint32_t doppler_step) { d_doppler_step = doppler_step; } /*! - * \brief Coherent Channel Combining With Sign Recovery Acquisition signal processing. - */ + * \brief Coherent Channel Combining With Sign Recovery Acquisition signal processing. + */ int general_work(int noutput_items, gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items); 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 cf610c8f3..c03c0e916 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h @@ -61,6 +61,7 @@ #include #include #include +#include class pcps_quicksync_acquisition_cc; @@ -215,14 +216,14 @@ public: d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm. * \param threshold - Threshold for signal detection (check \ref Navitec2012, 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 9288a83dd..a88c488b2 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h @@ -58,6 +58,7 @@ #include #include #include +#include class pcps_tong_acquisition_cc; @@ -144,99 +145,99 @@ public: ~pcps_tong_acquisition_cc(); /*! - * \brief Set acquisition/tracking common Gnss_Synchro object pointer - * to exchange synchronization data between acquisition and tracking blocks. - * \param p_gnss_synchro Satellite information shared by the processing blocks. - */ + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to exchange synchronization data between acquisition and tracking blocks. + * \param p_gnss_synchro Satellite information shared by the processing blocks. + */ inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { d_gnss_synchro = p_gnss_synchro; } /*! - * \brief Returns the maximum peak of grid search. - */ + * \brief Returns the maximum peak of grid search. + */ inline uint32_t mag() const { return d_mag; } /*! - * \brief Initializes acquisition algorithm. - */ + * \brief Initializes acquisition algorithm. + */ void init(); /*! - * \brief Sets local code for TONG acquisition algorithm. - * \param code - Pointer to the PRN code. - */ + * \brief Sets local code for TONG acquisition algorithm. + * \param code - Pointer to the PRN code. + */ void set_local_code(std::complex* code); /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ inline void set_active(bool active) { d_active = active; } /*! - * \brief If set to 1, ensures that acquisition starts at the - * first available sample. - * \param state - int=1 forces start of acquisition - */ + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ void set_state(int32_t state); /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ inline void set_channel(uint32_t channel) { d_channel = channel; } - /*! - * \brief Set channel fsm associated to this acquisition instance - */ + * \brief Set channel fsm associated to this acquisition instance + */ inline void set_channel_fsm(std::weak_ptr channel_fsm) { - d_channel_fsm = channel_fsm; + d_channel_fsm = std::move(channel_fsm); } + /*! - * \brief Set statistics threshold of TONG algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ + * \brief Set statistics threshold of TONG algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ inline void set_threshold(float threshold) { d_threshold = threshold; } /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ inline void set_doppler_max(uint32_t doppler_max) { d_doppler_max = doppler_max; } /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ inline void set_doppler_step(uint32_t doppler_step) { d_doppler_step = doppler_step; } /*! - * \brief Parallel Code Phase Search Acquisition signal processing. - */ + * \brief Parallel Code Phase Search Acquisition signal processing. + */ int general_work(int noutput_items, gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);