summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2020-05-03 12:23:51 +0100
committerMarcus Müller <marcus@hostalia.de>2020-07-30 18:12:44 +0200
commit30643f01609e915296023adc37123e27e2c86d3f (patch)
treecaf7141e8091cd30cde4e75ef0d1fcc5454ace77 /gnuradio-runtime/lib
parent875148321bca3c39af9aec8dee3c24eb9f75d1e6 (diff)
Replace all calls to `get_initial_sptr` with `make_block_sptr`
First batch of changes: ``` find […] -print0 | xargs -0 sed -i -r '/get_initial_sptr/{:nxt N;/;/!b nxt;s/get_initial_sptr\(\s*new ([^(]+)(.*)\)\)/make_block_sptr<\1>\2)/}' ``` Then: * Back out `sptr_magic.h` edits * Change some `friend` clauses * clang-format the whole thing * Update checksums in the pybind11 bindings files
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r--gnuradio-runtime/lib/hier_block2.cc4
-rw-r--r--gnuradio-runtime/lib/test.cc26
-rw-r--r--gnuradio-runtime/lib/test.h15
-rw-r--r--gnuradio-runtime/lib/top_block.cc2
4 files changed, 18 insertions, 29 deletions
diff --git a/gnuradio-runtime/lib/hier_block2.cc b/gnuradio-runtime/lib/hier_block2.cc
index 035152051c..18b60b9a47 100644
--- a/gnuradio-runtime/lib/hier_block2.cc
+++ b/gnuradio-runtime/lib/hier_block2.cc
@@ -27,8 +27,8 @@ hier_block2_sptr make_hier_block2(const std::string& name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature)
{
- return gnuradio::get_initial_sptr(
- new hier_block2(name, input_signature, output_signature));
+ return gnuradio::make_block_sptr<hier_block2>(
+ name, input_signature, output_signature);
}
hier_block2::hier_block2() {}
diff --git a/gnuradio-runtime/lib/test.cc b/gnuradio-runtime/lib/test.cc
index 9f2e3c58e0..810489e928 100644
--- a/gnuradio-runtime/lib/test.cc
+++ b/gnuradio-runtime/lib/test.cc
@@ -34,19 +34,19 @@ test_sptr make_test(const std::string& name,
consume_type_t cons_type,
produce_type_t prod_type)
{
- return gnuradio::get_initial_sptr(new test(name,
- min_inputs,
- max_inputs,
- sizeof_input_item,
- min_outputs,
- max_outputs,
- sizeof_output_item,
- history,
- output_multiple,
- relative_rate,
- fixed_rate,
- cons_type,
- prod_type));
+ return gnuradio::make_block_sptr<test>(name,
+ min_inputs,
+ max_inputs,
+ sizeof_input_item,
+ min_outputs,
+ max_outputs,
+ sizeof_output_item,
+ history,
+ output_multiple,
+ relative_rate,
+ fixed_rate,
+ cons_type,
+ prod_type);
}
test::test(const std::string& name,
diff --git a/gnuradio-runtime/lib/test.h b/gnuradio-runtime/lib/test.h
index ab03231861..2b8dc78252 100644
--- a/gnuradio-runtime/lib/test.h
+++ b/gnuradio-runtime/lib/test.h
@@ -205,19 +205,8 @@ protected:
consume_type_t cons_type,
produce_type_t prod_type);
- friend GR_RUNTIME_API test_sptr make_test(const std::string& name,
- int min_inputs,
- int max_inputs,
- unsigned int sizeof_input_item,
- int min_outputs,
- int max_outputs,
- unsigned int sizeof_output_item,
- unsigned int history,
- unsigned int output_multiple,
- double relative_rate,
- bool fixed_rate,
- consume_type_t cons_type,
- produce_type_t prod_type);
+ template <typename T, typename... Args>
+ friend std::shared_ptr<T> gnuradio::make_block_sptr(Args&&... args);
};
} /* namespace gr */
diff --git a/gnuradio-runtime/lib/top_block.cc b/gnuradio-runtime/lib/top_block.cc
index aad25f005a..c7e0ee74ce 100644
--- a/gnuradio-runtime/lib/top_block.cc
+++ b/gnuradio-runtime/lib/top_block.cc
@@ -24,7 +24,7 @@
namespace gr {
top_block_sptr make_top_block(const std::string& name, bool catch_exceptions)
{
- return gnuradio::get_initial_sptr(new top_block(name, catch_exceptions));
+ return gnuradio::make_block_sptr<top_block>(name, catch_exceptions);
}
top_block::top_block(const std::string& name, bool catch_exceptions)