summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-howto-write-a-block/lib')
-rw-r--r--gr-howto-write-a-block/lib/.gitignore12
-rw-r--r--gr-howto-write-a-block/lib/Makefile.am80
-rw-r--r--gr-howto-write-a-block/lib/howto_square2_ff.cc92
-rw-r--r--gr-howto-write-a-block/lib/howto_square2_ff.h77
-rw-r--r--gr-howto-write-a-block/lib/howto_square_ff.cc98
-rw-r--r--gr-howto-write-a-block/lib/howto_square_ff.h78
-rw-r--r--gr-howto-write-a-block/lib/qa_howto.cc41
-rw-r--r--gr-howto-write-a-block/lib/qa_howto.h36
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square2_ff.cc35
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square2_ff.h39
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square_ff.cc35
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square_ff.h39
-rw-r--r--gr-howto-write-a-block/lib/test_all.cc38
13 files changed, 700 insertions, 0 deletions
diff --git a/gr-howto-write-a-block/lib/.gitignore b/gr-howto-write-a-block/lib/.gitignore
new file mode 100644
index 000000000..b1e56d39e
--- /dev/null
+++ b/gr-howto-write-a-block/lib/.gitignore
@@ -0,0 +1,12 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/howto.cc
+/howto.py
+/test_all \ No newline at end of file
diff --git a/gr-howto-write-a-block/lib/Makefile.am b/gr-howto-write-a-block/lib/Makefile.am
new file mode 100644
index 000000000..2e76ee453
--- /dev/null
+++ b/gr-howto-write-a-block/lib/Makefile.am
@@ -0,0 +1,80 @@
+#
+# Copyright 2004,2005,2006,2008,2009,2010 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+# list of programs run by "make check" and "make distcheck"
+TESTS = test_all
+
+# ----------------------------------------------------------------
+# howto C++ library: libgnuradio-howto.so
+# ----------------------------------------------------------------
+
+# C/C++ headers get installed in ${prefix}/include/$(modname)
+modinclude_HEADERS = \
+ howto_square_ff.h \
+ howto_square2_ff.h
+
+lib_LTLIBRARIES = libgnuradio-howto.la
+
+libgnuradio_howto_la_SOURCES = \
+ howto_square_ff.cc \
+ howto_square2_ff.cc
+
+libgnuradio_howto_la_LIBADD = \
+ $(GNURADIO_CORE_LA)
+
+libgnuradio_howto_la_LDFLAGS = \
+ $(NO_UNDEFINED)
+
+# ----------------------------------------------------------------
+# howto C++ QA library: libgnuradio-howto-qa.so (not installed)
+# ----------------------------------------------------------------
+
+noinst_LTLIBRARIES = libgnuradio-howto-qa.la
+
+libgnuradio_howto_qa_la_SOURCES = \
+ qa_howto.cc \
+ qa_howto_square_ff.cc \
+ qa_howto_square2_ff.cc
+
+libgnuradio_howto_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+
+libgnuradio_howto_qa_la_LIBADD = \
+ libgnuradio-howto.la \
+ $(CPPUNIT_LIBS)
+
+# ----------------------------------------------------------------
+# headers that don't get installed
+# ----------------------------------------------------------------
+noinst_HEADERS = \
+ qa_howto.h \
+ qa_howto_square_ff.h \
+ qa_howto_square2_ff.h
+
+# ----------------------------------------------------------------
+# test program
+# ----------------------------------------------------------------
+noinst_PROGRAMS = \
+ test_all
+
+test_all_SOURCES = test_all.cc
+test_all_LDADD = libgnuradio-howto-qa.la
diff --git a/gr-howto-write-a-block/lib/howto_square2_ff.cc b/gr-howto-write-a-block/lib/howto_square2_ff.cc
new file mode 100644
index 000000000..e86db93dd
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square2_ff.cc
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 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.
+ */
+
+/*
+ * config.h is generated by configure. It contains the results
+ * of probing for features, options etc. It should be the first
+ * file included in your .cc file.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <howto_square2_ff.h>
+#include <gr_io_signature.h>
+
+/*
+ * Create a new instance of howto_square2_ff and return
+ * a boost shared_ptr. This is effectively the public constructor.
+ */
+howto_square2_ff_sptr
+howto_make_square2_ff ()
+{
+ return howto_square2_ff_sptr (new howto_square2_ff ());
+}
+
+/*
+ * Specify constraints on number of input and output streams.
+ * This info is used to construct the input and output signatures
+ * (2nd & 3rd args to gr_block's constructor). The input and
+ * output signatures are used by the runtime system to
+ * check that a valid number and type of inputs and outputs
+ * are connected to this block. In this case, we accept
+ * only 1 input and 1 output.
+ */
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+static const int MIN_OUT = 1; // minimum number of output streams
+static const int MAX_OUT = 1; // maximum number of output streams
+
+/*
+ * The private constructor
+ */
+howto_square2_ff::howto_square2_ff ()
+ : gr_sync_block ("square2_ff",
+ gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
+ gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float)))
+{
+ // nothing else required in this example
+}
+
+/*
+ * Our virtual destructor.
+ */
+howto_square2_ff::~howto_square2_ff ()
+{
+ // nothing else required in this example
+}
+
+int
+howto_square2_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = in[i] * in[i];
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
diff --git a/gr-howto-write-a-block/lib/howto_square2_ff.h b/gr-howto-write-a-block/lib/howto_square2_ff.h
new file mode 100644
index 000000000..536b04fab
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square2_ff.h
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 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_HOWTO_SQUARE2_FF_H
+#define INCLUDED_HOWTO_SQUARE2_FF_H
+
+#include <gr_sync_block.h>
+
+class howto_square2_ff;
+
+/*
+ * We use boost::shared_ptr's instead of raw pointers for all access
+ * to gr_blocks (and many other data structures). The shared_ptr gets
+ * us transparent reference counting, which greatly simplifies storage
+ * management issues. This is especially helpful in our hybrid
+ * C++ / Python system.
+ *
+ * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+ *
+ * As a convention, the _sptr suffix indicates a boost::shared_ptr
+ */
+typedef boost::shared_ptr<howto_square2_ff> howto_square2_ff_sptr;
+
+/*!
+ * \brief Return a shared_ptr to a new instance of howto_square2_ff.
+ *
+ * To avoid accidental use of raw pointers, howto_square2_ff's
+ * constructor is private. howto_make_square2_ff is the public
+ * interface for creating new instances.
+ */
+howto_square2_ff_sptr howto_make_square2_ff ();
+
+/*!
+ * \brief square2 a stream of floats.
+ * \ingroup block
+ *
+ * This uses the preferred technique: subclassing gr_sync_block.
+ */
+class howto_square2_ff : public gr_sync_block
+{
+private:
+ // The friend declaration allows howto_make_square2_ff to
+ // access the private constructor.
+
+ friend howto_square2_ff_sptr howto_make_square2_ff ();
+
+ howto_square2_ff (); // private constructor
+
+ public:
+ ~howto_square2_ff (); // public destructor
+
+ // Where all the action really happens
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_HOWTO_SQUARE2_FF_H */
diff --git a/gr-howto-write-a-block/lib/howto_square_ff.cc b/gr-howto-write-a-block/lib/howto_square_ff.cc
new file mode 100644
index 000000000..5ab45d1f2
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square_ff.cc
@@ -0,0 +1,98 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 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.
+ */
+
+/*
+ * config.h is generated by configure. It contains the results
+ * of probing for features, options etc. It should be the first
+ * file included in your .cc file.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <howto_square_ff.h>
+#include <gr_io_signature.h>
+
+/*
+ * Create a new instance of howto_square_ff and return
+ * a boost shared_ptr. This is effectively the public constructor.
+ */
+howto_square_ff_sptr
+howto_make_square_ff ()
+{
+ return howto_square_ff_sptr (new howto_square_ff ());
+}
+
+/*
+ * Specify constraints on number of input and output streams.
+ * This info is used to construct the input and output signatures
+ * (2nd & 3rd args to gr_block's constructor). The input and
+ * output signatures are used by the runtime system to
+ * check that a valid number and type of inputs and outputs
+ * are connected to this block. In this case, we accept
+ * only 1 input and 1 output.
+ */
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+static const int MIN_OUT = 1; // minimum number of output streams
+static const int MAX_OUT = 1; // maximum number of output streams
+
+/*
+ * The private constructor
+ */
+howto_square_ff::howto_square_ff ()
+ : gr_block ("square_ff",
+ gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
+ gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float)))
+{
+ // nothing else required in this example
+}
+
+/*
+ * Our virtual destructor.
+ */
+howto_square_ff::~howto_square_ff ()
+{
+ // nothing else required in this example
+}
+
+int
+howto_square_ff::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = in[i] * in[i];
+ }
+
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+
+ consume_each (noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
diff --git a/gr-howto-write-a-block/lib/howto_square_ff.h b/gr-howto-write-a-block/lib/howto_square_ff.h
new file mode 100644
index 000000000..092b93698
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square_ff.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 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_HOWTO_SQUARE_FF_H
+#define INCLUDED_HOWTO_SQUARE_FF_H
+
+#include <gr_block.h>
+
+class howto_square_ff;
+
+/*
+ * We use boost::shared_ptr's instead of raw pointers for all access
+ * to gr_blocks (and many other data structures). The shared_ptr gets
+ * us transparent reference counting, which greatly simplifies storage
+ * management issues. This is especially helpful in our hybrid
+ * C++ / Python system.
+ *
+ * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+ *
+ * As a convention, the _sptr suffix indicates a boost::shared_ptr
+ */
+typedef boost::shared_ptr<howto_square_ff> howto_square_ff_sptr;
+
+/*!
+ * \brief Return a shared_ptr to a new instance of howto_square_ff.
+ *
+ * To avoid accidental use of raw pointers, howto_square_ff's
+ * constructor is private. howto_make_square_ff is the public
+ * interface for creating new instances.
+ */
+howto_square_ff_sptr howto_make_square_ff ();
+
+/*!
+ * \brief square a stream of floats.
+ * \ingroup block
+ *
+ * \sa howto_square2_ff for a version that subclasses gr_sync_block.
+ */
+class howto_square_ff : public gr_block
+{
+private:
+ // The friend declaration allows howto_make_square_ff to
+ // access the private constructor.
+
+ friend howto_square_ff_sptr howto_make_square_ff ();
+
+ howto_square_ff (); // private constructor
+
+ public:
+ ~howto_square_ff (); // public destructor
+
+ // Where all the action really happens
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_HOWTO_SQUARE_FF_H */
diff --git a/gr-howto-write-a-block/lib/qa_howto.cc b/gr-howto-write-a-block/lib/qa_howto.cc
new file mode 100644
index 000000000..f1411a388
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto.cc
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 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.
+ */
+
+/*
+ * This class gathers together all the test cases for the example
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_howto.h>
+#include <qa_howto_square_ff.h>
+#include <qa_howto_square2_ff.h>
+
+CppUnit::TestSuite *
+qa_howto::suite()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("howto");
+
+ s->addTest(qa_howto_square_ff::suite());
+ s->addTest(qa_howto_square2_ff::suite());
+
+ return s;
+}
diff --git a/gr-howto-write-a-block/lib/qa_howto.h b/gr-howto-write-a-block/lib/qa_howto.h
new file mode 100644
index 000000000..fa5a42fd3
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto.h
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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 Example 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 Example Public License for more details.
+ *
+ * You should have received a copy of the GNU Example 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_HOWTO_H
+#define INCLUDED_QA_HOWTO_H
+
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the example directory
+
+class qa_howto {
+ public:
+ //! return suite of tests for all of example directory
+ static CppUnit::TestSuite *suite ();
+};
+
+#endif /* INCLUDED_QA_HOWTO_H */
diff --git a/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc
new file mode 100644
index 000000000..a37465104
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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.
+ */
+
+#include <qa_howto_square2_ff.h>
+#include <cppunit/TestAssert.h>
+
+void
+qa_howto_square2_ff::t1()
+{
+ // Insert CPPUNIT tests/asserts here
+}
+
+void
+qa_howto_square2_ff::t2()
+{
+ // Insert CPPUNIT tests/asserts here
+}
diff --git a/gr-howto-write-a-block/lib/qa_howto_square2_ff.h b/gr-howto-write-a-block/lib/qa_howto_square2_ff.h
new file mode 100644
index 000000000..c74d0866f
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square2_ff.h
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_QA_HOWTO_SQUARE2_FF_H
+#define INCLUDED_QA_HOWTO_SQUARE2_FF_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_howto_square2_ff : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_howto_square2_ff);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+ void t2 ();
+};
+
+#endif /* INCLUDED_QA_HOWTO_SQUARE2_FF_H */
diff --git a/gr-howto-write-a-block/lib/qa_howto_square_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc
new file mode 100644
index 000000000..2f0b59773
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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.
+ */
+
+#include <qa_howto_square_ff.h>
+#include <cppunit/TestAssert.h>
+
+void
+qa_howto_square_ff::t1()
+{
+ // Insert CPPUNIT tests/asserts here
+}
+
+void
+qa_howto_square_ff::t2()
+{
+ // Insert CPPUNIT tests/asserts here
+}
diff --git a/gr-howto-write-a-block/lib/qa_howto_square_ff.h b/gr-howto-write-a-block/lib/qa_howto_square_ff.h
new file mode 100644
index 000000000..1b7c5e99f
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square_ff.h
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_QA_HOWTO_SQUARE_FF_H
+#define INCLUDED_QA_HOWTO_SQUARE_FF_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_howto_square_ff : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_howto_square_ff);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+ void t2 ();
+};
+
+#endif /* INCLUDED_QA_HOWTO_SQUARE_FF_H */
diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc
new file mode 100644
index 000000000..192c537bc
--- /dev/null
+++ b/gr-howto-write-a-block/lib/test_all.cc
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+
+#include <qa_howto.h>
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest(qa_howto::suite ());
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}