summaryrefslogtreecommitdiff
path: root/gnuradio-examples/c++
diff options
context:
space:
mode:
authorjcorgan2006-12-12 20:00:39 +0000
committerjcorgan2006-12-12 20:00:39 +0000
commit76ed4c2fea5f59bfe02bbbb17754ef7eda44feca (patch)
treec30952925ea02e52f137e1e7f4da658629994936 /gnuradio-examples/c++
parent5de36fac220305307d6fb64eabe6f417a26c0982 (diff)
downloadgnuradio-76ed4c2fea5f59bfe02bbbb17754ef7eda44feca.tar.gz
gnuradio-76ed4c2fea5f59bfe02bbbb17754ef7eda44feca.tar.bz2
gnuradio-76ed4c2fea5f59bfe02bbbb17754ef7eda44feca.zip
Merge jcorgan/hier developer branch into trunk. Enables creation of true hierarchical blocks, from either C++ or Python, as well as creating pure C++ gnuradio applications. EXPERIMENTAL.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4070 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-examples/c++')
-rw-r--r--gnuradio-examples/c++/Makefile.am27
-rw-r--r--gnuradio-examples/c++/dialtone/Makefile.am48
-rw-r--r--gnuradio-examples/c++/dialtone/dialtone.cc45
-rw-r--r--gnuradio-examples/c++/dialtone/dialtone.h33
-rw-r--r--gnuradio-examples/c++/dialtone/main.cc38
-rw-r--r--gnuradio-examples/c++/hier/Makefile.am56
-rw-r--r--gnuradio-examples/c++/hier/dialtone.cc48
-rw-r--r--gnuradio-examples/c++/hier/dialtone.h33
-rw-r--r--gnuradio-examples/c++/hier/main.cc38
-rw-r--r--gnuradio-examples/c++/hier/output.cc41
-rw-r--r--gnuradio-examples/c++/hier/output.h33
-rw-r--r--gnuradio-examples/c++/hier/siggen.cc42
-rw-r--r--gnuradio-examples/c++/hier/siggen.h33
-rw-r--r--gnuradio-examples/c++/hier/sink.cc45
-rw-r--r--gnuradio-examples/c++/hier/sink.h33
-rw-r--r--gnuradio-examples/c++/hier/source.cc41
-rw-r--r--gnuradio-examples/c++/hier/source.h33
17 files changed, 667 insertions, 0 deletions
diff --git a/gnuradio-examples/c++/Makefile.am b/gnuradio-examples/c++/Makefile.am
new file mode 100644
index 000000000..f25bbaa8f
--- /dev/null
+++ b/gnuradio-examples/c++/Makefile.am
@@ -0,0 +1,27 @@
+#
+# Copyright 2006 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 2, 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
+
+SUBDIRS = \
+ dialtone \
+ hier
+
diff --git a/gnuradio-examples/c++/dialtone/Makefile.am b/gnuradio-examples/c++/dialtone/Makefile.am
new file mode 100644
index 000000000..35e807381
--- /dev/null
+++ b/gnuradio-examples/c++/dialtone/Makefile.am
@@ -0,0 +1,48 @@
+#
+# Copyright 2006 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 2, 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
+
+# For compiling within the GNU Radio build tree
+INCLUDES=$(STD_DEFINES_AND_INCLUDES) \
+ -I$(top_srcdir)/gr-audio-alsa/src
+
+GR_AUDIO_ALSA_LIBS=$(top_builddir)/gr-audio-alsa/src/libgr_audio_alsa.la
+
+# For compiling outside the tree, these are the usual
+# INCLUDES = -I/usr/local/include -I/usr/local/include/gnuradio
+# GNURADIO_CORE_LIBS = -lgnuradio-core
+# GR_AUDIO_ALSA_LIBS = -lgr_audio_alsa
+
+noinst_PROGRAMS = dialtone
+
+noinst_HEADERS = \
+ dialtone.h
+
+dialtone_SOURCES = \
+ dialtone.cc \
+ main.cc
+
+dialtone_LDADD = \
+ $(GNURADIO_CORE_LIBS) \
+ $(GR_AUDIO_ALSA_LIBS)
+
+MOSTLYCLEANFILES = *~
diff --git a/gnuradio-examples/c++/dialtone/dialtone.cc b/gnuradio-examples/c++/dialtone/dialtone.cc
new file mode 100644
index 000000000..08ecccf75
--- /dev/null
+++ b/gnuradio-examples/c++/dialtone/dialtone.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 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 2, 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 <dialtone.h>
+#include <gr_io_signature.h>
+#include <gr_sig_source_f.h>
+#include <audio_alsa_sink.h>
+
+// Shared pointer constructor
+dialtone_sptr make_dialtone()
+{
+ return dialtone_sptr(new dialtone());
+}
+
+// Hierarchical block constructor, with no inputs or outputs
+dialtone::dialtone() :
+gr_hier_block2("dialtone",
+ gr_make_io_signature(0,0,0),
+ gr_make_io_signature(0,0,0))
+{
+ define_component("source0", gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 0.5));
+ define_component("source1", gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 0.5));
+ define_component("sink", audio_alsa_make_sink(48000));
+
+ connect("source0", 0, "sink", 0);
+ connect("source1", 0, "sink", 1);
+}
diff --git a/gnuradio-examples/c++/dialtone/dialtone.h b/gnuradio-examples/c++/dialtone/dialtone.h
new file mode 100644
index 000000000..2beb46c50
--- /dev/null
+++ b/gnuradio-examples/c++/dialtone/dialtone.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class dialtone;
+typedef boost::shared_ptr<dialtone> dialtone_sptr;
+dialtone_sptr make_dialtone();
+
+class dialtone : public gr_hier_block2
+{
+private:
+ dialtone();
+ friend dialtone_sptr make_dialtone();
+};
diff --git a/gnuradio-examples/c++/dialtone/main.cc b/gnuradio-examples/c++/dialtone/main.cc
new file mode 100644
index 000000000..beefac3a5
--- /dev/null
+++ b/gnuradio-examples/c++/dialtone/main.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2006 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 2, 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.
+ */
+
+// GNU Radio C++ application
+//
+// Instantiate a top block
+// Instantiate a runtime, passing it the top block
+// Tell the runtime to go...
+
+#include <dialtone.h>
+#include <gr_runtime.h>
+
+int main()
+{
+ dialtone_sptr top_block = make_dialtone();
+ gr_runtime_sptr runtime = gr_make_runtime(top_block);
+
+ runtime->run();
+ return 0;
+}
diff --git a/gnuradio-examples/c++/hier/Makefile.am b/gnuradio-examples/c++/hier/Makefile.am
new file mode 100644
index 000000000..f9d341eb7
--- /dev/null
+++ b/gnuradio-examples/c++/hier/Makefile.am
@@ -0,0 +1,56 @@
+#
+# Copyright 2006 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 2, 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
+
+# For compiling within the GNU Radio build tree
+INCLUDES=$(STD_DEFINES_AND_INCLUDES) \
+ -I$(top_srcdir)/gr-audio-alsa/src
+
+GR_AUDIO_ALSA_LIBS=$(top_builddir)/gr-audio-alsa/src/libgr_audio_alsa.la
+
+# For compiling outside the tree, these are the usual
+# INCLUDES = -I/usr/local/include -I/usr/local/include/gnuradio
+# GNURADIO_CORE_LIBS = -lgnuradio-core
+# GR_AUDIO_ALSA_LIBS = -lgr_audio_alsa
+
+noinst_PROGRAMS = dialtone
+
+noinst_HEADERS = \
+ dialtone.h \
+ sink.h \
+ source.h \
+ siggen.h \
+ output.h
+
+dialtone_SOURCES = \
+ dialtone.cc \
+ source.cc \
+ sink.cc \
+ siggen.cc \
+ output.cc \
+ main.cc
+
+dialtone_LDADD = \
+ $(GNURADIO_CORE_LIBS) \
+ $(GR_AUDIO_ALSA_LIBS)
+
+MOSTLYCLEANFILES = *~
diff --git a/gnuradio-examples/c++/hier/dialtone.cc b/gnuradio-examples/c++/hier/dialtone.cc
new file mode 100644
index 000000000..eb77cf27b
--- /dev/null
+++ b/gnuradio-examples/c++/hier/dialtone.cc
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 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 2, 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 <dialtone.h>
+#include <gr_io_signature.h>
+#include <source.h>
+#include <gr_kludge_copy.h>
+#include <sink.h>
+
+// Shared pointer constructor
+dialtone_sptr make_dialtone()
+{
+ return dialtone_sptr(new dialtone());
+}
+
+// Hierarchical block constructor, with no inputs or outputs
+dialtone::dialtone() :
+gr_hier_block2("dialtone",
+ gr_make_io_signature(0,0,0),
+ gr_make_io_signature(0,0,0))
+{
+ define_component("source", make_source());
+ define_component("copy", gr_make_kludge_copy(sizeof(float)));
+ define_component("sink", make_sink());
+
+ connect("source", 0, "copy", 0);
+ connect("source", 1, "copy", 1);
+ connect("copy", 0, "sink", 0);
+ connect("copy", 1, "sink", 1);
+}
diff --git a/gnuradio-examples/c++/hier/dialtone.h b/gnuradio-examples/c++/hier/dialtone.h
new file mode 100644
index 000000000..2beb46c50
--- /dev/null
+++ b/gnuradio-examples/c++/hier/dialtone.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class dialtone;
+typedef boost::shared_ptr<dialtone> dialtone_sptr;
+dialtone_sptr make_dialtone();
+
+class dialtone : public gr_hier_block2
+{
+private:
+ dialtone();
+ friend dialtone_sptr make_dialtone();
+};
diff --git a/gnuradio-examples/c++/hier/main.cc b/gnuradio-examples/c++/hier/main.cc
new file mode 100644
index 000000000..beefac3a5
--- /dev/null
+++ b/gnuradio-examples/c++/hier/main.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2006 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 2, 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.
+ */
+
+// GNU Radio C++ application
+//
+// Instantiate a top block
+// Instantiate a runtime, passing it the top block
+// Tell the runtime to go...
+
+#include <dialtone.h>
+#include <gr_runtime.h>
+
+int main()
+{
+ dialtone_sptr top_block = make_dialtone();
+ gr_runtime_sptr runtime = gr_make_runtime(top_block);
+
+ runtime->run();
+ return 0;
+}
diff --git a/gnuradio-examples/c++/hier/output.cc b/gnuradio-examples/c++/hier/output.cc
new file mode 100644
index 000000000..88ee96e58
--- /dev/null
+++ b/gnuradio-examples/c++/hier/output.cc
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 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 2, 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 <output.h>
+#include <gr_io_signature.h>
+#include <audio_alsa_sink.h>
+
+// Shared pointer constructor
+output_sptr make_output()
+{
+ return output_sptr(new output());
+}
+
+output::output() :
+gr_hier_block2("output",
+ gr_make_io_signature(2,2,sizeof(float)),
+ gr_make_io_signature(0,0,0))
+{
+ define_component("audio", audio_alsa_make_sink(48000));
+
+ connect("self", 0, "audio", 0);
+ connect("self", 1, "audio", 1);
+}
diff --git a/gnuradio-examples/c++/hier/output.h b/gnuradio-examples/c++/hier/output.h
new file mode 100644
index 000000000..c2f5c99e4
--- /dev/null
+++ b/gnuradio-examples/c++/hier/output.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class output;
+typedef boost::shared_ptr<class output> output_sptr;
+output_sptr make_output();
+
+class output : public gr_hier_block2
+{
+private:
+ output();
+ friend output_sptr make_output();
+};
diff --git a/gnuradio-examples/c++/hier/siggen.cc b/gnuradio-examples/c++/hier/siggen.cc
new file mode 100644
index 000000000..f3b4f6733
--- /dev/null
+++ b/gnuradio-examples/c++/hier/siggen.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006 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 2, 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 <siggen.h>
+#include <gr_io_signature.h>
+#include <gr_sig_source_f.h>
+
+// Shared pointer constructor
+siggen_sptr make_siggen()
+{
+ return siggen_sptr(new siggen());
+}
+
+siggen::siggen() :
+gr_hier_block2("siggen",
+ gr_make_io_signature(0,0,0),
+ gr_make_io_signature(2,2,sizeof(float)))
+{
+ define_component("siggen0", gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 0.5));
+ define_component("siggen1", gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 0.5));
+
+ connect("siggen0", 0, "self", 0);
+ connect("siggen1", 0, "self", 1);
+}
diff --git a/gnuradio-examples/c++/hier/siggen.h b/gnuradio-examples/c++/hier/siggen.h
new file mode 100644
index 000000000..6169882c6
--- /dev/null
+++ b/gnuradio-examples/c++/hier/siggen.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class siggen;
+typedef boost::shared_ptr<class siggen> siggen_sptr;
+siggen_sptr make_siggen();
+
+class siggen : public gr_hier_block2
+{
+private:
+ siggen();
+ friend siggen_sptr make_siggen();
+};
diff --git a/gnuradio-examples/c++/hier/sink.cc b/gnuradio-examples/c++/hier/sink.cc
new file mode 100644
index 000000000..f073eb982
--- /dev/null
+++ b/gnuradio-examples/c++/hier/sink.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 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 2, 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 <sink.h>
+#include <gr_io_signature.h>
+#include <gr_kludge_copy.h>
+#include <output.h>
+
+// Shared pointer constructor
+sink_sptr make_sink()
+{
+ return sink_sptr(new sink());
+}
+
+sink::sink() :
+gr_hier_block2("sink",
+ gr_make_io_signature(2,2,sizeof(float)),
+ gr_make_io_signature(0,0,0))
+{
+ define_component("copy", gr_make_kludge_copy(sizeof(float)));
+ define_component("output", make_output());
+
+ connect("self", 0, "copy", 0);
+ connect("self", 1, "copy", 1);
+ connect("copy", 0, "output", 0);
+ connect("copy", 1, "output", 1);
+}
diff --git a/gnuradio-examples/c++/hier/sink.h b/gnuradio-examples/c++/hier/sink.h
new file mode 100644
index 000000000..5428b59a6
--- /dev/null
+++ b/gnuradio-examples/c++/hier/sink.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class sink;
+typedef boost::shared_ptr<sink> sink_sptr;
+sink_sptr make_sink();
+
+class sink : public gr_hier_block2
+{
+private:
+ sink();
+ friend sink_sptr make_sink();
+};
diff --git a/gnuradio-examples/c++/hier/source.cc b/gnuradio-examples/c++/hier/source.cc
new file mode 100644
index 000000000..816f3aa2f
--- /dev/null
+++ b/gnuradio-examples/c++/hier/source.cc
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 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 2, 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 <source.h>
+#include <gr_io_signature.h>
+#include <siggen.h>
+
+// Shared pointer constructor
+source_sptr make_source()
+{
+ return source_sptr(new source());
+}
+
+source::source() :
+gr_hier_block2("source",
+ gr_make_io_signature(0,0,0),
+ gr_make_io_signature(2,2,sizeof(float)))
+{
+ define_component("siggen", make_siggen());
+
+ connect("siggen", 0, "self", 0);
+ connect("siggen", 1, "self", 1);
+}
diff --git a/gnuradio-examples/c++/hier/source.h b/gnuradio-examples/c++/hier/source.h
new file mode 100644
index 000000000..8057726c9
--- /dev/null
+++ b/gnuradio-examples/c++/hier/source.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 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 2, 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 <gr_hier_block2.h>
+
+class source;
+typedef boost::shared_ptr<source> source_sptr;
+source_sptr make_source();
+
+class source : public gr_hier_block2
+{
+private:
+ source();
+ friend source_sptr make_source();
+};