From 54803ebc0450e9ee46e66b15d3b29249e44c55ed Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 12:38:52 -0400 Subject: Adding shell block for a random annotator. This will be used only for testing the stream tags, which is why its sitting in runtime. --- gnuradio-core/src/lib/runtime/Makefile.am | 3 ++ .../src/lib/runtime/gr_random_annotator.cc | 53 ++++++++++++++++++++++ .../src/lib/runtime/gr_random_annotator.h | 51 +++++++++++++++++++++ .../src/lib/runtime/gr_random_annotator.i | 32 +++++++++++++ gnuradio-core/src/lib/runtime/runtime.i | 2 + 5 files changed, 141 insertions(+) create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.cc create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.h create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.i (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 4c52f3ab0..1af91d80d 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -49,6 +49,7 @@ libruntime_la_SOURCES = \ gr_msg_queue.cc \ gr_pagesize.cc \ gr_preferences.cc \ + gr_random_annotator.cc \ gr_realtime.cc \ gr_scheduler.cc \ gr_scheduler_sts.cc \ @@ -103,6 +104,7 @@ grinclude_HEADERS = \ gr_msg_queue.h \ gr_pagesize.h \ gr_preferences.h \ + gr_random_annotator.h \ gr_realtime.h \ gr_runtime_types.h \ gr_scheduler.h \ @@ -153,6 +155,7 @@ swiginclude_HEADERS = \ gr_message.i \ gr_msg_handler.i \ gr_msg_queue.i \ + gr_random_annotator.i \ gr_realtime.i \ gr_single_threaded_scheduler.i \ gr_sync_block.i \ diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc new file mode 100644 index 000000000..85995fde1 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) + : gr_sync_block ("random_annotator", + gr_make_io_signature (1, 1, sizeof_stream_item), + gr_make_io_signature (1, 1, sizeof_stream_item)) +{ +} + +gr_random_annotator::~gr_random_annotator () +{ +} + +gr_random_annotator_sptr +gr_make_random_annotator (size_t sizeof_stream_item) +{ + return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item)); +} + +int +gr_random_annotator::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + return noutput_items; +} diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h new file mode 100644 index 000000000..cf894c640 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 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. + */ + +#ifndef INCLUDED_GR_RANDOM_ANNOTATOR_H +#define INCLUDED_GR_RANDOM_ANNOTATOR_H + +#include + +class gr_random_annotator; +typedef boost::shared_ptr gr_random_annotator_sptr; + +// public constructor +gr_random_annotator_sptr +gr_make_random_annotator (size_t sizeof_stream_item); + +class gr_random_annotator : public gr_sync_block +{ + public: + ~gr_random_annotator (); + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +protected: + gr_random_annotator (size_t sizeof_stream_item); + + private: + friend gr_random_annotator_sptr + gr_make_random_annotator (size_t sizeof_stream_item); +}; + +#endif diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.i b/gnuradio-core/src/lib/runtime/gr_random_annotator.i new file mode 100644 index 000000000..f8765a294 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,random_annotator); + +gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); + +class gr_random_annotator : public gr_sync_block +{ +private: + gr_random_annotator (size_t sizeof_stream_item); +}; + diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index 20cf68a03..51b32de17 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ %include %include %include +%include %include %include %include -- cgit