diff --git a/CMakeLists.txt b/CMakeLists.txt index b41ff86ee..5306e177e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,6 +557,19 @@ endif() +################################################################################ +# Detect availability of std::span +################################################################################ +include(CheckCXXSourceCompiles) +check_cxx_source_compiles(" + #include + int main() + { std::span s; }" + has_span +) + + + ################################################################################ # Boost - https://www.boost.org ################################################################################ diff --git a/docs/changelog.md b/docs/changelog.md index 311d5b391..2116f81dc 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -26,6 +26,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif + BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( ConfigurationInterface* configuration, @@ -140,7 +147,7 @@ void BeidouB1iPcpsAcquisition::set_local_code() beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < num_codes_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc index 1342c7227..065f771a6 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc @@ -27,6 +27,13 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif + using google::LogMessage; BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition( @@ -137,7 +144,7 @@ void BeidouB3iPcpsAcquisition::set_local_code() beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < num_codes_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 a3cc7275b..a8958f635 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 @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( ConfigurationInterface* configuration, @@ -208,7 +214,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code() galileo_e1_code_gen_complex_sampled(code, Signal_, cboc, gnss_synchro_->PRN, fs_in_, 0, false); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_ / 4; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 b11d0b393..dfe71a321 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -28,6 +28,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( ConfigurationInterface* configuration, @@ -182,7 +188,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code() } } - gsl::span code__span(code_.data(), vector_length_); + std::span code__span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_ / 4; i++) { std::copy_n(code.data(), code_length_, code__span.subspan(i * code_length_, code_length_).data()); 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 32e0013ad..ae47b0351 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 @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition( ConfigurationInterface* configuration, @@ -242,7 +248,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code() galileo_e1_code_gen_complex_sampled(code, Signal_, cboc, gnss_synchro_->PRN, fs_in_, 0, false); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 ca85e12b6..02b6bd8d3 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 @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( ConfigurationInterface* configuration, @@ -211,7 +217,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code() galileo_e1_code_gen_complex_sampled(code, Signal_, cboc, gnss_synchro_->PRN, fs_in_, 0, false); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_ / 4; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 b35865a5f..fbeb8ca64 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 @@ -33,6 +33,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( ConfigurationInterface* configuration, @@ -226,8 +232,8 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code() } // WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1) // is generated, and modulated in the 'block'. - gsl::span codeQ_span(codeQ_.data(), vector_length_); - gsl::span codeI_span(codeI_.data(), vector_length_); + std::span codeQ_span(codeQ_.data(), vector_length_); + std::span codeI_span(codeI_.data(), vector_length_); if (Zero_padding == 0) // if no zero_padding { for (unsigned int i = 0; i < sampled_ms_; i++) diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index e8ea07368..5a31ad0ee 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration, const std::string& role, @@ -166,7 +172,7 @@ void GalileoE5aPcpsAcquisition::set_local_code() { galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0); } - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 e5e453119..0af7954ce 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -29,6 +29,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( ConfigurationInterface* configuration, @@ -142,7 +148,7 @@ void GlonassL1CaPcpsAcquisition::set_local_code() glonass_l1_ca_code_gen_complex_sampled(code, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 0fd4437f3..508152ffb 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -28,6 +28,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( ConfigurationInterface* configuration, @@ -141,7 +147,7 @@ void GlonassL2CaPcpsAcquisition::set_local_code() glonass_l2_ca_code_gen_complex_sampled(code, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 176aa717e..a5a65d26a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -29,9 +29,15 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_processing.h" #include -#include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif + GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( ConfigurationInterface* configuration, @@ -157,7 +163,7 @@ void GpsL1CaPcpsAcquisition::set_local_code() { gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.fs_in, 0); } - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 e6b677a38..ed79ecb52 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 @@ -59,7 +59,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( // --- Find number of samples per spreading code ------------------------- vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); - code_ = std::make_shared>(vector_length_); + code_.reserve(vector_length_); if (item_type_ == "gr_complex") { @@ -138,7 +138,7 @@ void GpsL1CaPcpsAssistedAcquisition::init() void GpsL1CaPcpsAssistedAcquisition::set_local_code() { gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0); - acquisition_cc_->set_local_code(code_.get()); + acquisition_cc_->set_local_code(code_.data()); } 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 01f51861e..157d22e44 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 @@ -26,7 +26,6 @@ #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_assisted_acquisition_cc.h" -#include #include #include @@ -150,7 +149,7 @@ private: int64_t fs_in_; bool dump_; std::string dump_filename_; - std::shared_ptr> code_; + std::vector> code_; Gnss_Synchro* gnss_synchro_; std::string role_; unsigned int in_streams_; 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 47789fee5..9627af978 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 @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( ConfigurationInterface* configuration, @@ -198,7 +204,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code() gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 c4a3f2646..aafc2d373 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 @@ -28,6 +28,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( ConfigurationInterface* configuration, @@ -224,7 +230,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code() gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 6df782095..768cfc1b8 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 @@ -27,6 +27,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( ConfigurationInterface* configuration, @@ -186,7 +192,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code() gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < sampled_ms_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); 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 1100e8970..23a7c6f8a 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -29,6 +29,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( ConfigurationInterface* configuration, @@ -156,7 +162,7 @@ void GpsL2MPcpsAcquisition::set_local_code() gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); } - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < num_codes_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 4c63215db..a892f5f2d 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -29,6 +29,12 @@ #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( ConfigurationInterface* configuration, @@ -158,7 +164,7 @@ void GpsL5iPcpsAcquisition::set_local_code() gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); } - gsl::span code_span(code_.data(), vector_length_); + std::span code_span(code_.data(), vector_length_); for (unsigned int i = 0; i < num_codes_; i++) { std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index 8a27ca0b9..8ff77ec73 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -93,6 +93,12 @@ if(ENABLE_ARMA_NO_DEBUG) ) endif() +if(has_span) + target_compile_definitions(acquisition_gr_blocks + PRIVATE -DHAS_STD_SPAN=1 + ) +endif() + if(ENABLE_OPENCL) target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL) target_include_directories(acquisition_gr_blocks diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 80fb00959..23a063b88 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -252,7 +252,7 @@ bool pcps_acquisition::is_fdma() } -void pcps_acquisition::update_local_carrier(gsl::span carrier_vector, float freq) +void pcps_acquisition::update_local_carrier(std::span carrier_vector, float freq) { float phase_step_rad; if (acq_parameters.use_automatic_resampler) @@ -264,7 +264,7 @@ void pcps_acquisition::update_local_carrier(gsl::span carrier_vector phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.fs_in); } std::array _phase{}; - volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.length()); + volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.size()); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 7ea5b10dc..86ef450c9 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -54,7 +54,6 @@ #include // for gr_complex #include // for scoped_lock #include // for gr_vector_const_void_star -#include // for Guidelines Support Library #include // for lv_16sc_t #include // for volk_gnsssdr::vector #include @@ -62,6 +61,14 @@ #include #include #include + +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif + #if GNURADIO_USES_STD_POINTERS #else #include @@ -255,7 +262,7 @@ private: Gnss_Synchro* d_gnss_synchro; arma::fmat grid_; arma::fmat narrow_grid_; - void update_local_carrier(gsl::span carrier_vector, float freq); + void update_local_carrier(std::span carrier_vector, float freq); void update_grid_doppler_wipeoffs(); void update_grid_doppler_wipeoffs_step2(); void acquisition_core(uint64_t samp_count); diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index dcf5f1636..05d2da68f 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -85,10 +85,12 @@ else() target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system) endif() -target_include_directories(algorithms_libs - PUBLIC - ${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include -) +if(NOT has_span) + target_include_directories(algorithms_libs + PUBLIC + ${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include + ) +endif() target_link_libraries(algorithms_libs PUBLIC @@ -110,6 +112,12 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() +if(has_span) + target_compile_definitions(algorithms_libs + PUBLIC -DHAS_STD_SPAN=1 + ) +endif() + if(ENABLE_OPENCL) target_link_libraries(algorithms_libs PUBLIC OpenCL::OpenCL) target_include_directories(algorithms_libs PUBLIC diff --git a/src/algorithms/libs/beidou_b1i_signal_processing.cc b/src/algorithms/libs/beidou_b1i_signal_processing.cc index d19ef8b68..f0b404459 100644 --- a/src/algorithms/libs/beidou_b1i_signal_processing.cc +++ b/src/algorithms/libs/beidou_b1i_signal_processing.cc @@ -26,7 +26,7 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast((x) + 1)); }; -void beidou_b1i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b1i_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 2046; std::bitset<_code_length> G1{}; @@ -101,12 +101,12 @@ void beidou_b1i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _c } -void beidou_b1i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b1i_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 2046; std::array b1i_code_int{}; - beidou_b1i_code_gen_int(gsl::span(b1i_code_int.data(), _code_length), _prn, _chip_shift); + beidou_b1i_code_gen_int(std::span(b1i_code_int.data(), _code_length), _prn, _chip_shift); for (uint32_t ii = 0; ii < _code_length; ++ii) { @@ -115,12 +115,12 @@ void beidou_b1i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _c } -void beidou_b1i_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b1i_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 2046; std::array b1i_code_int{}; - beidou_b1i_code_gen_int(gsl::span(b1i_code_int.data(), _code_length), _prn, _chip_shift); + beidou_b1i_code_gen_int(std::span(b1i_code_int.data(), _code_length), _prn, _chip_shift); for (uint32_t ii = 0; ii < _code_length; ++ii) { @@ -132,7 +132,7 @@ void beidou_b1i_code_gen_complex(gsl::span> _dest, int32_t _ /* * Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency */ -void beidou_b1i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) +void beidou_b1i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::array, 2046> _code{}; diff --git a/src/algorithms/libs/beidou_b1i_signal_processing.h b/src/algorithms/libs/beidou_b1i_signal_processing.h index a16f78e7e..c0cc9e964 100644 --- a/src/algorithms/libs/beidou_b1i_signal_processing.h +++ b/src/algorithms/libs/beidou_b1i_signal_processing.h @@ -22,23 +22,28 @@ #ifndef GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates int32_t GPS L1 C/A code for the desired SV ID and code shift -void beidou_b1i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b1i_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates float GPS L1 C/A code for the desired SV ID and code shift -void beidou_b1i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b1i_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency -void beidou_b1i_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b1i_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift); //! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift -void beidou_b1i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); +void beidou_b1i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); //! Generates complex GPS L1 C/A code for the desired SV ID and code shift -void beidou_b1i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); +void beidou_b1i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); #endif // GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/beidou_b3i_signal_processing.cc b/src/algorithms/libs/beidou_b3i_signal_processing.cc index ffceaf55b..82543c7cf 100644 --- a/src/algorithms/libs/beidou_b3i_signal_processing.cc +++ b/src/algorithms/libs/beidou_b3i_signal_processing.cc @@ -26,7 +26,7 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast((x) + 1)); }; -void beidou_b3i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b3i_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 10230; std::bitset<_code_length> G1{}; @@ -168,7 +168,7 @@ void beidou_b3i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_ } -void beidou_b3i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b3i_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 10230; std::array b3i_code_int{}; @@ -182,7 +182,7 @@ void beidou_b3i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _c } -void beidou_b3i_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift) +void beidou_b3i_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 10230; std::array b3i_code_int{}; @@ -196,7 +196,7 @@ void beidou_b3i_code_gen_complex(gsl::span> _dest, int32_t _ } -void beidou_b3i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift) +void beidou_b3i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::array, 10230> _code{}; diff --git a/src/algorithms/libs/beidou_b3i_signal_processing.h b/src/algorithms/libs/beidou_b3i_signal_processing.h index 0b9543fe7..d5691cd98 100644 --- a/src/algorithms/libs/beidou_b3i_signal_processing.h +++ b/src/algorithms/libs/beidou_b3i_signal_processing.h @@ -22,23 +22,29 @@ #ifndef GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H #define GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif + //! Generates int BeiDou B3I code for the desired SV ID and code shift -void beidou_b3i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b3i_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates float BeiDou B3I code for the desired SV ID and code shift -void beidou_b3i_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b3i_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates complex BeiDou B3I code for the desired SV ID and code shift, and sampled to specific sampling frequency -void beidou_b3i_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift); +void beidou_b3i_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift); //! Generates N complex BeiDou B3I codes for the desired SV ID and code shift -void beidou_b3i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift, uint32_t _ncodes); +void beidou_b3i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift, uint32_t _ncodes); //! Generates complex BeiDou B3I code for the desired SV ID and code shift -void beidou_b3i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift); +void beidou_b3i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift); #endif // GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/galileo_e1_signal_processing.cc b/src/algorithms/libs/galileo_e1_signal_processing.cc index 30ac90b81..ea1d42666 100644 --- a/src/algorithms/libs/galileo_e1_signal_processing.cc +++ b/src/algorithms/libs/galileo_e1_signal_processing.cc @@ -28,7 +28,7 @@ #include -void galileo_e1_code_gen_int(gsl::span _dest, const std::array& _Signal, int32_t _prn) +void galileo_e1_code_gen_int(std::span _dest, const std::array& _Signal, int32_t _prn) { std::string _galileo_signal = _Signal.data(); int32_t prn = _prn - 1; @@ -59,7 +59,7 @@ void galileo_e1_code_gen_int(gsl::span _dest, const std::array& _S } -void galileo_e1_sinboc_11_gen_int(gsl::span _dest, gsl::span _prn) +void galileo_e1_sinboc_11_gen_int(std::span _dest, std::span _prn) { const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS; auto _period = static_cast(_dest.size() / _length_in); @@ -77,7 +77,7 @@ void galileo_e1_sinboc_11_gen_int(gsl::span _dest, gsl::span _pr } -void galileo_e1_sinboc_61_gen_int(gsl::span _dest, gsl::span _prn) +void galileo_e1_sinboc_61_gen_int(std::span _dest, std::span _prn) { const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS; auto _period = static_cast(_dest.size() / _length_in); @@ -96,7 +96,7 @@ void galileo_e1_sinboc_61_gen_int(gsl::span _dest, gsl::span _pr } -void galileo_e1_code_gen_sinboc11_float(gsl::span _dest, const std::array& _Signal, uint32_t _prn) +void galileo_e1_code_gen_sinboc11_float(std::span _dest, const std::array& _Signal, uint32_t _prn) { std::string _galileo_signal = _Signal.data(); const auto _codeLength = static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS); @@ -110,7 +110,7 @@ void galileo_e1_code_gen_sinboc11_float(gsl::span _dest, const std::array } -void galileo_e1_gen_float(gsl::span _dest, gsl::span _prn, const std::array& _Signal) +void galileo_e1_gen_float(std::span _dest, std::span _prn, const std::array& _Signal) { std::string _galileo_signal = _Signal.data(); const uint32_t _codeLength = 12 * GALILEO_E1_B_CODE_LENGTH_CHIPS; @@ -119,8 +119,8 @@ void galileo_e1_gen_float(gsl::span _dest, gsl::span _prn, const std std::array sinboc_11{}; std::array sinboc_61{}; - gsl::span sinboc_11_(sinboc_11.data(), _codeLength); - gsl::span sinboc_61_(sinboc_61.data(), _codeLength); + std::span sinboc_11_(sinboc_11.data(), _codeLength); + std::span sinboc_61_(sinboc_61.data(), _codeLength); galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); // generate sinboc(1,1) 12 samples per chip galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); // generate sinboc(6,1) 12 samples per chip @@ -144,7 +144,7 @@ void galileo_e1_gen_float(gsl::span _dest, gsl::span _prn, const std } -void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array& _Signal, +void galileo_e1_code_gen_float_sampled(std::span _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _secondary_flag) { @@ -210,7 +210,7 @@ void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array< } -void galileo_e1_code_gen_complex_sampled(gsl::span> _dest, const std::array& _Signal, +void galileo_e1_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _secondary_flag) { @@ -234,14 +234,14 @@ void galileo_e1_code_gen_complex_sampled(gsl::span> _dest, c } -void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array& _Signal, +void galileo_e1_code_gen_float_sampled(std::span _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) { galileo_e1_code_gen_float_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false); } -void galileo_e1_code_gen_complex_sampled(gsl::span> _dest, const std::array& _Signal, +void galileo_e1_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) { galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false); diff --git a/src/algorithms/libs/galileo_e1_signal_processing.h b/src/algorithms/libs/galileo_e1_signal_processing.h index 4e5e16f3f..4c231e4d0 100644 --- a/src/algorithms/libs/galileo_e1_signal_processing.h +++ b/src/algorithms/libs/galileo_e1_signal_processing.h @@ -21,24 +21,29 @@ #ifndef GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H #define GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H -#include #include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif /*! * \brief This function generates Galileo E1 code (can select E1B or E1C sinboc). * */ -void galileo_e1_code_gen_sinboc11_float(gsl::span _dest, const std::array& _Signal, uint32_t _prn); +void galileo_e1_code_gen_sinboc11_float(std::span _dest, const std::array& _Signal, uint32_t _prn); /*! * \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc * and the sample frequency _fs). * */ -void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array& _Signal, +void galileo_e1_code_gen_float_sampled(std::span _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _secondary_flag); @@ -47,7 +52,7 @@ void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array< * and the sample frequency _fs). * */ -void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array& _Signal, +void galileo_e1_code_gen_float_sampled(std::span _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); /*! @@ -55,14 +60,14 @@ void galileo_e1_code_gen_float_sampled(gsl::span _dest, const std::array< * and the sample frequency _fs). * */ -void galileo_e1_code_gen_complex_sampled(gsl::span> _dest, const std::array& _Signal, +void galileo_e1_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _secondary_flag); /*! * \brief galileo_e1_code_gen_complex_sampled without _secondary_flag for backward compatibility. */ -void galileo_e1_code_gen_complex_sampled(gsl::span> _dest, const std::array& _Signal, +void galileo_e1_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); #endif // GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index 63f24f437..89c5e7afc 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -27,7 +27,7 @@ #include -void galileo_e5_a_code_gen_complex_primary(gsl::span> _dest, int32_t _prn, const std::array& _Signal) +void galileo_e5_a_code_gen_complex_primary(std::span> _dest, int32_t _prn, const std::array& _Signal) { uint32_t prn = _prn - 1; uint32_t index = 0; @@ -90,7 +90,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span> _dest, } -void galileo_e5_a_code_gen_complex_sampled(gsl::span> _dest, const std::array& _Signal, +void galileo_e5_a_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) { uint32_t _samplesPerCode; diff --git a/src/algorithms/libs/galileo_e5_signal_processing.h b/src/algorithms/libs/galileo_e5_signal_processing.h index 120ff1b16..ba3ad4101 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.h +++ b/src/algorithms/libs/galileo_e5_signal_processing.h @@ -23,22 +23,26 @@ #ifndef GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H #define GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H -#include -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif /*! * \brief Generates Galileo E5a code at 1 sample/chip * bool _pilot generates E5aQ code if true and E5aI (data signal) if false. */ -void galileo_e5_a_code_gen_complex_primary(gsl::span> _dest, int32_t _prn, const std::array& _Signal); +void galileo_e5_a_code_gen_complex_primary(std::span> _dest, int32_t _prn, const std::array& _Signal); /*! * \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs * bool _pilot generates E5aQ code if true and E5aI (data signal) if false. */ -void galileo_e5_a_code_gen_complex_sampled(gsl::span> _dest, +void galileo_e5_a_code_gen_complex_sampled(std::span> _dest, const std::array& _Signal, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); diff --git a/src/algorithms/libs/glonass_l1_signal_processing.cc b/src/algorithms/libs/glonass_l1_signal_processing.cc index aaa569cd7..7112f1f67 100644 --- a/src/algorithms/libs/glonass_l1_signal_processing.cc +++ b/src/algorithms/libs/glonass_l1_signal_processing.cc @@ -25,7 +25,7 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast((x) + 1)); }; -void glonass_l1_ca_code_gen_complex(gsl::span> _dest, uint32_t _chip_shift) +void glonass_l1_ca_code_gen_complex(std::span> _dest, uint32_t _chip_shift) { const uint32_t _code_length = 511; std::bitset<_code_length> G1{}; @@ -91,7 +91,7 @@ void glonass_l1_ca_code_gen_complex(gsl::span> _dest, uint32 /* * Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency */ -void glonass_l1_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift) +void glonass_l1_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::array, 511> _code{}; diff --git a/src/algorithms/libs/glonass_l1_signal_processing.h b/src/algorithms/libs/glonass_l1_signal_processing.h index 5aefcf131..766aba7ed 100644 --- a/src/algorithms/libs/glonass_l1_signal_processing.h +++ b/src/algorithms/libs/glonass_l1_signal_processing.h @@ -22,17 +22,22 @@ #ifndef GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency -void glonass_l1_ca_code_gen_complex(gsl::span> _dest, uint32_t _chip_shift); +void glonass_l1_ca_code_gen_complex(std::span> _dest, uint32_t _chip_shift); //! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift -void glonass_l1_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); +void glonass_l1_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift -void glonass_l1_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift); +void glonass_l1_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift); #endif // GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/glonass_l2_signal_processing.cc b/src/algorithms/libs/glonass_l2_signal_processing.cc index 47e09c811..e54d3f661 100644 --- a/src/algorithms/libs/glonass_l2_signal_processing.cc +++ b/src/algorithms/libs/glonass_l2_signal_processing.cc @@ -25,7 +25,7 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast((x) + 1)); }; -void glonass_l2_ca_code_gen_complex(gsl::span> _dest, uint32_t _chip_shift) +void glonass_l2_ca_code_gen_complex(std::span> _dest, uint32_t _chip_shift) { const uint32_t _code_length = 511; std::bitset<_code_length> G1{}; @@ -91,7 +91,7 @@ void glonass_l2_ca_code_gen_complex(gsl::span> _dest, uint32 /* * Generates complex GLONASS L2 C/A code for the desired SV ID and sampled to specific sampling frequency */ -void glonass_l2_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift) +void glonass_l2_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::array, 511> _code{}; diff --git a/src/algorithms/libs/glonass_l2_signal_processing.h b/src/algorithms/libs/glonass_l2_signal_processing.h index d90408b00..74d74ff57 100644 --- a/src/algorithms/libs/glonass_l2_signal_processing.h +++ b/src/algorithms/libs/glonass_l2_signal_processing.h @@ -22,17 +22,22 @@ #ifndef GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H #define GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency -void glonass_l2_ca_code_gen_complex(gsl::span> _dest, uint32_t _chip_shift); +void glonass_l2_ca_code_gen_complex(std::span> _dest, uint32_t _chip_shift); //! Generates N complex GLONASS L2 C/A codes for the desired SV ID and code shift -void glonass_l2_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); +void glonass_l2_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); //! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift -void glonass_l2_ca_code_gen_complex_sampled(gsl::span> _dest, int32_t _fs, uint32_t _chip_shift); +void glonass_l2_ca_code_gen_complex_sampled(std::span> _dest, int32_t _fs, uint32_t _chip_shift); #endif // GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc index 32770d853..2884726bc 100644 --- a/src/algorithms/libs/gnss_signal_processing.cc +++ b/src/algorithms/libs/gnss_signal_processing.cc @@ -28,7 +28,7 @@ const auto AUX_CEIL2 = [](float x) { return static_cast(static_cast((x) + 1)); }; -void complex_exp_gen(gsl::span> _dest, double _f, double _fs) +void complex_exp_gen(std::span> _dest, double _f, double _fs) { gr::fxpt_nco d_nco; d_nco.set_freq((GPS_TWO_PI * _f) / _fs); @@ -36,7 +36,7 @@ void complex_exp_gen(gsl::span> _dest, double _f, double _fs } -void complex_exp_gen_conj(gsl::span> _dest, double _f, double _fs) +void complex_exp_gen_conj(std::span> _dest, double _f, double _fs) { gr::fxpt_nco d_nco; d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs); @@ -44,7 +44,7 @@ void complex_exp_gen_conj(gsl::span> _dest, double _f, doubl } -void hex_to_binary_converter(gsl::span _dest, char _from) +void hex_to_binary_converter(std::span _dest, char _from) { switch (_from) { @@ -150,7 +150,7 @@ void hex_to_binary_converter(gsl::span _dest, char _from) } -void resampler(const gsl::span _from, gsl::span _dest, float _fs_in, +void resampler(const std::span _from, std::span _dest, float _fs_in, float _fs_out) { uint32_t _codeValueIndex; @@ -173,7 +173,7 @@ void resampler(const gsl::span _from, gsl::span _dest, float _fs_i } -void resampler(gsl::span> _from, gsl::span> _dest, float _fs_in, +void resampler(std::span> _from, std::span> _dest, float _fs_in, float _fs_out) { uint32_t _codeValueIndex; diff --git a/src/algorithms/libs/gnss_signal_processing.h b/src/algorithms/libs/gnss_signal_processing.h index a85f3c04c..e18f3f938 100644 --- a/src/algorithms/libs/gnss_signal_processing.h +++ b/src/algorithms/libs/gnss_signal_processing.h @@ -24,41 +24,46 @@ #ifndef GNSS_SDR_GNSS_SIGNAL_PROCESSING_H #define GNSS_SDR_GNSS_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif /*! * \brief This function generates a complex exponential in _dest. * */ -void complex_exp_gen(gsl::span> _dest, double _f, double _fs); +void complex_exp_gen(std::span> _dest, double _f, double _fs); /*! * \brief This function generates a conjugate complex exponential in _dest. * */ -void complex_exp_gen_conj(gsl::span> _dest, double _f, double _fs); +void complex_exp_gen_conj(std::span> _dest, double _f, double _fs); /*! * \brief This function makes a conversion from hex (the input is a char) * to binary (the output are 4 ints with +1 or -1 values). * */ -void hex_to_binary_converter(gsl::span _dest, char _from); +void hex_to_binary_converter(std::span _dest, char _from); /*! * \brief This function resamples a sequence of float values. * */ -void resampler(const gsl::span _from, gsl::span _dest, +void resampler(const std::span _from, std::span _dest, float _fs_in, float _fs_out); /*! * \brief This function resamples a sequence of complex values. * */ -void resampler(gsl::span> _from, gsl::span> _dest, +void resampler(std::span> _from, std::span> _dest, float _fs_in, float _fs_out); #endif // GNSS_SDR_GNSS_SIGNAL_PROCESSING_H diff --git a/src/algorithms/libs/gps_l2c_signal.cc b/src/algorithms/libs/gps_l2c_signal.cc index 7fd99499e..68c62ed0b 100644 --- a/src/algorithms/libs/gps_l2c_signal.cc +++ b/src/algorithms/libs/gps_l2c_signal.cc @@ -32,7 +32,7 @@ uint32_t gps_l2c_m_shift(uint32_t x) } -void gps_l2c_m_code(gsl::span _dest, uint32_t _prn) +void gps_l2c_m_code(std::span _dest, uint32_t _prn) { uint32_t x; x = GPS_L2C_M_INIT_REG[_prn - 1]; @@ -44,7 +44,7 @@ void gps_l2c_m_code(gsl::span _dest, uint32_t _prn) } -void gps_l2c_m_code_gen_complex(gsl::span> _dest, uint32_t _prn) +void gps_l2c_m_code_gen_complex(std::span> _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -59,7 +59,7 @@ void gps_l2c_m_code_gen_complex(gsl::span> _dest, uint32_t _ } -void gps_l2c_m_code_gen_float(gsl::span _dest, uint32_t _prn) +void gps_l2c_m_code_gen_float(std::span _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -77,7 +77,7 @@ void gps_l2c_m_code_gen_float(gsl::span _dest, uint32_t _prn) /* * Generates complex GPS L2C M code for the desired SV ID and sampled to specific sampling frequency */ -void gps_l2c_m_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs) +void gps_l2c_m_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs) { std::array _code{}; if (_prn > 0 and _prn < 51) diff --git a/src/algorithms/libs/gps_l2c_signal.h b/src/algorithms/libs/gps_l2c_signal.h index 069dfabee..f389b4ce2 100644 --- a/src/algorithms/libs/gps_l2c_signal.h +++ b/src/algorithms/libs/gps_l2c_signal.h @@ -22,15 +22,20 @@ #ifndef GNSS_SDR_GPS_L2C_SIGNAL_H #define GNSS_SDR_GPS_L2C_SIGNAL_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates complex GPS L2C M code for the desired SV ID -void gps_l2c_m_code_gen_complex(gsl::span> _dest, uint32_t _prn); -void gps_l2c_m_code_gen_float(gsl::span _dest, uint32_t _prn); +void gps_l2c_m_code_gen_complex(std::span> _dest, uint32_t _prn); +void gps_l2c_m_code_gen_float(std::span _dest, uint32_t _prn); //! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency -void gps_l2c_m_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs); +void gps_l2c_m_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs); #endif // GNSS_SDR_GPS_L2C_SIGNAL_H diff --git a/src/algorithms/libs/gps_l5_signal.cc b/src/algorithms/libs/gps_l5_signal.cc index 186951c1a..d7e8a671e 100644 --- a/src/algorithms/libs/gps_l5_signal.cc +++ b/src/algorithms/libs/gps_l5_signal.cc @@ -121,7 +121,7 @@ std::deque make_l5q_xb() } -void make_l5i(gsl::span _dest, int32_t prn) +void make_l5i(std::span _dest, int32_t prn) { int32_t xb_offset = GPS_L5I_INIT_REG[prn]; @@ -141,7 +141,7 @@ void make_l5i(gsl::span _dest, int32_t prn) } -void make_l5q(gsl::span _dest, int32_t prn) +void make_l5q(std::span _dest, int32_t prn) { int32_t xb_offset = GPS_L5Q_INIT_REG[prn]; @@ -161,7 +161,7 @@ void make_l5q(gsl::span _dest, int32_t prn) } -void gps_l5i_code_gen_complex(gsl::span> _dest, uint32_t _prn) +void gps_l5i_code_gen_complex(std::span> _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -176,7 +176,7 @@ void gps_l5i_code_gen_complex(gsl::span> _dest, uint32_t _pr } -void gps_l5i_code_gen_float(gsl::span _dest, uint32_t _prn) +void gps_l5i_code_gen_float(std::span _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -194,7 +194,7 @@ void gps_l5i_code_gen_float(gsl::span _dest, uint32_t _prn) /* * Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency */ -void gps_l5i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs) +void gps_l5i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -236,7 +236,7 @@ void gps_l5i_code_gen_complex_sampled(gsl::span> _dest, uint } -void gps_l5q_code_gen_complex(gsl::span> _dest, uint32_t _prn) +void gps_l5q_code_gen_complex(std::span> _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -251,7 +251,7 @@ void gps_l5q_code_gen_complex(gsl::span> _dest, uint32_t _pr } -void gps_l5q_code_gen_float(gsl::span _dest, uint32_t _prn) +void gps_l5q_code_gen_float(std::span _dest, uint32_t _prn) { std::array _code{}; if (_prn > 0 and _prn < 51) @@ -269,7 +269,7 @@ void gps_l5q_code_gen_float(gsl::span _dest, uint32_t _prn) /* * Generates complex GPS L5Q code for the desired SV ID and sampled to specific sampling frequency */ -void gps_l5q_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs) +void gps_l5q_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs) { std::array _code{}; if (_prn > 0 and _prn < 51) diff --git a/src/algorithms/libs/gps_l5_signal.h b/src/algorithms/libs/gps_l5_signal.h index 679812fa0..433c6437a 100644 --- a/src/algorithms/libs/gps_l5_signal.h +++ b/src/algorithms/libs/gps_l5_signal.h @@ -22,27 +22,32 @@ #ifndef GNSS_SDR_GPS_L5_SIGNAL_H #define GNSS_SDR_GPS_L5_SIGNAL_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates complex GPS L5I code for the desired SV ID -void gps_l5i_code_gen_complex(gsl::span> _dest, uint32_t _prn); +void gps_l5i_code_gen_complex(std::span> _dest, uint32_t _prn); //! Generates real GPS L5I code for the desired SV ID -void gps_l5i_code_gen_float(gsl::span _dest, uint32_t _prn); +void gps_l5i_code_gen_float(std::span _dest, uint32_t _prn); //! Generates complex GPS L5Q code for the desired SV ID -void gps_l5q_code_gen_complex(gsl::span> _dest, uint32_t _prn); +void gps_l5q_code_gen_complex(std::span> _dest, uint32_t _prn); //! Generates real GPS L5Q code for the desired SV ID -void gps_l5q_code_gen_float(gsl::span _dest, uint32_t _prn); +void gps_l5q_code_gen_float(std::span _dest, uint32_t _prn); //! Generates complex GPS L5I code for the desired SV ID, and sampled to specific sampling frequency -void gps_l5i_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs); +void gps_l5i_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs); //! Generates complex GPS L5Q code for the desired SV ID, and sampled to specific sampling frequency -void gps_l5q_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs); +void gps_l5q_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs); #endif // GNSS_SDR_GPS_L5_SIGNAL_H diff --git a/src/algorithms/libs/gps_sdr_signal_processing.cc b/src/algorithms/libs/gps_sdr_signal_processing.cc index 4be8b6d4a..26f1ae0b2 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.cc +++ b/src/algorithms/libs/gps_sdr_signal_processing.cc @@ -25,7 +25,7 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast((x) + 1)); }; -void gps_l1_ca_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void gps_l1_ca_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 1023; std::bitset<_code_length> G1{}; @@ -110,7 +110,7 @@ void gps_l1_ca_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _ch } -void gps_l1_ca_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) +void gps_l1_ca_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 1023; std::array ca_code_int{}; @@ -124,7 +124,7 @@ void gps_l1_ca_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _ch } -void gps_l1_ca_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift) +void gps_l1_ca_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 1023; std::array ca_code_int{}; @@ -142,7 +142,7 @@ void gps_l1_ca_code_gen_complex(gsl::span> _dest, int32_t _p * Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency * NOTICE: the number of samples is rounded towards zero (integer truncation) */ -void gps_l1_ca_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) +void gps_l1_ca_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::array, 1023> _code{}; diff --git a/src/algorithms/libs/gps_sdr_signal_processing.h b/src/algorithms/libs/gps_sdr_signal_processing.h index 3918d4ab0..1cc0e55ef 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.h +++ b/src/algorithms/libs/gps_sdr_signal_processing.h @@ -22,23 +22,28 @@ #ifndef GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H -#include #include #include +#if HAS_STD_SPAN +#include +#else +#include +using std::span = gsl::span; +#endif //! Generates int GPS L1 C/A code for the desired SV ID and code shift -void gps_l1_ca_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void gps_l1_ca_code_gen_int(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates float GPS L1 C/A code for the desired SV ID and code shift -void gps_l1_ca_code_gen_float(gsl::span _dest, int32_t _prn, uint32_t _chip_shift); +void gps_l1_ca_code_gen_float(std::span _dest, int32_t _prn, uint32_t _chip_shift); //! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency -void gps_l1_ca_code_gen_complex(gsl::span> _dest, int32_t _prn, uint32_t _chip_shift); +void gps_l1_ca_code_gen_complex(std::span> _dest, int32_t _prn, uint32_t _chip_shift); //! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift -void gps_l1_ca_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); +void gps_l1_ca_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); //! Generates complex GPS L1 C/A code for the desired SV ID and code shift -void gps_l1_ca_code_gen_complex_sampled(gsl::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); +void gps_l1_ca_code_gen_complex_sampled(std::span> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); #endif // GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 490977909..17bc13721 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -80,7 +80,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l1_ca_code_gen_int(gsl::span(&d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0); + gps_l1_ca_code_gen_int(std::span(&d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0); // The code is generated as a series of 1s and -1s. In order to store the values using only one bit, a -1 is stored as a 0 in the FPGA for (uint32_t k = 0; k < GPS_L1_CA_CODE_LENGTH_CHIPS; k++) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 354172560..3480757c3 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -130,6 +130,12 @@ else() ) endif() +if(has_span) + target_compile_definitions(tracking_gr_blocks + PUBLIC -DHAS_STD_SPAN=1 + ) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(tracking_gr_blocks diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 02f52fada..0c316ca69 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -47,9 +47,8 @@ #include #include // for io_signature #include // for scoped_lock -#include -#include // for Mat_VarCreate -#include // for mp +#include // for Mat_VarCreate +#include // for mp #include #include // for fill_n #include diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 6e479e098..12f43e109 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -39,9 +39,8 @@ #include #include // for io_signature #include // for scoped_lock -#include -#include // for Mat_VarCreate -#include // for mp +#include // for Mat_VarCreate +#include // for mp #include #include // for fill_n #include // for fmod, round, floor diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index c0beb4ffe..f8b38a5b1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -268,7 +268,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - glonass_l1_ca_code_gen_complex(gsl::span(d_ca_code.data(), GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0); + glonass_l1_ca_code_gen_complex(std::span(d_ca_code.data(), GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0); multicorrelator_cpu.set_local_code_and_taps(static_cast(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data()); std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index febabd3ed..1cd0151d6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -215,7 +215,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - glonass_l2_ca_code_gen_complex(gsl::span(d_ca_code.data(), GLONASS_L2_CA_CODE_LENGTH_CHIPS), 0); + glonass_l2_ca_code_gen_complex(std::span(d_ca_code.data(), GLONASS_L2_CA_CODE_LENGTH_CHIPS), 0); multicorrelator_cpu.set_local_code_and_taps(static_cast(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data()); std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index b02407321..4daaed9fb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -207,7 +207,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking() d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - gps_l1_ca_code_gen_complex(gsl::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)), d_acquisition_gnss_synchro->PRN, 0); + gps_l1_ca_code_gen_complex(std::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)), d_acquisition_gnss_synchro->PRN, 0); multicorrelator_gpu->set_local_code_and_taps(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips, d_n_correlator_taps); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index 063b5c6ac..712a9c984 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -35,7 +35,6 @@ #include "tracking_discriminators.h" #include #include -#include #include #include #include diff --git a/src/tests/unit-tests/arithmetic/code_generation_test.cc b/src/tests/unit-tests/arithmetic/code_generation_test.cc index 436c81409..69e68341b 100644 --- a/src/tests/unit-tests/arithmetic/code_generation_test.cc +++ b/src/tests/unit-tests/arithmetic/code_generation_test.cc @@ -20,10 +20,15 @@ #include "gnss_signal_processing.h" #include "gps_sdr_signal_processing.h" -#include #include #include +#if HAS_STD_SPAN +#include +namespace gsl = std; +#else +#include +#endif TEST(CodeGenerationTest, CodeGenGPSL1Test) { @@ -38,7 +43,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test) for (int i = 0; i < iterations; i++) { - gps_l1_ca_code_gen_complex(gsl::span>(_dest, 1023), _prn, _chip_shift); + gps_l1_ca_code_gen_complex(std::span>(_dest, 1023), _prn, _chip_shift); } end = std::chrono::system_clock::now(); @@ -67,7 +72,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest) for (int i = 0; i < iterations; i++) { - gps_l1_ca_code_gen_complex_sampled(gsl::span>(_dest, _samplesPerCode), _prn, _fs, _chip_shift); + gps_l1_ca_code_gen_complex_sampled(std::span>(_dest, _samplesPerCode), _prn, _fs, _chip_shift); } end = std::chrono::system_clock::now(); @@ -95,7 +100,7 @@ TEST(CodeGenerationTest, ComplexConjugateTest) for (int i = 0; i < iterations; i++) { - complex_exp_gen_conj(gsl::span>(_dest, _samplesPerCode), _f, _fs); + complex_exp_gen_conj(std::span>(_dest, _samplesPerCode), _f, _fs); } end = std::chrono::system_clock::now(); diff --git a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc index 796fd5a6c..77e735693 100644 --- a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc +++ b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc @@ -21,10 +21,16 @@ #include "GPS_L1_CA.h" #include "gnss_signal_processing.h" #include -#include #include #include +#if HAS_STD_SPAN +#include +namespace gsl = std; +#else +#include +#endif + DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); @@ -110,7 +116,7 @@ TEST(ComplexCarrierTest, OwnComplexImplementation) std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - complex_exp_gen(gsl::span>(output, static_cast(FLAGS_size_carrier_test)), _f, _fs); + complex_exp_gen(std::span>(output, static_cast(FLAGS_size_carrier_test)), _f, _fs); end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc index 33fa4a159..fa6c0a2d6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc @@ -96,7 +96,7 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) // local code resampler on GPU // generate local reference (1 sample per chip) - gps_l1_ca_code_gen_float(gsl::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), 1, 0); + gps_l1_ca_code_gen_float(std::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), 1, 0); // generate inut signal std::random_device r; std::default_random_engine e1(r()); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc index 0b9342403..b4c917a13 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc @@ -93,7 +93,7 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) // local code resampler on GPU // generate local reference (1 sample per chip) - gps_l1_ca_code_gen_complex(gsl::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), 1, 0); + gps_l1_ca_code_gen_complex(std::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), 1, 0); // generate inut signal std::random_device r; std::default_random_engine e1(r()); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc index f1de3c528..de725e5aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc @@ -85,7 +85,7 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) // --- Perform initializations ------------------------------ // local code resampler on GPU // generate local reference (1 sample per chip) - gps_l1_ca_code_gen_complex(gsl::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)), 1, 0); + gps_l1_ca_code_gen_complex(std::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)), 1, 0); // generate inut signal for (int n = 0; n < 2 * d_vector_length; n++) {