mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-12 05:13:04 +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:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user