summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/general/gr_kludge_copy.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.cc21
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.h22
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc12
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sptr_magic.cc81
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sptr_magic.h51
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc25
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h3
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc87
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h41
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.cc2
14 files changed, 330 insertions, 26 deletions
diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.cc b/gnuradio-core/src/lib/general/gr_kludge_copy.cc
index 2589322fe..142c444ca 100644
--- a/gnuradio-core/src/lib/general/gr_kludge_copy.cc
+++ b/gnuradio-core/src/lib/general/gr_kludge_copy.cc
@@ -31,7 +31,7 @@
gr_kludge_copy_sptr
gr_make_kludge_copy(size_t itemsize)
{
- return gr_kludge_copy_sptr(new gr_kludge_copy(itemsize));
+ return gnuradio::get_initial_sptr(new gr_kludge_copy(itemsize));
}
gr_kludge_copy::gr_kludge_copy(size_t itemsize)
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index 0463581c7..550031b94 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -50,6 +50,7 @@ libruntime_la_SOURCES = \
gr_realtime.cc \
gr_scheduler_thread.cc \
gr_single_threaded_scheduler.cc \
+ gr_sptr_magic.cc \
gr_sync_block.cc \
gr_sync_decimator.cc \
gr_sync_interpolator.cc \
@@ -67,6 +68,7 @@ libruntime_la_SOURCES = \
libruntime_qa_la_SOURCES = \
qa_gr_block.cc \
qa_gr_hier_block2.cc \
+ qa_gr_hier_block2_derived.cc \
qa_gr_buffer.cc \
qa_gr_flowgraph.cc \
qa_gr_top_block.cc \
@@ -98,6 +100,7 @@ grinclude_HEADERS = \
gr_scheduler_thread.h \
gr_select_handler.h \
gr_single_threaded_scheduler.h \
+ gr_sptr_magic.h \
gr_sync_block.h \
gr_sync_decimator.h \
gr_sync_interpolator.h \
@@ -117,6 +120,7 @@ noinst_HEADERS = \
qa_gr_block.h \
qa_gr_flowgraph.h \
qa_gr_hier_block2.h \
+ qa_gr_hier_block2_derived.h \
qa_gr_buffer.h \
qa_gr_io_signature.h \
qa_gr_top_block.h \
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
index 8dc965da7..7dda1201f 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,6 +24,7 @@
#define INCLUDED_GR_BASIC_BLOCK_H
#include <gr_runtime_types.h>
+#include <gr_sptr_magic.h>
#include <boost/enable_shared_from_this.hpp>
#include <string>
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
index 23f274da7..e3a25e1a8 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2007 Free Software Foundation, Inc.
+ * Copyright 2006,2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,11 +31,13 @@
#define GR_HIER_BLOCK2_DEBUG 0
-gr_hier_block2_sptr gr_make_hier_block2(const std::string &name,
- gr_io_signature_sptr input_signature,
- gr_io_signature_sptr output_signature)
+
+gr_hier_block2_sptr
+gr_make_hier_block2(const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature)
{
- return gr_hier_block2_sptr(new gr_hier_block2(name, input_signature, output_signature));
+ return gnuradio::get_initial_sptr(new gr_hier_block2(name, input_signature, output_signature));
}
gr_hier_block2::gr_hier_block2(const std::string &name,
@@ -44,6 +46,8 @@ gr_hier_block2::gr_hier_block2(const std::string &name,
: gr_basic_block(name, input_signature, output_signature),
d_detail(new gr_hier_block2_detail(this))
{
+ // This bit of magic ensures that self() works in the constructors of derived classes.
+ gnuradio::detail::sptr_magic::create_and_stash_initial_sptr(this);
}
gr_hier_block2::~gr_hier_block2()
@@ -51,6 +55,13 @@ gr_hier_block2::~gr_hier_block2()
delete d_detail;
}
+gr_hier_block2::opaque_self
+gr_hier_block2::self()
+{
+ return shared_from_this();
+}
+
+
void
gr_hier_block2::connect(gr_basic_block_sptr block)
{
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
index 5e67a9010..ece8b21ca 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2007 Free Software Foundation, Inc.
+ * Copyright 2006,2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -51,7 +51,7 @@ private:
* \brief Private implementation details of gr_hier_block2
*/
gr_hier_block2_detail *d_detail;
-
+
protected:
gr_hier_block2(const std::string &name,
gr_io_signature_sptr input_signature,
@@ -61,6 +61,22 @@ public:
virtual ~gr_hier_block2();
/*!
+ * \brief typedef for object returned from self().
+ *
+ * This type is only guaranteed to be passable to connect and disconnect.
+ * No other assumptions should be made about it.
+ */
+ typedef gr_basic_block_sptr opaque_self;
+
+ /*!
+ * \brief Return an object, representing the current block, which can be passed to connect.
+ *
+ * The returned object may only be used as an argument to connect or disconnect.
+ * Any other use of self() results in unspecified (erroneous) behavior.
+ */
+ opaque_self self();
+
+ /*!
* \brief Add a stand-alone (possibly hierarchical) block to internal graph
*
* This adds a gr-block or hierarchical block to the internal graph
@@ -132,7 +148,7 @@ public:
gr_flat_flowgraph_sptr flatten() const;
};
-inline gr_hier_block2_sptr make_hier_block2_sptr(gr_basic_block_sptr block) {
+inline gr_hier_block2_sptr cast_to_hier_block2_sptr(gr_basic_block_sptr block) {
return boost::dynamic_pointer_cast<gr_hier_block2, gr_basic_block>(block);
}
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
index 26a28fabd..32cac2ea8 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
@@ -78,8 +78,8 @@ gr_hier_block2_detail::connect(gr_basic_block_sptr src, int src_port,
if (src.get() == dst.get())
throw std::invalid_argument("connect: src and destination blocks cannot be the same");
- gr_hier_block2_sptr src_block(make_hier_block2_sptr(src));
- gr_hier_block2_sptr dst_block(make_hier_block2_sptr(dst));
+ gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src));
+ gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst));
if (src_block && src.get() != d_owner) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
@@ -147,8 +147,8 @@ gr_hier_block2_detail::disconnect(gr_basic_block_sptr src, int src_port,
if (src.get() == dst.get())
throw std::invalid_argument("disconnect: source and destination blocks cannot be the same");
- gr_hier_block2_sptr src_block(make_hier_block2_sptr(src));
- gr_hier_block2_sptr dst_block(make_hier_block2_sptr(dst));
+ gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src));
+ gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst));
if (src_block && src.get() != d_owner) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
@@ -307,7 +307,7 @@ gr_hier_block2_detail::resolve_endpoint(const gr_endpoint &endp, bool is_input)
return endp;
// Check if endpoint is a hierarchical block
- gr_hier_block2_sptr hier_block2(make_hier_block2_sptr(endp.block()));
+ gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(endp.block()));
if (hier_block2) {
if (GR_HIER_BLOCK2_DETAIL_DEBUG)
std::cout << "Resolving endpoint " << endp << " as an "
@@ -351,7 +351,7 @@ gr_hier_block2_detail::flatten_aux(gr_flat_flowgraph_sptr sfg) const
// Recurse hierarchical children
for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
- gr_hier_block2_sptr hier_block2(make_hier_block2_sptr(*p));
+ gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(*p));
if (hier_block2)
hier_block2->d_detail->flatten_aux(sfg);
}
diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc b/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
new file mode 100644
index 000000000..dc0b232a7
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_sptr_magic.h>
+#include <gr_hier_block2.h>
+#include <map>
+#include <stdexcept>
+
+
+#if 0
+ #include <boost/thread.hpp>
+ typedef boost::mutex mutex;
+ typedef boost::mutex::scoped_lock scoped_lock;
+#else
+ #include <omnithread.h>
+ typedef omni_mutex mutex;
+ typedef omni_mutex_lock scoped_lock;
+#endif
+
+namespace gnuradio {
+
+ static mutex s_mutex;
+ typedef std::map<gr_basic_block*, gr_basic_block_sptr> sptr_map;
+ static sptr_map s_map;
+
+ void
+ detail::sptr_magic::create_and_stash_initial_sptr(gr_hier_block2 *p)
+ {
+ gr_basic_block_sptr sptr(p);
+ scoped_lock l();
+ s_map.insert(sptr_map::value_type(static_cast<gr_basic_block *>(p), sptr));
+ }
+
+
+ gr_basic_block_sptr
+ detail::sptr_magic::fetch_initial_sptr(gr_basic_block *p)
+ {
+ /*
+ * If p isn't a subclass of gr_hier_block2, just create the
+ * shared ptr and return it.
+ */
+ gr_hier_block2 *hb2 = dynamic_cast<gr_hier_block2 *>(p);
+ if (!hb2){
+ return gr_basic_block_sptr(p);
+ }
+
+ /*
+ * p is a subclass of gr_hier_block2, thus we've already created the shared pointer
+ * and stashed it away. Fish it out and return it.
+ */
+ scoped_lock l();
+ sptr_map::iterator pos = s_map.find(static_cast<gr_basic_block *>(p));
+ if (pos == s_map.end())
+ throw std::invalid_argument("gr_sptr_magic: invalid pointer!");
+
+ gr_basic_block_sptr sptr = pos->second;
+ s_map.erase(pos);
+ return sptr;
+ }
+};
+
diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h
new file mode 100644
index 000000000..872374ab6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_SPTR_MAGIC_H
+#define INCLUDED_GR_SPTR_MAGIC_H
+
+#include <boost/shared_ptr.hpp>
+
+class gr_basic_block;
+class gr_hier_block2;
+
+namespace gnuradio {
+
+ namespace detail {
+
+ class sptr_magic {
+ public:
+ static boost::shared_ptr<gr_basic_block> fetch_initial_sptr(gr_basic_block *p);
+ static void create_and_stash_initial_sptr(gr_hier_block2 *p);
+ };
+ };
+
+ /*
+ * \brief New! Improved! Standard method to get/create the boost::shared_ptr for a block.
+ */
+ template<class T>
+ boost::shared_ptr<T>
+ get_initial_sptr(T *p)
+ {
+ return boost::dynamic_pointer_cast<T, gr_basic_block>(detail::sptr_magic::fetch_initial_sptr(p));
+ }
+};
+
+#endif /* INCLUDED_GR_SPTR_MAGIC_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
index 339f3cb89..3c8e28f70 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -34,7 +34,7 @@
gr_top_block_sptr
gr_make_top_block(const std::string &name)
{
- return gr_top_block_sptr(new gr_top_block(name));
+ return gnuradio::get_initial_sptr(new gr_top_block(name));
}
gr_top_block::gr_top_block(const std::string &name)
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
index 07b9d5ecf..2cf1a8d10 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,14 +33,25 @@
void qa_gr_hier_block2::test_make()
{
gr_hier_block2_sptr src1(gr_make_hier_block2("test",
- gr_make_io_signature(1, 1, sizeof(int)),
- gr_make_io_signature(1, 1, sizeof(int))));
+ gr_make_io_signature(1, 2, 1 * sizeof(int)),
+ gr_make_io_signature(3, 4, 2 * sizeof(int))));
CPPUNIT_ASSERT(src1);
CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name());
- CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams());
- CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams());
- CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams());
- CPPUNIT_ASSERT_EQUAL((int) sizeof(int),
+
+ CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int),
+ src1->input_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(2, src1->input_signature()->max_streams());
+
+
+ CPPUNIT_ASSERT_EQUAL(2 * (int) sizeof(int),
src1->output_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(3, src1->output_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(4, src1->output_signature()->max_streams());
+
}
+
+
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h
index a07ed7bf8..3870b9f0f 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h
@@ -32,12 +32,11 @@ class qa_gr_hier_block2 : public CppUnit::TestCase
CPPUNIT_TEST_SUITE(qa_gr_hier_block2);
CPPUNIT_TEST(test_make);
-
+
CPPUNIT_TEST_SUITE_END();
private:
void test_make();
- void test_derived();
};
#endif /* INCLUDED_QA_GR_HIER_BLOCK2_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc
new file mode 100644
index 000000000..fe5f3a751
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_hier_block2_derived.h>
+#include <gr_top_block.h>
+#include <gr_io_signature.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_head.h>
+#include <gr_kludge_copy.h>
+
+// Declare a test C++ hierarchical block
+
+class gr_derived_block;
+typedef boost::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
+{
+private:
+ friend gr_derived_block_sptr gr_make_derived_block();
+ gr_derived_block();
+
+public:
+ ~gr_derived_block();
+};
+
+
+gr_derived_block_sptr
+gr_make_derived_block()
+{
+ return gnuradio::get_initial_sptr(new gr_derived_block());
+}
+
+gr_derived_block::gr_derived_block()
+ : gr_hier_block2("gr_derived_block",
+ gr_make_io_signature(1, 1, sizeof(int)), // Input signature
+ gr_make_io_signature(1, 1, sizeof(int))) // Output signature
+{
+ gr_block_sptr copy(gr_make_kludge_copy(sizeof(int)));
+
+ connect(self(), 0, copy, 0);
+ connect(copy, 0, self(), 0);
+}
+
+gr_derived_block::~gr_derived_block()
+{
+}
+
+void qa_gr_hier_block2_derived::test_1()
+{
+ gr_top_block_sptr tb(gr_make_top_block("test"));
+
+ gr_block_sptr src(gr_make_null_source(sizeof(int)));
+ gr_block_sptr head(gr_make_head(sizeof(int), 1000));
+ gr_derived_block_sptr blk(gr_make_derived_block());
+ gr_block_sptr dst(gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, blk, 0);
+ tb->connect(blk, 0, dst, 0);
+
+ tb->run();
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h
new file mode 100644
index 000000000..5a27b1b2d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H
+#define INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+// Declare a QA test case
+class qa_gr_hier_block2_derived : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived);
+ CPPUNIT_TEST(test_1);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_1();
+};
+
+#endif /* INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
index ba0f14b93..31e3a82d6 100644
--- a/gnuradio-core/src/lib/runtime/qa_runtime.cc
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -36,6 +36,7 @@
#include <qa_gr_flowgraph.h>
#include <qa_gr_top_block.h>
#include <qa_gr_hier_block2.h>
+#include <qa_gr_hier_block2_derived.h>
#include <qa_gr_buffer.h>
CppUnit::TestSuite *
@@ -49,6 +50,7 @@ qa_runtime::suite ()
s->addTest (qa_gr_flowgraph::suite ());
s->addTest (qa_gr_top_block::suite ());
s->addTest (qa_gr_hier_block2::suite ());
+ s->addTest (qa_gr_hier_block2_derived::suite ());
s->addTest (qa_gr_buffer::suite ());
return s;