summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2020-03-14 12:01:44 +0000
committerMichael Dickens <michael.dickens@ettus.com>2020-04-01 11:44:45 -0400
commit7a9169fe8cca1cb378be0d0d403e03a338ffbfda (patch)
treefef77ae9c34538b78e4172580cb5ecdc24d40134 /gnuradio-runtime/lib
parent82262753a56d15cfa6343044c726cf0035c38d9c (diff)
Switch from boost pointers to std C++11 pointers
Most of this code is automated code changes: ``` set -e SUB="s/dummy/dummy/" for i in shared_ptr make_shared dynamic_pointer_cast weak_ptr enable_shared_from_this get_deleter; do SUB="$SUB;s/boost::$i/std::$i/g" done SUB="$SUB;s^#include <boost/shared_ptr.hpp>^#include <memory>^g" SUB="$SUB;s^namespace boost^namespace std^g" find . \( -name "*.cc" -o -name "*.h" -o -name "*.i" -o -name "*.cxx" -o -name "*.py" \) -print0 | xargs -0 sed -i "$SUB" ``` Only one manual change. In `./gr-fec/lib/fec_mtrx_impl.cc`, add `#include <algorithm>`.
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r--gnuradio-runtime/lib/basic_block.cc2
-rw-r--r--gnuradio-runtime/lib/buffer.cc2
-rw-r--r--gnuradio-runtime/lib/controlport/rpcmanager.cc1
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc2
-rw-r--r--gnuradio-runtime/lib/hier_block2_detail.cc24
-rw-r--r--gnuradio-runtime/lib/scheduler.h2
-rw-r--r--gnuradio-runtime/lib/scheduler_tpb.cc2
-rw-r--r--gnuradio-runtime/lib/sptr_magic.cc2
-rw-r--r--gnuradio-runtime/lib/test.h2
9 files changed, 20 insertions, 19 deletions
diff --git a/gnuradio-runtime/lib/basic_block.cc b/gnuradio-runtime/lib/basic_block.cc
index 88ad63cf39..f86051213c 100644
--- a/gnuradio-runtime/lib/basic_block.cc
+++ b/gnuradio-runtime/lib/basic_block.cc
@@ -75,7 +75,7 @@ void basic_block::message_port_register_in(pmt::pmt_t port_id)
}
msg_queue[port_id] = msg_queue_t();
msg_queue_ready[port_id] =
- boost::shared_ptr<boost::condition_variable>(new boost::condition_variable());
+ std::shared_ptr<boost::condition_variable>(new boost::condition_variable());
}
pmt::pmt_t basic_block::message_ports_in()
diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc
index 7564741934..91cc43818b 100644
--- a/gnuradio-runtime/lib/buffer.cc
+++ b/gnuradio-runtime/lib/buffer.cc
@@ -47,7 +47,7 @@ static long s_buffer_reader_count = 0;
both want pointers to each other, and unless we do something, we'll
never delete any of them because of the circular structure.
They'll always have a reference count of at least one. We could
- use boost::weak_ptr's from gr::buffer to gr::buffer_reader but that
+ use std::weak_ptr's from gr::buffer to gr::buffer_reader but that
introduces it's own problems. (gr::buffer_reader's destructor needs
to call gr::buffer::drop_reader, but has no easy way to get a
shared_ptr to itself.)
diff --git a/gnuradio-runtime/lib/controlport/rpcmanager.cc b/gnuradio-runtime/lib/controlport/rpcmanager.cc
index 0699fa46c2..cd911a8fda 100644
--- a/gnuradio-runtime/lib/controlport/rpcmanager.cc
+++ b/gnuradio-runtime/lib/controlport/rpcmanager.cc
@@ -9,6 +9,7 @@
*/
#include <gnuradio/rpcmanager.h>
+#include <cassert>
#include <iostream>
#include <stdexcept>
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
index bca30c5053..4102191a3d 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
@@ -79,7 +79,7 @@ const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thri
d_default_thrift_buffer_size(ALRIGHT_DEFAULT_BUFFER_SIZE);
template <class rpcserver_base, class rpcserver_booter_thrift>
-boost::scoped_ptr<thrift_application_base_impl>
+std::unique_ptr<thrift_application_base_impl>
thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::p_impl(
new thrift_application_base_impl());
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc
index 02b324cfeb..512cfaa33e 100644
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
@@ -581,7 +581,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (set_all_min_buff) {
// sets the min buff for every block within hier_block2
if (min_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ block_sptr bb = std::dynamic_pointer_cast<block>(b);
if (bb != 0) {
if (bb->min_output_buffer(0) != min_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -590,7 +590,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
bb->set_min_output_buffer(min_buff);
}
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(b);
if (hh != 0) {
if (hh->min_output_buffer(0) != min_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -606,7 +606,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (set_all_max_buff) {
// sets the max buff for every block within hier_block2
if (max_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ block_sptr bb = std::dynamic_pointer_cast<block>(b);
if (bb != 0) {
if (bb->max_output_buffer(0) != max_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -615,7 +615,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
bb->set_max_output_buffer(max_buff);
}
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(b);
if (hh != 0) {
if (hh->max_output_buffer(0) != max_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -633,7 +633,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (set_all_min_buff) {
// sets the min buff for every block within hier_block2
if (min_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ block_sptr bb = std::dynamic_pointer_cast<block>(b);
if (bb != 0) {
if (bb->min_output_buffer(0) != min_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -642,7 +642,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
bb->set_min_output_buffer(min_buff);
}
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(b);
if (hh != 0) {
if (hh->min_output_buffer(0) != min_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -658,7 +658,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (set_all_max_buff) {
// sets the max buff for every block within hier_block2
if (max_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(b);
+ block_sptr bb = std::dynamic_pointer_cast<block>(b);
if (bb != 0) {
if (bb->max_output_buffer(0) != max_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -667,7 +667,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
bb->set_max_output_buffer(max_buff);
}
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(b);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(b);
if (hh != 0) {
if (hh->max_output_buffer(0) != max_buff) {
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -793,7 +793,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (!set_all_min_buff) {
min_buff = d_owner->min_output_buffer(i);
if (min_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(blk);
+ block_sptr bb = std::dynamic_pointer_cast<block>(blk);
if (bb != 0) {
int bb_src_port = d_outputs[i].port();
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -802,7 +802,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
<< std::endl;
bb->set_min_output_buffer(bb_src_port, min_buff);
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(blk);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(blk);
if (hh != 0) {
int hh_src_port = d_outputs[i].port();
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -817,7 +817,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
if (!set_all_max_buff) {
max_buff = d_owner->max_output_buffer(i);
if (max_buff != 0) {
- block_sptr bb = boost::dynamic_pointer_cast<block>(blk);
+ block_sptr bb = std::dynamic_pointer_cast<block>(blk);
if (bb != 0) {
int bb_src_port = d_outputs[i].port();
if (HIER_BLOCK2_DETAIL_DEBUG)
@@ -826,7 +826,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const
<< std::endl;
bb->set_max_output_buffer(bb_src_port, max_buff);
} else {
- hier_block2_sptr hh = boost::dynamic_pointer_cast<hier_block2>(blk);
+ hier_block2_sptr hh = std::dynamic_pointer_cast<hier_block2>(blk);
if (hh != 0) {
int hh_src_port = d_outputs[i].port();
if (HIER_BLOCK2_DETAIL_DEBUG)
diff --git a/gnuradio-runtime/lib/scheduler.h b/gnuradio-runtime/lib/scheduler.h
index 448895d72a..e56f0bfb19 100644
--- a/gnuradio-runtime/lib/scheduler.h
+++ b/gnuradio-runtime/lib/scheduler.h
@@ -19,7 +19,7 @@
namespace gr {
class scheduler;
-typedef boost::shared_ptr<scheduler> scheduler_sptr;
+typedef std::shared_ptr<scheduler> scheduler_sptr;
/*!
* \brief Abstract scheduler that takes a flattened flow graph and
diff --git a/gnuradio-runtime/lib/scheduler_tpb.cc b/gnuradio-runtime/lib/scheduler_tpb.cc
index 25fc836b96..f04be4227d 100644
--- a/gnuradio-runtime/lib/scheduler_tpb.cc
+++ b/gnuradio-runtime/lib/scheduler_tpb.cc
@@ -68,7 +68,7 @@ scheduler_tpb::scheduler_tpb(flat_flowgraph_sptr ffg,
}
thread::barrier_sptr start_sync =
- boost::make_shared<thread::barrier>(blocks.size() + 1);
+ std::make_shared<thread::barrier>(blocks.size() + 1);
// Fire off a thead for each block
diff --git a/gnuradio-runtime/lib/sptr_magic.cc b/gnuradio-runtime/lib/sptr_magic.cc
index f8529cabdf..0dd1f58666 100644
--- a/gnuradio-runtime/lib/sptr_magic.cc
+++ b/gnuradio-runtime/lib/sptr_magic.cc
@@ -54,7 +54,7 @@ void detail::sptr_magic::cancel_initial_sptr(gr::hier_block2* p)
return; /* Not in the map, nothing to do */
gr::basic_block_sptr sptr = pos->second;
s_map.erase(pos);
- boost::get_deleter<disarmable_deleter, gr::basic_block>(sptr)->disarm();
+ std::get_deleter<disarmable_deleter, gr::basic_block>(sptr)->disarm();
}
gr::basic_block_sptr detail::sptr_magic::fetch_initial_sptr(gr::basic_block* p)
diff --git a/gnuradio-runtime/lib/test.h b/gnuradio-runtime/lib/test.h
index 0d7b0cf6cf..ab03231861 100644
--- a/gnuradio-runtime/lib/test.h
+++ b/gnuradio-runtime/lib/test.h
@@ -19,7 +19,7 @@
namespace gr {
class test;
-typedef boost::shared_ptr<test> test_sptr;
+typedef std::shared_ptr<test> test_sptr;
// public constructor
GR_RUNTIME_API test_sptr make_test(const std::string& name = std::string("test"),