1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-13 05:37:20 +00:00

Add compatibility with the new GNU Radio 3.9 API that uses C++11 standard smart pointers instead of Boost smart pointers

This commit is contained in:
Carles Fernandez
2020-04-02 23:59:35 +02:00
parent 5f974a8f17
commit 3519107131
142 changed files with 1252 additions and 200 deletions

View File

@@ -152,6 +152,12 @@ target_link_libraries(signal_source_adapters
Volk::volk
)
if(GNURADIO_USES_STD_POINTERS)
target_compile_definitions(signal_source_adapters
PUBLIC -DGNURADIO_USES_STD_POINTERS=1
)
endif()
if(ENABLE_RAW_UDP AND PCAP_FOUND)
target_link_libraries(signal_source_adapters
PRIVATE

View File

@@ -24,7 +24,6 @@
#include "concurrent_queue.h"
#include "gnss_block_interface.h"
#include "gr_complex_ip_packet_source.h"
#include <memory>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/blocks/null_sink.h>
#include <pmt/pmt.h>
@@ -32,6 +31,10 @@
#include <stdexcept>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -86,9 +89,16 @@ private:
size_t item_size_;
bool dump_;
std::string dump_filename_;
#if GNURADIO_USES_STD_POINTERS
std::vector<std::shared_ptr<gr::block>> null_sinks_;
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
std::vector<std::shared_ptr<gr::block>> file_sink_;
#else
std::vector<boost::shared_ptr<gr::block>> null_sinks_;
std::vector<boost::shared_ptr<gr::block>> file_sink_;
#endif
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};

View File

@@ -34,6 +34,10 @@
#include <cstdint>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -110,7 +114,11 @@ private:
uint32_t in_streams_;
uint32_t out_streams_;
gr::blocks::file_source::sptr file_source_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -35,6 +35,10 @@
#include <memory>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -110,7 +114,11 @@ private:
uint32_t in_streams_;
uint32_t out_streams_;
std::vector<gr::blocks::file_source::sptr> file_source_vec_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -34,6 +34,10 @@
#include <pmt/pmt.h>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -110,7 +114,11 @@ private:
uint32_t out_streams_;
gr::blocks::file_source::sptr file_source_;
unpack_byte_2bit_samples_sptr unpack_byte_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -24,7 +24,6 @@
#include "concurrent_queue.h"
#include "gnss_block_interface.h"
#include "rtl_tcp_signal_source_c.h"
#include <memory>
#include <gnuradio/blocks/deinterleave.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/blocks/float_to_complex.h>
@@ -32,6 +31,10 @@
#include <memory>
#include <stdexcept>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -102,7 +105,11 @@ private:
rtl_tcp_signal_source_c_sptr signal_source_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};

View File

@@ -32,6 +32,10 @@
#include <cstdint>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -108,7 +112,11 @@ private:
unsigned int out_streams_;
gr::blocks::file_source::sptr file_source_;
unpack_intspir_1bit_samples_sptr unpack_intspir_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -37,6 +37,10 @@
#include <memory>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -119,7 +123,11 @@ private:
std::vector<gr::blocks::endian_swap::sptr> endian_vec_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
std::vector<unpack_spir_gss6450_samples_sptr> unpack_spir_vec_;
#if GNURADIO_USES_STD_POINTERS
std::vector<std::shared_ptr<gr::block>> valve_vec_;
#else
std::vector<boost::shared_ptr<gr::block>> valve_vec_;
#endif
std::vector<gr::blocks::file_sink::sptr> sink_vec_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -35,6 +35,10 @@
#include <cstdint>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -115,7 +119,11 @@ private:
gr::blocks::file_source::sptr file_source_;
unpack_byte_2bit_cpx_samples_sptr unpack_byte_;
gr::blocks::interleaved_short_to_complex::sptr inter_shorts_to_cpx_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -36,6 +36,10 @@
#include <cstdint>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -134,7 +138,11 @@ private:
gr::blocks::file_source::sptr file_source_;
unpack_2bit_samples_sptr unpack_samples_;
gr::basic_block_sptr char_to_float_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> valve_;
#else
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -22,7 +22,6 @@
#include "concurrent_queue.h"
#include "gnss_block_interface.h"
#include <memory>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/hier_block2.h>
#include <gnuradio/uhd/usrp_source.h>
@@ -31,6 +30,10 @@
#include <memory>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
class ConfigurationInterface;
@@ -94,8 +97,11 @@ private:
std::vector<uint64_t> samples_;
std::vector<bool> dump_;
std::vector<std::string> dump_filename_;
#if GNURADIO_USES_STD_POINTERS
std::vector<std::shared_ptr<gr::block>> valve_;
#else
std::vector<boost::shared_ptr<gr::block>> valve_;
#endif
std::vector<gr::blocks::file_sink::sptr> file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;

View File

@@ -66,6 +66,12 @@ target_include_directories(signal_source_gr_blocks
${CMAKE_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)
target_compile_definitions(signal_source_gr_blocks
PUBLIC -DGNURADIO_USES_STD_POINTERS=1
)
endif()
if(ENABLE_RAW_UDP AND PCAP_FOUND)
target_link_libraries(signal_source_gr_blocks
PUBLIC

View File

@@ -31,11 +31,20 @@
#include <pcap.h>
#include <string>
#include <sys/ioctl.h>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class Gr_Complex_Ip_Packet_Source : virtual public gr::sync_block
{
public:
#if GNURADIO_USES_STD_POINTERS
typedef std::shared_ptr<Gr_Complex_Ip_Packet_Source> sptr;
#else
typedef boost::shared_ptr<Gr_Complex_Ip_Packet_Source> sptr;
#endif
static sptr make(std::string src_device,
const std::string &origin_address,
int udp_port,

View File

@@ -25,13 +25,20 @@
#include <pmt/pmt.h>
#include <cstdint>
#include <fstream>
#include <memory>
#include <string>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class labsat23_source;
#if GNURADIO_USES_STD_POINTERS
using labsat23_source_sptr = std::shared_ptr<labsat23_source>;
#else
using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
#endif
labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,

View File

@@ -37,10 +37,19 @@
#include <cstdint>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class rtl_tcp_signal_source_c;
#if GNURADIO_USES_STD_POINTERS
using rtl_tcp_signal_source_c_sptr = std::shared_ptr<rtl_tcp_signal_source_c>;
#else
using rtl_tcp_signal_source_c_sptr = boost::shared_ptr<rtl_tcp_signal_source_c>;
#endif
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;

View File

@@ -60,10 +60,19 @@
#include <gnuradio/sync_interpolator.h>
#include <cstdint>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class unpack_2bit_samples;
#if GNURADIO_USES_STD_POINTERS
using unpack_2bit_samples_sptr = std::shared_ptr<unpack_2bit_samples>;
#else
using unpack_2bit_samples_sptr = boost::shared_ptr<unpack_2bit_samples>;
#endif
unpack_2bit_samples_sptr make_unpack_2bit_samples(
bool big_endian_bytes,

View File

@@ -25,10 +25,19 @@
#define GNSS_SDR_UNPACK_BYTE_2BIT_CPX_SAMPLES_H
#include <gnuradio/sync_interpolator.h>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class unpack_byte_2bit_cpx_samples;
#if GNURADIO_USES_STD_POINTERS
using unpack_byte_2bit_cpx_samples_sptr = std::shared_ptr<unpack_byte_2bit_cpx_samples>;
#else
using unpack_byte_2bit_cpx_samples_sptr = boost::shared_ptr<unpack_byte_2bit_cpx_samples>;
#endif
unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples();

View File

@@ -21,10 +21,19 @@
#define GNSS_SDR_UNPACK_BYTE_2BIT_SAMPLES_H
#include <gnuradio/sync_interpolator.h>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class unpack_byte_2bit_samples;
#if GNURADIO_USES_STD_POINTERS
using unpack_byte_2bit_samples_sptr = std::shared_ptr<unpack_byte_2bit_samples>;
#else
using unpack_byte_2bit_samples_sptr = boost::shared_ptr<unpack_byte_2bit_samples>;
#endif
unpack_byte_2bit_samples_sptr make_unpack_byte_2bit_samples();

View File

@@ -21,10 +21,19 @@
#define GNSS_SDR_UNPACK_INTSPIR_1BIT_SAMPLES_H
#include <gnuradio/sync_interpolator.h>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class unpack_intspir_1bit_samples;
#if GNURADIO_USES_STD_POINTERS
using unpack_intspir_1bit_samples_sptr = std::shared_ptr<unpack_intspir_1bit_samples>;
#else
using unpack_intspir_1bit_samples_sptr = boost::shared_ptr<unpack_intspir_1bit_samples>;
#endif
unpack_intspir_1bit_samples_sptr make_unpack_intspir_1bit_samples();

View File

@@ -22,10 +22,19 @@
#define GNSS_SDR_UNPACK_SPIR_GSS6450_SAMPLES_H
#include <gnuradio/sync_interpolator.h>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class unpack_spir_gss6450_samples;
#if GNURADIO_USES_STD_POINTERS
using unpack_spir_gss6450_samples_sptr = std::shared_ptr<unpack_spir_gss6450_samples>;
#else
using unpack_spir_gss6450_samples_sptr = boost::shared_ptr<unpack_spir_gss6450_samples>;
#endif
unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int adc_nbit_);

View File

@@ -55,6 +55,12 @@ target_include_directories(signal_source_libs
${CMAKE_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)
target_compile_definitions(signal_source_libs
PUBLIC -DGNURADIO_USES_STD_POINTERS=1
)
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
target_link_libraries(signal_source_libs
PUBLIC

View File

@@ -43,7 +43,7 @@ Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item,
d_open_valve = false;
}
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
{
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
@@ -56,6 +56,20 @@ std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, u
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
return valve_;
}
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
return valve_;
}
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
return valve_;
}
#endif
void Gnss_Sdr_Valve::open_valve()

View File

@@ -24,16 +24,20 @@
#define GNSS_SDR_GNSS_SDR_VALVE_H
#include "concurrent_queue.h"
#include <memory>
#include <gnuradio/sync_block.h> // for sync_block
#include <gnuradio/types.h> // for gr_vector_const_void_star
#include <pmt/pmt.h>
#include <cstddef> // for size_t
#include <cstdint>
#if GNURADIO_USES_STD_POINTERS
#include <memory>
#else
#include <boost/shared_ptr.hpp>
#endif
class Gnss_Sdr_Valve;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
@@ -44,6 +48,18 @@ std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
bool stop_flowgraph);
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
bool stop_flowgraph);
#endif
/*!
* \brief Implementation of a GNU Radio block that sends a STOP message to the
@@ -59,6 +75,7 @@ public:
gr_vector_void_star &output_items);
private:
#if GNURADIO_USES_STD_POINTERS
friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
@@ -69,7 +86,18 @@ private:
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
bool stop_flowgraph);
#else
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
bool stop_flowgraph);
#endif
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph);