summaryrefslogtreecommitdiff
path: root/gr-blocks/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 /gr-blocks/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 'gr-blocks/lib')
-rw-r--r--gr-blocks/lib/message_strobe_impl.cc2
-rw-r--r--gr-blocks/lib/message_strobe_impl.h2
-rw-r--r--gr-blocks/lib/message_strobe_random_impl.cc2
-rw-r--r--gr-blocks/lib/message_strobe_random_impl.h2
-rw-r--r--gr-blocks/lib/qa_gr_flowgraph.cc4
-rw-r--r--gr-blocks/lib/qa_gr_hier_block2_derived.cc2
-rw-r--r--gr-blocks/lib/socket_pdu_impl.h6
-rw-r--r--gr-blocks/lib/tcp_connection.cc2
-rw-r--r--gr-blocks/lib/tcp_connection.h6
-rw-r--r--gr-blocks/lib/tcp_server_sink_impl.h2
10 files changed, 15 insertions, 15 deletions
diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc
index e17e5c39c9..9a601c6cb7 100644
--- a/gr-blocks/lib/message_strobe_impl.cc
+++ b/gr-blocks/lib/message_strobe_impl.cc
@@ -52,7 +52,7 @@ bool message_strobe_impl::start()
// NOTE: d_finished should be something explicitly thread safe. But since
// nothing breaks on concurrent access, I'll just leave it as bool.
d_finished = false;
- d_thread = boost::shared_ptr<gr::thread::thread>(
+ d_thread = std::shared_ptr<gr::thread::thread>(
new gr::thread::thread(boost::bind(&message_strobe_impl::run, this)));
return block::start();
diff --git a/gr-blocks/lib/message_strobe_impl.h b/gr-blocks/lib/message_strobe_impl.h
index 91111dd769..988990a247 100644
--- a/gr-blocks/lib/message_strobe_impl.h
+++ b/gr-blocks/lib/message_strobe_impl.h
@@ -19,7 +19,7 @@ namespace blocks {
class BLOCKS_API message_strobe_impl : public message_strobe
{
private:
- boost::shared_ptr<gr::thread::thread> d_thread;
+ std::shared_ptr<gr::thread::thread> d_thread;
bool d_finished;
long d_period_ms;
pmt::pmt_t d_msg;
diff --git a/gr-blocks/lib/message_strobe_random_impl.cc b/gr-blocks/lib/message_strobe_random_impl.cc
index 3a4b322294..793066c419 100644
--- a/gr-blocks/lib/message_strobe_random_impl.cc
+++ b/gr-blocks/lib/message_strobe_random_impl.cc
@@ -50,7 +50,7 @@ message_strobe_random_impl::message_strobe_random_impl(
{
// set up ports
message_port_register_out(d_port);
- d_thread = boost::shared_ptr<gr::thread::thread>(
+ d_thread = std::shared_ptr<gr::thread::thread>(
new gr::thread::thread(boost::bind(&message_strobe_random_impl::run, this)));
message_port_register_in(pmt::mp("set_msg"));
diff --git a/gr-blocks/lib/message_strobe_random_impl.h b/gr-blocks/lib/message_strobe_random_impl.h
index db66aa077f..9e1c898b31 100644
--- a/gr-blocks/lib/message_strobe_random_impl.h
+++ b/gr-blocks/lib/message_strobe_random_impl.h
@@ -28,7 +28,7 @@ private:
std::poisson_distribution<> pd; //(d_mean_ms);
std::normal_distribution<> nd; //(d_mean_ms, d_std_ms);
std::uniform_real_distribution<> ud; //(d_mean_ms - d_std_ms, d_mean_ms + d_std_ms);
- boost::shared_ptr<gr::thread::thread> d_thread;
+ std::shared_ptr<gr::thread::thread> d_thread;
bool d_finished;
pmt::pmt_t d_msg;
const pmt::pmt_t d_port;
diff --git a/gr-blocks/lib/qa_gr_flowgraph.cc b/gr-blocks/lib/qa_gr_flowgraph.cc
index 15c7ab46a6..6eb5e4224a 100644
--- a/gr-blocks/lib/qa_gr_flowgraph.cc
+++ b/gr-blocks/lib/qa_gr_flowgraph.cc
@@ -23,7 +23,7 @@ namespace blocks {
class null_qa_source : virtual public sync_block
{
public:
- typedef boost::shared_ptr<null_qa_source> sptr;
+ typedef std::shared_ptr<null_qa_source> sptr;
static sptr make(size_t sizeof_stream_item);
};
class null_source_qa_impl : public null_qa_source
@@ -56,7 +56,7 @@ null_qa_source::sptr null_qa_source::make(size_t sizeof_stream_item)
class null_qa_sink : virtual public sync_block
{
public:
- typedef boost::shared_ptr<null_qa_sink> sptr;
+ typedef std::shared_ptr<null_qa_sink> sptr;
static sptr make(size_t sizeof_stream_item);
};
class null_sink_qa_impl : public null_qa_sink
diff --git a/gr-blocks/lib/qa_gr_hier_block2_derived.cc b/gr-blocks/lib/qa_gr_hier_block2_derived.cc
index eb25f6e7ca..b2af4921c6 100644
--- a/gr-blocks/lib/qa_gr_hier_block2_derived.cc
+++ b/gr-blocks/lib/qa_gr_hier_block2_derived.cc
@@ -23,7 +23,7 @@
// Declare a test C++ hierarchical block
class gr_derived_block;
-typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr;
+typedef std::shared_ptr<gr_derived_block> gr_derived_block_sptr;
gr_derived_block_sptr gr_make_derived_block();
class gr_derived_block : public gr::hier_block2
diff --git a/gr-blocks/lib/socket_pdu_impl.h b/gr-blocks/lib/socket_pdu_impl.h
index c684ad013f..2e6c935471 100644
--- a/gr-blocks/lib/socket_pdu_impl.h
+++ b/gr-blocks/lib/socket_pdu_impl.h
@@ -34,20 +34,20 @@ private:
const bool d_tcp_no_delay;
// TCP server specific
- boost::shared_ptr<boost::asio::ip::tcp::acceptor> d_acceptor_tcp;
+ std::shared_ptr<boost::asio::ip::tcp::acceptor> d_acceptor_tcp;
void start_tcp_accept();
void tcp_server_send(pmt::pmt_t msg);
void handle_tcp_accept(tcp_connection::sptr new_connection,
const boost::system::error_code& error);
// TCP client specific
- boost::shared_ptr<boost::asio::ip::tcp::socket> d_tcp_socket;
+ std::shared_ptr<boost::asio::ip::tcp::socket> d_tcp_socket;
void tcp_client_send(pmt::pmt_t msg);
// UDP specific
boost::asio::ip::udp::endpoint d_udp_endpoint;
boost::asio::ip::udp::endpoint d_udp_endpoint_other;
- boost::shared_ptr<boost::asio::ip::udp::socket> d_udp_socket;
+ std::shared_ptr<boost::asio::ip::udp::socket> d_udp_socket;
void handle_udp_read(const boost::system::error_code& error,
size_t bytes_transferred);
void udp_send(pmt::pmt_t msg);
diff --git a/gr-blocks/lib/tcp_connection.cc b/gr-blocks/lib/tcp_connection.cc
index 086d1065f0..4634039ae4 100644
--- a/gr-blocks/lib/tcp_connection.cc
+++ b/gr-blocks/lib/tcp_connection.cc
@@ -45,7 +45,7 @@ void tcp_connection::send(pmt::pmt_t vector)
size_t len = pmt::blob_length(vector);
// Asio async_write() requires the buffer to remain valid until the handler is called.
- boost::shared_ptr<char[]> txbuf(new char[len]);
+ std::shared_ptr<char[]> txbuf(new char[len]);
size_t temp = 0;
memcpy(txbuf.get(), pmt::uniform_vector_elements(vector, temp), len);
diff --git a/gr-blocks/lib/tcp_connection.h b/gr-blocks/lib/tcp_connection.h
index 3841ce588e..2dd914ab71 100644
--- a/gr-blocks/lib/tcp_connection.h
+++ b/gr-blocks/lib/tcp_connection.h
@@ -14,7 +14,7 @@
#include <pmt/pmt.h>
#include <boost/array.hpp>
#include <boost/asio.hpp>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace gr {
@@ -35,7 +35,7 @@ private:
bool no_delay = false);
public:
- typedef boost::shared_ptr<tcp_connection> sptr;
+ typedef std::shared_ptr<tcp_connection> sptr;
static sptr
make(boost::asio::io_service& io_service, int MTU = 10000, bool no_delay = false);
@@ -45,7 +45,7 @@ public:
void start(gr::basic_block* block);
void send(pmt::pmt_t vector);
void handle_read(const boost::system::error_code& error, size_t bytes_transferred);
- void handle_write(boost::shared_ptr<char[]> txbuf,
+ void handle_write(std::shared_ptr<char[]> txbuf,
const boost::system::error_code& error,
size_t bytes_transferred)
{
diff --git a/gr-blocks/lib/tcp_server_sink_impl.h b/gr-blocks/lib/tcp_server_sink_impl.h
index d9b996b069..6e75432302 100644
--- a/gr-blocks/lib/tcp_server_sink_impl.h
+++ b/gr-blocks/lib/tcp_server_sink_impl.h
@@ -31,7 +31,7 @@ private:
std::set<boost::asio::ip::tcp::socket*> d_sockets;
boost::asio::ip::tcp::acceptor d_acceptor;
- boost::shared_ptr<uint8_t[]> d_buf;
+ std::shared_ptr<uint8_t[]> d_buf;
enum {
BUF_SIZE = 256 * 1024,
};