diff options
author | Thomas Habets <thomas@habets.se> | 2020-03-14 12:01:44 +0000 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2020-04-01 11:44:45 -0400 |
commit | 7a9169fe8cca1cb378be0d0d403e03a338ffbfda (patch) | |
tree | fef77ae9c34538b78e4172580cb5ecdc24d40134 /gr-fec | |
parent | 82262753a56d15cfa6343044c726cf0035c38d9c (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-fec')
21 files changed, 39 insertions, 40 deletions
diff --git a/gr-fec/include/gnuradio/fec/async_decoder.h b/gr-fec/include/gnuradio/fec/async_decoder.h index 7530a72b1e..d1274a0ed6 100644 --- a/gr-fec/include/gnuradio/fec/async_decoder.h +++ b/gr-fec/include/gnuradio/fec/async_decoder.h @@ -14,7 +14,7 @@ #include <gnuradio/block.h> #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_decoder.h> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -67,7 +67,7 @@ namespace fec { class FEC_API async_decoder : virtual public block { public: - typedef boost::shared_ptr<async_decoder> sptr; + typedef std::shared_ptr<async_decoder> sptr; /*! * Build the PDU-based FEC decoder block from an FECAPI decoder object. diff --git a/gr-fec/include/gnuradio/fec/async_encoder.h b/gr-fec/include/gnuradio/fec/async_encoder.h index 9eb2deccc9..4a4ea67e8c 100644 --- a/gr-fec/include/gnuradio/fec/async_encoder.h +++ b/gr-fec/include/gnuradio/fec/async_encoder.h @@ -14,7 +14,7 @@ #include <gnuradio/block.h> #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_encoder.h> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -61,7 +61,7 @@ namespace fec { class FEC_API async_encoder : virtual public block { public: - typedef boost::shared_ptr<async_encoder> sptr; + typedef std::shared_ptr<async_encoder> sptr; /*! * Build the PDU-based FEC encoder block from an FECAPI encoder object. diff --git a/gr-fec/include/gnuradio/fec/ber_bf.h b/gr-fec/include/gnuradio/fec/ber_bf.h index 1879f18d4d..2fa97c4dd4 100644 --- a/gr-fec/include/gnuradio/fec/ber_bf.h +++ b/gr-fec/include/gnuradio/fec/ber_bf.h @@ -52,7 +52,7 @@ class FEC_API ber_bf : virtual public block { public: // gr::fec::ber_bf::sptr - typedef boost::shared_ptr<ber_bf> sptr; + typedef std::shared_ptr<ber_bf> sptr; /*! * Get total number of errors counter value. diff --git a/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h b/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h index ecc653b595..68ce7dd5ae 100644 --- a/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h +++ b/gr-fec/include/gnuradio/fec/conv_bit_corr_bb.h @@ -30,7 +30,7 @@ class FEC_API conv_bit_corr_bb : virtual public block { public: // gr::fec::conv_bit_corr_bb::sptr - typedef boost::shared_ptr<conv_bit_corr_bb> sptr; + typedef std::shared_ptr<conv_bit_corr_bb> sptr; static sptr make(std::vector<unsigned long long> correlator, int corr_sym, diff --git a/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h b/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h index 4130488da8..1569baea0c 100644 --- a/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h +++ b/gr-fec/include/gnuradio/fec/decode_ccsds_27_fb.h @@ -41,7 +41,7 @@ class FEC_API decode_ccsds_27_fb : virtual public sync_decimator { public: // gr::fec::decode_ccsds_27_fb::sptr - typedef boost::shared_ptr<decode_ccsds_27_fb> sptr; + typedef std::shared_ptr<decode_ccsds_27_fb> sptr; static sptr make(); }; diff --git a/gr-fec/include/gnuradio/fec/decoder.h b/gr-fec/include/gnuradio/fec/decoder.h index eb4a208fb7..4a551934a5 100644 --- a/gr-fec/include/gnuradio/fec/decoder.h +++ b/gr-fec/include/gnuradio/fec/decoder.h @@ -16,7 +16,7 @@ #include <gnuradio/fec/generic_decoder.h> #include <boost/format.hpp> #include <boost/shared_array.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -54,7 +54,7 @@ namespace fec { class FEC_API decoder : virtual public block { public: - typedef boost::shared_ptr<decoder> sptr; + typedef std::shared_ptr<decoder> sptr; typedef boost::shared_array<unsigned char> buf_sptr; /*! diff --git a/gr-fec/include/gnuradio/fec/depuncture_bb.h b/gr-fec/include/gnuradio/fec/depuncture_bb.h index 60e784e2df..8157487a04 100644 --- a/gr-fec/include/gnuradio/fec/depuncture_bb.h +++ b/gr-fec/include/gnuradio/fec/depuncture_bb.h @@ -79,7 +79,7 @@ class FEC_API depuncture_bb : virtual public block { public: // gr::fec::depuncture_bb::sptr - typedef boost::shared_ptr<depuncture_bb> sptr; + typedef std::shared_ptr<depuncture_bb> sptr; /*! * \brief Constructs a depuncture block. diff --git a/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h b/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h index b8eb063f03..bd5ff91c78 100644 --- a/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h +++ b/gr-fec/include/gnuradio/fec/encode_ccsds_27_bb.h @@ -38,7 +38,7 @@ class FEC_API encode_ccsds_27_bb : virtual public sync_interpolator { public: // gr::fec::encode_ccsds_27_bb::sptr - typedef boost::shared_ptr<encode_ccsds_27_bb> sptr; + typedef std::shared_ptr<encode_ccsds_27_bb> sptr; static sptr make(); }; diff --git a/gr-fec/include/gnuradio/fec/encoder.h b/gr-fec/include/gnuradio/fec/encoder.h index f294dccc9e..a79ba0876c 100644 --- a/gr-fec/include/gnuradio/fec/encoder.h +++ b/gr-fec/include/gnuradio/fec/encoder.h @@ -14,7 +14,7 @@ #include <gnuradio/block.h> #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_encoder.h> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -35,7 +35,7 @@ namespace fec { class FEC_API encoder : virtual public block { public: - typedef boost::shared_ptr<encoder> sptr; + typedef std::shared_ptr<encoder> sptr; /*! * Build the FEC encoder block from an FECAPI encoder object. diff --git a/gr-fec/include/gnuradio/fec/fec_mtrx.h b/gr-fec/include/gnuradio/fec/fec_mtrx.h index 6ea05f12a6..8a0a93f469 100644 --- a/gr-fec/include/gnuradio/fec/fec_mtrx.h +++ b/gr-fec/include/gnuradio/fec/fec_mtrx.h @@ -10,8 +10,8 @@ #define INCLUDED_fec_mtrx_H #include <gnuradio/fec/api.h> -#include <boost/shared_ptr.hpp> #include <cstdlib> +#include <memory> namespace gr { namespace fec { @@ -33,10 +33,10 @@ typedef struct { FEC_API void matrix_free(matrix* x); -typedef boost::shared_ptr<matrix> matrix_sptr; +typedef std::shared_ptr<matrix> matrix_sptr; class fec_mtrx; -typedef boost::shared_ptr<fec_mtrx> fec_mtrx_sptr; +typedef std::shared_ptr<fec_mtrx> fec_mtrx_sptr; /*! * \brief Read in an alist file and produce the matrix object. diff --git a/gr-fec/include/gnuradio/fec/generic_decoder.h b/gr-fec/include/gnuradio/fec/generic_decoder.h index 8b2fa7a9b6..e4f674b103 100644 --- a/gr-fec/include/gnuradio/fec/generic_decoder.h +++ b/gr-fec/include/gnuradio/fec/generic_decoder.h @@ -14,7 +14,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/logger.h> #include <boost/format.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -60,7 +60,7 @@ public: std::string alias() { return (boost::format("%s%d") % d_name % unique_id()).str(); } public: - typedef boost::shared_ptr<generic_decoder> sptr; + typedef std::shared_ptr<generic_decoder> sptr; generic_decoder(void){}; generic_decoder(std::string name); diff --git a/gr-fec/include/gnuradio/fec/generic_encoder.h b/gr-fec/include/gnuradio/fec/generic_encoder.h index a2af523d29..ce8b6ec6f5 100644 --- a/gr-fec/include/gnuradio/fec/generic_encoder.h +++ b/gr-fec/include/gnuradio/fec/generic_encoder.h @@ -14,7 +14,7 @@ #include <gnuradio/block.h> #include <gnuradio/fec/api.h> #include <gnuradio/logger.h> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -34,7 +34,7 @@ public: std::string alias() { return (boost::format("%s%d") % d_name % unique_id()).str(); } public: - typedef boost::shared_ptr<generic_encoder> sptr; + typedef std::shared_ptr<generic_encoder> sptr; /*! * Returns the rate of the code. For every 1 input bit, there diff --git a/gr-fec/include/gnuradio/fec/ldpc_G_matrix.h b/gr-fec/include/gnuradio/fec/ldpc_G_matrix.h index 4f291fd37d..7910dc3a14 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_G_matrix.h +++ b/gr-fec/include/gnuradio/fec/ldpc_G_matrix.h @@ -11,8 +11,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/fec_mtrx.h> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -40,10 +39,10 @@ namespace code { * ldpc_bit_flip_decoder classes. */ class FEC_API ldpc_G_matrix : virtual public fec_mtrx, - public boost::enable_shared_from_this<ldpc_G_matrix> + public std::enable_shared_from_this<ldpc_G_matrix> { public: - typedef boost::shared_ptr<ldpc_G_matrix> sptr; + typedef std::shared_ptr<ldpc_G_matrix> sptr; /*! * \brief Constructor given alist file diff --git a/gr-fec/include/gnuradio/fec/ldpc_H_matrix.h b/gr-fec/include/gnuradio/fec/ldpc_H_matrix.h index 19691bb7e0..9a3628a529 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_H_matrix.h +++ b/gr-fec/include/gnuradio/fec/ldpc_H_matrix.h @@ -11,8 +11,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/fec_mtrx.h> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -35,10 +34,10 @@ namespace code { * /lib/python2.7/dist-packages/gnuradio/fec/LDPC/Generate_LDPC_matrix.py. */ class FEC_API ldpc_H_matrix : virtual public fec_mtrx, - public boost::enable_shared_from_this<ldpc_H_matrix> + public std::enable_shared_from_this<ldpc_H_matrix> { public: - typedef boost::shared_ptr<ldpc_H_matrix> sptr; + typedef std::shared_ptr<ldpc_H_matrix> sptr; /*! * \brief Constructor given alist file and gap diff --git a/gr-fec/include/gnuradio/fec/puncture_bb.h b/gr-fec/include/gnuradio/fec/puncture_bb.h index a6f49d2b28..1be163c7ea 100644 --- a/gr-fec/include/gnuradio/fec/puncture_bb.h +++ b/gr-fec/include/gnuradio/fec/puncture_bb.h @@ -78,7 +78,7 @@ class FEC_API puncture_bb : virtual public block { public: // gr::fec::puncture_bb::sptr - typedef boost::shared_ptr<puncture_bb> sptr; + typedef std::shared_ptr<puncture_bb> sptr; /*! * \brief Constructs a puncture block for unpacked bits. diff --git a/gr-fec/include/gnuradio/fec/puncture_ff.h b/gr-fec/include/gnuradio/fec/puncture_ff.h index d453b9feee..d9adbef33d 100644 --- a/gr-fec/include/gnuradio/fec/puncture_ff.h +++ b/gr-fec/include/gnuradio/fec/puncture_ff.h @@ -77,7 +77,7 @@ class FEC_API puncture_ff : virtual public block { public: // gr::fec::puncture_ff::sptr - typedef boost::shared_ptr<puncture_ff> sptr; + typedef std::shared_ptr<puncture_ff> sptr; /*! * \brief Constructs a puncture block for floats. diff --git a/gr-fec/include/gnuradio/fec/tagged_decoder.h b/gr-fec/include/gnuradio/fec/tagged_decoder.h index bf089d8e98..6f2fc08ea1 100644 --- a/gr-fec/include/gnuradio/fec/tagged_decoder.h +++ b/gr-fec/include/gnuradio/fec/tagged_decoder.h @@ -15,7 +15,7 @@ #include <gnuradio/fec/generic_decoder.h> #include <gnuradio/tagged_stream_block.h> #include <boost/shared_array.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -53,7 +53,7 @@ namespace fec { class FEC_API tagged_decoder : virtual public tagged_stream_block { public: - typedef boost::shared_ptr<tagged_decoder> sptr; + typedef std::shared_ptr<tagged_decoder> sptr; typedef boost::shared_array<unsigned char> buf_sptr; /*! diff --git a/gr-fec/include/gnuradio/fec/tagged_encoder.h b/gr-fec/include/gnuradio/fec/tagged_encoder.h index 5019bd04a1..9e6dab49e5 100644 --- a/gr-fec/include/gnuradio/fec/tagged_encoder.h +++ b/gr-fec/include/gnuradio/fec/tagged_encoder.h @@ -14,7 +14,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_encoder.h> #include <gnuradio/tagged_stream_block.h> -#include <boost/shared_ptr.hpp> +#include <memory> namespace gr { namespace fec { @@ -35,7 +35,7 @@ namespace fec { class FEC_API tagged_encoder : virtual public tagged_stream_block { public: - typedef boost::shared_ptr<tagged_encoder> sptr; + typedef std::shared_ptr<tagged_encoder> sptr; /*! * Build the FEC encoder block from an FECAPI encoder object. diff --git a/gr-fec/lib/fec_mtrx_impl.cc b/gr-fec/lib/fec_mtrx_impl.cc index 3f05f9e6d6..b08ee05fec 100644 --- a/gr-fec/lib/fec_mtrx_impl.cc +++ b/gr-fec/lib/fec_mtrx_impl.cc @@ -12,6 +12,7 @@ #include "fec_mtrx_impl.h" #include <math.h> +#include <algorithm> #include <fstream> #include <iostream> #include <sstream> diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i index 8ef80e6d51..1d195ca280 100644 --- a/gr-fec/swig/fec_swig.i +++ b/gr-fec/swig/fec_swig.i @@ -18,10 +18,10 @@ %include "gnuradio/fec/cc_common.h" %nodefaultctor gr::fec::generic_encoder; -%template(generic_encoder_sptr) boost::shared_ptr<gr::fec::generic_encoder>; +%template(generic_encoder_sptr) std::shared_ptr<gr::fec::generic_encoder>; %nodefaultctor gr::fec::generic_decoder; -%template(generic_decoder_sptr) boost::shared_ptr<gr::fec::generic_decoder>; +%template(generic_decoder_sptr) std::shared_ptr<gr::fec::generic_decoder>; %{ #include "gnuradio/fec/generic_decoder.h" diff --git a/gr-fec/swig/ldpc.i b/gr-fec/swig/ldpc.i index d283d9b93a..e7f6eafaf0 100644 --- a/gr-fec/swig/ldpc.i +++ b/gr-fec/swig/ldpc.i @@ -8,15 +8,15 @@ * */ -%template(matrix_sptr) boost::shared_ptr<gr::fec::code::matrix>; -%template(fec_mtrx_sptr) boost::shared_ptr<gr::fec::code::fec_mtrx>; +%template(matrix_sptr) std::shared_ptr<gr::fec::code::matrix>; +%template(fec_mtrx_sptr) std::shared_ptr<gr::fec::code::fec_mtrx>; -%template(ldpc_H_matrix_sptr) boost::shared_ptr<gr::fec::code::ldpc_H_matrix>; +%template(ldpc_H_matrix_sptr) std::shared_ptr<gr::fec::code::ldpc_H_matrix>; %pythoncode %{ ldpc_H_matrix = ldpc_H_matrix.make; %} -%template(ldpc_G_matrix_sptr) boost::shared_ptr<gr::fec::code::ldpc_G_matrix>; +%template(ldpc_G_matrix_sptr) std::shared_ptr<gr::fec::code::ldpc_G_matrix>; %pythoncode %{ ldpc_G_matrix = ldpc_G_matrix.make; %} |