summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/swig
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/swig')
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt101
-rw-r--r--gnuradio-runtime/swig/complex_vec_test.i25
-rwxr-xr-xgnuradio-runtime/swig/gen-swig-bug-fix111
-rw-r--r--gnuradio-runtime/swig/gnuradio.i87
-rw-r--r--gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h45
-rw-r--r--gnuradio-runtime/swig/gr_basic_block.i62
-rw-r--r--gnuradio-runtime/swig/gr_block.i93
-rw-r--r--gnuradio-runtime/swig/gr_block_detail.i66
-rw-r--r--gnuradio-runtime/swig/gr_buffer.i63
-rw-r--r--gnuradio-runtime/swig/gr_constants.i13
-rw-r--r--gnuradio-runtime/swig/gr_dispatcher.i55
-rw-r--r--gnuradio-runtime/swig/gr_error_handler.i69
-rw-r--r--gnuradio-runtime/swig/gr_feval.i233
-rw-r--r--gnuradio-runtime/swig/gr_hier_block2.i88
-rw-r--r--gnuradio-runtime/swig/gr_io_signature.i73
-rw-r--r--gnuradio-runtime/swig/gr_logger.i79
-rw-r--r--gnuradio-runtime/swig/gr_message.i65
-rw-r--r--gnuradio-runtime/swig/gr_msg_handler.i32
-rw-r--r--gnuradio-runtime/swig/gr_msg_queue.i107
-rw-r--r--gnuradio-runtime/swig/gr_prefs.i63
-rw-r--r--gnuradio-runtime/swig/gr_realtime.i44
-rw-r--r--gnuradio-runtime/swig/gr_shared_ptr.i43
-rw-r--r--gnuradio-runtime/swig/gr_single_threaded_scheduler.i54
-rw-r--r--gnuradio-runtime/swig/gr_swig_block_magic.i58
-rw-r--r--gnuradio-runtime/swig/gr_sync_block.i29
-rw-r--r--gnuradio-runtime/swig/gr_sync_decimator.i31
-rw-r--r--gnuradio-runtime/swig/gr_sync_interpolator.i31
-rw-r--r--gnuradio-runtime/swig/gr_tagged_stream_block.i30
-rw-r--r--gnuradio-runtime/swig/gr_tags.i32
-rw-r--r--gnuradio-runtime/swig/gr_top_block.i74
-rw-r--r--gnuradio-runtime/swig/runtime_block_gateway.i46
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i170
32 files changed, 2172 insertions, 0 deletions
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
new file mode 100644
index 0000000000..cccb9a5741
--- /dev/null
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -0,0 +1,101 @@
+# Copyright 2013 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GRUEL_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${LOG4CPP_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(${Boost_LIBRARY_DIRS})
+
+set(GR_SWIG_LIBRARIES
+ gnuradio-runtime
+ ${LOG4CPP_LIBRARIES}
+)
+
+# Only use if log4cpp is installed
+# Define ENABLE_GR_LOG for the .i file to ignore it.
+if(ENABLE_GR_LOG)
+ SET(GR_SWIG_FLAGS "-DENABLE_GR_LOG")
+endif(ENABLE_GR_LOG)
+
+if(ENABLE_GR_CTRLPORT)
+ list(APPEND GR_SWIG_FLAGS -DGR_CTRLPORT)
+ list(APPEND GR_SWIG_LIBRARIES ${ICE_LIBRARIES})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR})
+endif(ENABLE_GR_CTRLPORT)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+set(GR_RUNTIME_SWIG_DOC_FILE ${GR_SWIG_DOC_FILE})
+
+GR_SWIG_MAKE(runtime_swig runtime_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS runtime_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ COMPONENT "runtime_python"
+)
+
+install(
+ FILES
+ gnuradio_swig_bug_workaround.h
+ complex_vec_test.i
+ gnuradio.i
+ gr_basic_block.i
+ gr_block_detail.i
+ gr_block.i
+ gr_buffer.i
+ gr_constants.i
+ gr_dispatcher.i
+ gr_error_handler.i
+ gr_feval.i
+ gr_hier_block2.i
+ gr_io_signature.i
+ gr_logger.i
+ gr_message.i
+ gr_msg_handler.i
+ gr_msg_queue.i
+ gr_prefs.i
+ gr_realtime.i
+ gr_shared_ptr.i
+ gr_single_threaded_scheduler.i
+ gr_swig_block_magic.i
+ gr_sync_block.i
+ gr_sync_decimator.i
+ gr_sync_interpolator.i
+ gr_tagged_stream_block.i
+ gr_tags.i
+ gr_top_block.i
+ runtime_block_gateway.i
+ runtime_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "runtime_swig"
+)
diff --git a/gnuradio-runtime/swig/complex_vec_test.i b/gnuradio-runtime/swig/complex_vec_test.i
new file mode 100644
index 0000000000..4b95633be7
--- /dev/null
+++ b/gnuradio-runtime/swig/complex_vec_test.i
@@ -0,0 +1,25 @@
+
+std::vector<std::complex<float> >
+complex_vec_test0();
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input);
+
+std::complex<float>
+complex_scalar_test0();
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input);
+
+std::vector<int>
+int_vec_test0();
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input);
+
+std::vector<float>
+float_vec_test0();
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input);
+
diff --git a/gnuradio-runtime/swig/gen-swig-bug-fix b/gnuradio-runtime/swig/gen-swig-bug-fix
new file mode 100755
index 0000000000..5e9f82e7d7
--- /dev/null
+++ b/gnuradio-runtime/swig/gen-swig-bug-fix
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import sys
+import re
+
+def write_header (f):
+ f.write ('''/* -*- 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_GNURADIO_SWIG_BUG_WORKAROUND_H
+#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+
+/*
+ * This include files works around a bug in SWIG 1.3.21 and 22
+ * where it fails to emit these declarations when doing
+ * %import "gnuradio.i"
+ */
+
+''')
+
+def write_trailer (f):
+ f.write ('''
+#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
+''')
+
+def doit (input, output):
+ re_RULES_BEGIN = re.compile ('RULES \(BEGIN\)')
+ re_RULES_END = re.compile ('RULES \(END\)')
+ re_RETURN = re.compile ('^\s*return')
+ re_NOT_ID = re.compile ('[^a-zA-Z0-9_]')
+ words = {}
+
+ write_header (output)
+ for line in input:
+ if re_RULES_BEGIN.search (line):
+ break
+
+ for line in input:
+ if re_RULES_END.search (line):
+ break
+ if not re_RETURN.match (line):
+ continue
+ line = re_NOT_ID.sub (' ', line)
+ line = re.sub (' +', ' ', line)
+ for w in line.split (' '):
+ words[w] = 1
+
+ for w in ('', 'return', 'void', 'x'):
+ del words[w]
+
+ wl = words.keys()
+ wl.sort ()
+ for w in wl:
+ output.write ('class ' + w + ';\n')
+
+ write_trailer (output)
+
+
+def main ():
+ if len (sys.argv) != 3:
+ sys.stderr.write ("usage: %s gnuradio_swig_python.cc gnuradio_swig_bug_workaround.h\n"
+ % (sys.argv[0],))
+ sys.exit (1)
+ input_filename = sys.argv[1]
+ output_filename = sys.argv[2]
+ input = open (input_filename, "r")
+ output = open (output_filename, "w")
+ doit (input, output)
+
+if __name__ == '__main__':
+ main ()
+
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
new file mode 100644
index 0000000000..d85082aae2
--- /dev/null
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2009,2012 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.
+ */
+
+// Disable warning about base class types
+#pragma SWIG nowarn=401
+
+////////////////////////////////////////////////////////////////////////
+// gnuradio.i
+// SWIG interface definition
+////////////////////////////////////////////////////////////////////////
+
+%include <gruel_common.i>
+
+////////////////////////////////////////////////////////////////////////
+// Headers
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include <gr_types.h>
+#include <stddef.h> // size_t
+#include <complex>
+%}
+
+%feature("autodoc","1");
+
+// local file
+%include <gr_shared_ptr.i>
+%include <gr_types.h>
+%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+%include <std_except.i>
+
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+
+
+// instantiate the required template specializations
+
+namespace std {
+ %template() vector<unsigned char>;
+ %template() vector<char>;
+ %template() vector<short>;
+ %template() vector<int>;
+ %template() vector<float>;
+ %template() vector<double>;
+ // %template() std::complex<float>;
+
+ %template() vector< std::complex<float> >;
+ %template() vector< std::vector< unsigned char > >;
+ %template() vector< std::vector< char > >;
+ %template() vector< std::vector< short > >;
+ %template() vector< std::vector< int > >;
+ %template() vector< std::vector< float > >;
+ %template() vector< std::vector< double > >;
+ %template() vector< std::vector< std::complex<float> > >;
+};
+
+////////////////////////////////////////////////////////////////////////
+
+#ifndef SW_RUNTIME
+// import runtime_swig.i for all but sw_runtime, since it needs to %include
+%import <runtime_swig.i>
+#endif
+
+////////////////////////////////////////////////////////////////////////
diff --git a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
new file mode 100644
index 0000000000..1994f06609
--- /dev/null
+++ b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
@@ -0,0 +1,45 @@
+/* -*- 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_GNURADIO_SWIG_BUG_WORKAROUND_H
+#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+
+/*
+ * This include files works around a bug in SWIG 1.3.21 and 22
+ * where it fails to emit these declarations when doing
+ * %import "gnuradio.i"
+ */
+
+class gr_base_error_handler;
+class gr_basic_block;
+class gr_block;
+class gr_error_handler;
+class gr_file_error_handler;
+class gr_hier_block2;
+class gr_msg_handler;
+class gr_msg_queue;
+class gr_sync_block;
+class gr_sync_decimator;
+class gr_sync_interpolator;
+class gr_top_block;
+
+#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
diff --git a/gnuradio-runtime/swig/gr_basic_block.i b/gnuradio-runtime/swig/gr_basic_block.i
new file mode 100644
index 0000000000..62f16462d6
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_basic_block.i
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+class gr_basic_block;
+typedef boost::shared_ptr<gr_basic_block> gr_basic_block_sptr;
+%template(gr_basic_block_sptr) boost::shared_ptr<gr_basic_block>;
+%include "pmt_swig.i"
+using namespace pmt;
+
+// support vectors of these...
+namespace std {
+ %template(x_vector_gr_basic_block_sptr) vector<gr_basic_block_sptr>;
+};
+
+class gr_basic_block
+{
+protected:
+ gr_basic_block();
+
+public:
+ virtual ~gr_basic_block();
+ std::string name() const;
+ std::string symbol_name() const;
+ gr_io_signature_sptr input_signature() const;
+ gr_io_signature_sptr output_signature() const;
+ long unique_id() const;
+ gr_basic_block_sptr to_basic_block();
+ bool check_topology (int ninputs, int noutputs);
+ std::string alias();
+ void set_block_alias(std::string name);
+ void _post(pmt_t which_port, pmt_t msg);
+ pmt_t message_ports_in();
+ pmt_t message_ports_out();
+};
+
+%rename(block_ncurrently_allocated) gr_basic_block_ncurrently_allocated;
+long gr_basic_block_ncurrently_allocated();
+
+#ifdef SWIGPYTHON
+%pythoncode %{
+gr_basic_block_sptr.__repr__ = lambda self: "<gr_basic_block %s (%d)>" % (self.name(), self.unique_id ())
+%}
+#endif
diff --git a/gnuradio-runtime/swig/gr_block.i b/gnuradio-runtime/swig/gr_block.i
new file mode 100644
index 0000000000..a53489f9a2
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_block.i
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_basic_block.i>
+
+class gr_block;
+typedef boost::shared_ptr<gr_block> gr_block_sptr;
+%template(gr_block_sptr) boost::shared_ptr<gr_block>;
+
+// support vectors of these...
+namespace std {
+ %template(x_vector_gr_block_sptr) vector<gr_block_sptr>;
+};
+
+class gr_block : public gr_basic_block {
+ protected:
+ gr_block (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+
+ public:
+
+ virtual ~gr_block ();
+
+ unsigned history () const;
+
+ int output_multiple () const;
+ double relative_rate () const;
+
+ bool start();
+ bool stop();
+
+ uint64_t nitems_read(unsigned int which_input);
+ uint64_t nitems_written(unsigned int which_output);
+
+ // Methods to manage the block's max_noutput_items size.
+ int max_noutput_items();
+ void set_max_noutput_items(int m);
+ void unset_max_noutput_items();
+ bool is_set_max_noutput_items();
+
+ // Methods to manage block's min/max buffer sizes.
+ long max_output_buffer(int i);
+ void set_max_output_buffer(long max_output_buffer);
+ void set_max_output_buffer(int port, long max_output_buffer);
+ long min_output_buffer(int i);
+ void set_min_output_buffer(long min_output_buffer);
+ void set_min_output_buffer(int port, long min_output_buffer);
+
+ // Methods to access performance counters
+ float pc_noutput_items();
+ float pc_noutput_items_var();
+ float pc_nproduced();
+ float pc_nproduced_var();
+ float pc_input_buffers_full(int which);
+ float pc_input_buffers_full_var(int which);
+ std::vector<float> pc_input_buffers_full();
+ std::vector<float> pc_input_buffers_full_var();
+ float pc_output_buffers_full(int which);
+ float pc_output_buffers_full_var(int which);
+ std::vector<float> pc_output_buffers_full();
+ std::vector<float> pc_output_buffers_full_var();
+ float pc_work_time();
+ float pc_work_time_var();
+
+ // Methods to manage processor affinity.
+ void set_processor_affinity(const std::vector<int> &mask);
+ void unset_processor_affinity();
+ std::vector<int> processor_affinity();
+
+ // internal use
+ gr_block_detail_sptr detail () const { return d_detail; }
+ void set_detail (gr_block_detail_sptr detail) { d_detail = detail; }
+};
diff --git a/gnuradio-runtime/swig/gr_block_detail.i b/gnuradio-runtime/swig/gr_block_detail.i
new file mode 100644
index 0000000000..74ff463604
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_block_detail.i
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+class gr_block_detail;
+typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr;
+%template(gr_block_detail_sptr) boost::shared_ptr<gr_block_detail>;
+%rename(block_detail) gr_make_block_detail;
+%ignore gr_block_detail;
+
+gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+class gr_block_detail {
+ public:
+
+ ~gr_block_detail ();
+
+ int ninputs () const { return d_ninputs; }
+ int noutputs () const { return d_noutputs; }
+ bool sink_p () const { return d_noutputs == 0; }
+ bool source_p () const { return d_ninputs == 0; }
+
+ void set_input (unsigned int which, gr_buffer_reader_sptr reader);
+ gr_buffer_reader_sptr input (unsigned int which)
+ {
+ if (which >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::input");
+ return d_input[which];
+ }
+
+ void set_output (unsigned int which, gr_buffer_sptr buffer);
+ gr_buffer_sptr output (unsigned int which)
+ {
+ if (which >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::output");
+ return d_output[which];
+ }
+
+ // ----------------------------------------------------------------------------
+
+ private:
+ gr_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+};
+
+
+%rename(block_detail_ncurrently_allocated) gr_block_detail_ncurrently_allocated;
+long gr_block_detail_ncurrently_allocated ();
diff --git a/gnuradio-runtime/swig/gr_buffer.i b/gnuradio-runtime/swig/gr_buffer.i
new file mode 100644
index 0000000000..390a94e050
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_buffer.i
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+class gr_buffer;
+typedef boost::shared_ptr<gr_buffer> gr_buffer_sptr;
+%template(gr_buffer_sptr) boost::shared_ptr<gr_buffer>;
+%rename(buffer) gr_make_buffer;
+%ignore gr_buffer;
+
+gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+
+class gr_buffer {
+ public:
+ ~gr_buffer ();
+
+ private:
+ gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+};
+
+
+class gr_buffer_reader;
+typedef boost::shared_ptr<gr_buffer_reader> gr_buffer_reader_sptr;
+%template(gr_buffer_reader_sptr) boost::shared_ptr<gr_buffer_reader>;
+%ignore gr_buffer_reader;
+
+%rename(buffer_add_reader) gr_buffer_add_reader;
+gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link);
+
+class gr_buffer_reader {
+ public:
+ ~gr_buffer_reader ();
+
+ private:
+ friend class gr_buffer;
+ gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link);
+};
+
+
+%rename(buffer_ncurrently_allocated) gr_buffer_ncurrently_allocated;
+long gr_buffer_ncurrently_allocated ();
+
+%rename(buffer_reader_ncurrently_allocated) gr_buffer_reader_ncurrently_allocated;
+long gr_buffer_reader_ncurrently_allocated ();
+
diff --git a/gnuradio-runtime/swig/gr_constants.i b/gnuradio-runtime/swig/gr_constants.i
new file mode 100644
index 0000000000..a5aef14925
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_constants.i
@@ -0,0 +1,13 @@
+/* -*- c++ -*- */
+
+%rename(prefix) gr_prefix;
+%rename(sysconfdir) gr_sysconfdir;
+%rename(prefsdir) gr_prefsdir;
+%rename(build_date) gr_build_date;
+%rename(version) gr_version;
+
+const std::string gr_prefix();
+const std::string gr_sysconfdir();
+const std::string gr_prefsdir();
+const std::string gr_build_date();
+const std::string gr_version();
diff --git a/gnuradio-runtime/swig/gr_dispatcher.i b/gnuradio-runtime/swig/gr_dispatcher.i
new file mode 100644
index 0000000000..28737cd317
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_dispatcher.i
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+class gr_dispatcher;
+typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr;
+%template(gr_dispatcher_sptr) boost::shared_ptr<gr_dispatcher>;
+
+%rename(dispatcher) gr_make_dispatcher;
+gr_dispatcher_sptr gr_make_dispatcher();
+
+%rename(dispatcher_singleton) gr_dispatcher_singleton;
+gr_dispatcher_sptr gr_dispatcher_singleton();
+
+/*!
+ * \brief invoke callbacks based on select.
+ *
+ * \sa gr_select_handler
+ */
+class gr_dispatcher
+{
+ gr_dispatcher();
+
+public:
+ ~gr_dispatcher();
+
+ /*!
+ * \brief Event dispatching loop.
+ *
+ * Enter a polling loop that only terminates after all gr_select_handlers
+ * have been removed. \p timeout sets the timeout parameter to the select()
+ * call, measured in seconds.
+ *
+ * \param timeout maximum number of seconds to block in select.
+ */
+ void loop(double timeout=10);
+};
diff --git a/gnuradio-runtime/swig/gr_error_handler.i b/gnuradio-runtime/swig/gr_error_handler.i
new file mode 100644
index 0000000000..072394a727
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_error_handler.i
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+%rename(error_handler) gr_error_handler;
+%rename(file_error_handler) gr_file_error_handler;
+
+class gr_error_handler {
+public:
+ enum seriousness {
+ ERR_DEBUG = 0x00000000,
+ ERR_MESSAGE = 0x00010000,
+ ERR_WARNING = 0x00020000,
+ ERR_ERROR = 0x00030000,
+ ERR_FATAL = 0x00040000
+ };
+
+ gr_error_handler() {}
+ virtual ~gr_error_handler();
+
+ static gr_error_handler *default_handler();
+ static gr_error_handler *silent_handler();
+
+ static bool has_default_handler();
+ static void set_default_handler(gr_error_handler *errh);
+
+ virtual int nwarnings() const = 0;
+ virtual int nerrors() const = 0;
+ virtual void reset_counts() = 0;
+
+ void verror_text(seriousness s, const std::string &text);
+};
+
+%ignore gr_base_error_handler;
+class gr_base_error_handler : public gr_error_handler {
+ int d_nwarnings;
+ int d_nerrors;
+
+public:
+ gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
+ int nwarnings() const { return d_nwarnings; }
+ int nerrors() const { return d_nerrors; }
+ void reset_counts() { d_nwarnings = d_nerrors = 0; }
+ void count_error(seriousness s);
+};
+
+class gr_file_error_handler : public gr_base_error_handler {
+public:
+ gr_file_error_handler(int file_descriptor);
+ ~gr_file_error_handler();
+};
diff --git a/gnuradio-runtime/swig/gr_feval.i b/gnuradio-runtime/swig/gr_feval.i
new file mode 100644
index 0000000000..bcf4f1e646
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_feval.i
@@ -0,0 +1,233 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+
+/*
+ * N.B., this is a _very_ non-standard SWIG .i file
+ *
+ * It contains a bunch of magic that is required to ensure that when
+ * these classes are used as base classes for python code,
+ * everything works when calling back from C++ into Python.
+ *
+ * The gist of the problem is that our C++ code is usually not holding
+ * the Python Global Interpreter Lock (GIL). Thus if we invoke a
+ * "director" method from C++, we'll end up in Python not holding the
+ * GIL. Disaster (SIGSEGV) will result. To avoid this we insert a
+ * "shim" that grabs and releases the GIL.
+ *
+ * If you don't understand SWIG "directors" or the Python GIL,
+ * don't bother trying to understand what's going on in here.
+ *
+ * [We could eliminate a bunch of this hair by requiring SWIG 1.3.29
+ * or later and some additional magic declarations, but many systems
+ * aren't shipping that version yet. Thus we kludge...]
+ */
+
+
+// Directors are only supported in Python, Java and C#
+#ifdef SWIGPYTHON
+%include "pmt_swig.i"
+using namespace pmt;
+
+// Enable SWIG directors for these classes
+%feature("director") gr_py_feval_dd;
+%feature("director") gr_py_feval_cc;
+%feature("director") gr_py_feval_ll;
+%feature("director") gr_py_feval;
+%feature("director") gr_py_feval_p;
+
+%feature("nodirector") gr_py_feval_dd::calleval;
+%feature("nodirector") gr_py_feval_cc::calleval;
+%feature("nodirector") gr_py_feval_ll::calleval;
+%feature("nodirector") gr_py_feval::calleval;
+%feature("nodirector") gr_py_feval_p::calleval;
+
+
+%rename(feval_dd) gr_py_feval_dd;
+%rename(feval_cc) gr_py_feval_cc;
+%rename(feval_ll) gr_py_feval_ll;
+%rename(feval) gr_py_feval;
+%rename(feval_p) gr_py_feval_p;
+
+//%exception {
+// try { $action }
+// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; }
+//}
+
+%{
+
+// class that ensures we acquire and release the Python GIL
+
+class ensure_py_gil_state {
+ PyGILState_STATE d_gstate;
+public:
+ ensure_py_gil_state() { d_gstate = PyGILState_Ensure(); }
+ ~ensure_py_gil_state() { PyGILState_Release(d_gstate); }
+};
+
+%}
+
+/*
+ * These are the real C++ base classes, however we don't want these exposed.
+ */
+%ignore gr_feval_dd;
+class gr_feval_dd
+{
+protected:
+ virtual double eval(double x);
+
+public:
+ gr_feval_dd() {}
+ virtual ~gr_feval_dd();
+
+ virtual double calleval(double x);
+};
+
+%ignore gr_feval_cc;
+class gr_feval_cc
+{
+protected:
+ virtual gr_complex eval(gr_complex x);
+
+public:
+ gr_feval_cc() {}
+ virtual ~gr_feval_cc();
+
+ virtual gr_complex calleval(gr_complex x);
+};
+
+%ignore gr_feval_ll;
+class gr_feval_ll
+{
+protected:
+ virtual long eval(long x);
+
+public:
+ gr_feval_ll() {}
+ virtual ~gr_feval_ll();
+
+ virtual long calleval(long x);
+};
+
+%ignore gr_feval;
+class gr_feval
+{
+protected:
+ virtual void eval();
+
+public:
+ gr_feval() {}
+ virtual ~gr_feval();
+
+ virtual void calleval();
+};
+
+%ignore gr_feval_p;
+class gr_feval_p
+{
+protected:
+ virtual void eval(pmt_t x);
+
+public:
+ gr_feval_p() {}
+ virtual ~gr_feval_p();
+
+ virtual void calleval(pmt_t x);
+};
+
+/*
+ * These are the ones to derive from in Python. They have the magic shim
+ * that ensures that we're holding the Python GIL when we enter Python land...
+ */
+
+%inline %{
+#include <gruel/pmt.h>
+
+class gr_py_feval_dd : public gr_feval_dd
+{
+ public:
+ double calleval(double x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval_cc : public gr_feval_cc
+{
+ public:
+ gr_complex calleval(gr_complex x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval_ll : public gr_feval_ll
+{
+ public:
+ long calleval(long x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval : public gr_feval
+{
+ public:
+ void calleval()
+ {
+ ensure_py_gil_state _lock;
+ eval();
+ }
+};
+
+class gr_py_feval_p : public gr_feval_p
+{
+ public:
+ void calleval(pmt::pmt_t x)
+ {
+ ensure_py_gil_state _lock;
+ eval(x);
+ }
+};
+
+%}
+
+
+
+// examples / test cases
+
+%rename(feval_dd_example) gr_feval_dd_example;
+double gr_feval_dd_example(gr_feval_dd *f, double x);
+
+%rename(feval_cc_example) gr_feval_cc_example;
+gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x);
+
+%rename(feval_ll_example) gr_feval_ll_example;
+long gr_feval_ll_example(gr_feval_ll *f, long x);
+
+%rename(feval_example) gr_feval_example;
+void gr_feval_example(gr_feval *f);
+
+#endif // SWIGPYTHON
diff --git a/gnuradio-runtime/swig/gr_hier_block2.i b/gnuradio-runtime/swig/gr_hier_block2.i
new file mode 100644
index 0000000000..a857394ca7
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_hier_block2.i
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2007 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 <gr_basic_block.i>
+
+class gr_hier_block2;
+typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr;
+%template(gr_hier_block2_sptr) boost::shared_ptr<gr_hier_block2>;
+
+// Hack to have a Python shim implementation of gr.hier_block2
+// that instantiates one of these and passes through calls
+%rename(hier_block2_swig) gr_make_hier_block2;
+gr_hier_block2_sptr gr_make_hier_block2(const std::string name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature)
+ throw (std::runtime_error);
+
+// Rename connect and disconnect so that we can more easily build a
+// better interface in scripting land.
+%rename(primitive_connect) gr_hier_block2::connect;
+%rename(primitive_disconnect) gr_hier_block2::disconnect;
+%rename(primitive_msg_connect) gr_hier_block2::msg_connect;
+%rename(primitive_msg_disconnect) gr_hier_block2::msg_disconnect;
+%rename(primitive_message_port_register_hier_in) gr_hier_block2::message_port_register_hier_in;
+%rename(primitive_message_port_register_hier_out) gr_hier_block2::message_port_register_hier_out;
+
+class gr_hier_block2 : public gr_basic_block
+{
+private:
+ gr_hier_block2(const std::string name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+
+public:
+ ~gr_hier_block2 ();
+
+ void connect(gr_basic_block_sptr block)
+ throw (std::invalid_argument);
+ void connect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+ throw (std::invalid_argument);
+ void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+ throw (std::runtime_error);
+ void msg_connect(gr_basic_block_sptr src, std::string srcport,
+ gr_basic_block_sptr dst, std::string dstport)
+ throw (std::runtime_error);
+ void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+ throw (std::runtime_error);
+ void msg_disconnect(gr_basic_block_sptr src, std::string srcport,
+ gr_basic_block_sptr dst, std::string dstport)
+ throw (std::runtime_error);
+
+ void disconnect(gr_basic_block_sptr block)
+ throw (std::invalid_argument);
+ void disconnect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+ throw (std::invalid_argument);
+ void disconnect_all();
+ void lock();
+ void unlock();
+
+ void message_port_register_hier_in(pmt::pmt_t port_id);
+ void message_port_register_hier_out(pmt::pmt_t port_id);
+
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python type coercion
+};
diff --git a/gnuradio-runtime/swig/gr_io_signature.i b/gnuradio-runtime/swig/gr_io_signature.i
new file mode 100644
index 0000000000..fe1707e410
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_io_signature.i
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,2007 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.
+ */
+
+class gr_io_signature;
+typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr;
+%template(gr_io_signature_sptr) boost::shared_ptr<gr_io_signature>;
+
+%rename(io_signature) gr_make_io_signature;
+%rename(io_signature2) gr_make_io_signature2;
+%rename(io_signature3) gr_make_io_signature3;
+%rename(io_signaturev) gr_make_io_signaturev;
+
+
+gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item);
+
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2
+ );
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3
+ );
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+
+class gr_io_signature {
+ gr_io_signature (int min_streams, int max_streams, int sizeof_stream_item);
+
+ friend gr_io_signature_sptr
+ gr_make_io_signaturev(int min_streams,
+ int max_streams,
+ const std::vector<int> &sizeof_stream_item);
+
+ public:
+
+ // disabled. Suspected bug in SWIG 1.3.24
+ // static const int IO_INFINITE = -1;
+
+ ~gr_io_signature ();
+
+ int min_streams () const { return d_min_streams; }
+ int max_streams () const { return d_max_streams; }
+ int sizeof_stream_item (int index) const;
+ std::vector<int> sizeof_stream_items() const;
+};
+
diff --git a/gnuradio-runtime/swig/gr_logger.i b/gnuradio-runtime/swig/gr_logger.i
new file mode 100644
index 0000000000..b43bff5a89
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_logger.i
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+/*******************************************************************************
+* Copyright 2011 Johns Hopkins University Applied Physics Lab
+* Author: Mark Plett
+* Description:
+* SWIG interface generator file for gr_logger module. gr_logger wraps log4cpp logging
+* for gnuradio.
+*******************************************************************************/
+
+%feature("autodoc", "1"); // generate python docstrings
+
+%include "exception.i"
+%import "gnuradio.i" // the common stuff
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include <stdexcept>
+%}
+
+//-----------------------------------
+
+%{
+// The .h files
+#include <gr_logger.h>
+%}
+
+%rename(logger) gr_logger;
+%rename(logger_config) gr_logger_config;
+%rename(logger_get_names) gr_logger_get_logger_names;
+%rename(logger_reset_config) gr_logger_reset_config;
+
+
+void gr_logger_config(const std::string config_filename,unsigned int watch_period = 0);
+std::vector<std::string> gr_logger_get_logger_names(void);
+void gr_logger_reset_config(void);
+
+class gr_logger
+{
+ public:
+ gr_logger(std::string logger_name);
+ void set_level(std::string level){GR_LOG_SET_LEVEL(d_logger,level);}
+ void get_level(std::string &level){GR_LOG_GET_LEVEL(d_logger,level);}
+ void debug(std::string msg){GR_LOG_DEBUG(d_logger,msg);};
+ void info(std::string msg){GR_LOG_INFO(d_logger,msg);};
+ void notice(std::string msg){GR_LOG_NOTICE(d_logger,msg);};
+ void warn(std::string msg){GR_LOG_WARN(d_logger,msg);};
+ void error(std::string msg){GR_LOG_ERROR(d_logger,msg);};
+ void crit(std::string msg){GR_LOG_CRIT(d_logger,msg);};
+ void alert(std::string msg){GR_LOG_ALERT(d_logger,msg);};
+ void fatal(std::string msg){GR_LOG_FATAL(d_logger,msg);};
+ void emerg(std::string msg){GR_LOG_EMERG(d_logger,msg);};
+ void errorIF(bool cond,std::string msg){GR_LOG_ERRORIF(d_logger,cond,msg);};
+ void log_assert(bool cond,std::string msg){GR_LOG_ASSERT(d_logger,cond,msg);};
+ void add_console_appender(std::string target,std::string pattern);
+ void add_file_appender(std::string filename,bool append,std::string pattern);
+ void add_rollingfile_appender(std::string filename,size_t filesize,int bkup_index,bool append,mode_t mode,std::string pattern);
+};
+
+
diff --git a/gnuradio-runtime/swig/gr_message.i b/gnuradio-runtime/swig/gr_message.i
new file mode 100644
index 0000000000..356bba5b58
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_message.i
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+class gr_message;
+typedef boost::shared_ptr<gr_message> gr_message_sptr;
+%template(gr_message_sptr) boost::shared_ptr<gr_message>;
+
+%rename(message_from_string) gr_make_message_from_string;
+gr_message_sptr
+gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0);
+
+%rename(message) gr_make_message;
+gr_message_sptr
+gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0);
+
+/*!
+ * \brief Message.
+ *
+ * The ideas and method names for adjustable message length were
+ * lifted from the click modular router "Packet" class.
+ */
+class gr_message {
+ gr_message (long type, double arg1, double arg2, size_t length);
+
+ unsigned char *buf_data() const { return d_buf_start; }
+ size_t buf_len() const { return d_buf_end - d_buf_start; }
+
+public:
+ ~gr_message ();
+
+ long type() const { return d_type; }
+ double arg1() const { return d_arg1; }
+ double arg2() const { return d_arg2; }
+
+ void set_type(long type) { d_type = type; }
+ void set_arg1(double arg1) { d_arg1 = arg1; }
+ void set_arg2(double arg2) { d_arg2 = arg2; }
+
+ size_t length() const;
+ std::string to_string() const;
+
+};
+
+%rename(message_ncurrently_allocated) gr_message_ncurrently_allocated;
+long gr_message_ncurrently_allocated();
+
diff --git a/gnuradio-runtime/swig/gr_msg_handler.i b/gnuradio-runtime/swig/gr_msg_handler.i
new file mode 100644
index 0000000000..f493dac1b2
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_msg_handler.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+/*!
+ * \brief abstract class of message handlers
+ */
+class gr_msg_handler {
+public:
+ virtual ~gr_msg_handler () = 0;
+
+ //! handle \p msg
+ virtual void handle (gr_message_sptr msg) = 0;
+};
diff --git a/gnuradio-runtime/swig/gr_msg_queue.i b/gnuradio-runtime/swig/gr_msg_queue.i
new file mode 100644
index 0000000000..65cbe782b9
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_msg_queue.i
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2009,2010,2011 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.
+ */
+
+class gr_msg_queue;
+typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr;
+%template(gr_msg_queue_sptr) boost::shared_ptr<gr_msg_queue>;
+
+%rename(msg_queue) gr_make_msg_queue;
+gr_msg_queue_sptr gr_make_msg_queue(unsigned limit=0);
+
+/*!
+ * \brief thread-safe message queue
+ */
+%ignore gr_msg_queue;
+class gr_msg_queue : public gr_msg_handler {
+public:
+ gr_msg_queue(unsigned int limit);
+ ~gr_msg_queue();
+
+ //! Generic msg_handler method: insert the message.
+ //void handle(gr_message_sptr msg) { insert_tail (msg); }
+
+ /*!
+ * \brief Insert message at tail of queue.
+ * \param msg message
+ *
+ * Block if queue if full.
+ */
+ //void insert_tail(gr_message_sptr msg);
+
+ /*!
+ * \brief Delete message from head of queue and return it.
+ * Block if no message is available.
+ */
+ //gr_message_sptr delete_head();
+
+ /*!
+ * \brief If there's a message in the q, delete it and return it.
+ * If no message is available, return 0.
+ */
+ gr_message_sptr delete_head_nowait();
+
+ //! is the queue empty?
+ bool empty_p() const;
+
+ //! is the queue full?
+ bool full_p() const;
+
+ //! return number of messages in queue
+ unsigned int count() const;
+
+ //! Delete all messages from the queue
+ void flush();
+};
+
+/*
+ * The following kludge-o-rama releases the Python global interpreter
+ * lock around these potentially blocking calls. We don't want
+ * libgnuradio-core to be dependent on Python, thus we create these
+ * functions that serve as replacements for the normal C++ delete_head
+ * and insert_tail methods. The %pythoncode smashes these new C++
+ * functions into the gr.msg_queue wrapper class, so that everything
+ * appears normal. (An evil laugh is heard in the distance...)
+ */
+#ifdef SWIGPYTHON
+%inline %{
+ gr_message_sptr gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) {
+ gr_message_sptr msg;
+ GR_PYTHON_BLOCKING_CODE(
+ msg = q->delete_head();
+ )
+ return msg;
+ }
+
+ void gr_py_msg_queue__insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) {
+ GR_PYTHON_BLOCKING_CODE(
+ q->insert_tail(msg);
+ )
+ }
+%}
+
+// smash in new python delete_head and insert_tail methods...
+%pythoncode %{
+gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head
+gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail
+gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail
+%}
+#endif // SWIGPYTHON
diff --git a/gnuradio-runtime/swig/gr_prefs.i b/gnuradio-runtime/swig/gr_prefs.i
new file mode 100644
index 0000000000..c8c4242002
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_prefs.i
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * 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 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.
+ */
+
+class gr_prefs
+{
+public:
+ static gr_prefs *singleton();
+ static void set_singleton(gr_prefs *p);
+
+ virtual ~gr_prefs();
+
+ std::string to_string();
+
+ void save();
+
+ virtual bool has_section(const std::string &section);
+ virtual bool has_option(const std::string &section, const std::string &option);
+
+ virtual const std::string get_string(const std::string &section,
+ const std::string &option,
+ const std::string &default_val);
+ virtual void set_string(const std::string &section,
+ const std::string &option,
+ const std::string &val);
+ virtual bool get_bool(const std::string &section,
+ const std::string &option,
+ bool default_val);
+ virtual void set_bool(const std::string &section,
+ const std::string &option,
+ bool val);
+ virtual long get_long(const std::string &section,
+ const std::string &option,
+ long default_val);
+ virtual void set_long(const std::string &section,
+ const std::string &option,
+ long val);
+ virtual double get_double(const std::string &section,
+ const std::string &option,
+ double default_val);
+ virtual void set_double(const std::string &section,
+ const std::string &option,
+ double val);
+};
+
diff --git a/gnuradio-runtime/swig/gr_realtime.i b/gnuradio-runtime/swig/gr_realtime.i
new file mode 100644
index 0000000000..1051d3e2b3
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_realtime.i
@@ -0,0 +1,44 @@
+/* -*- 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%rename(enable_realtime_scheduling) gr_enable_realtime_scheduling;
+
+// NOTE: This is duplicated from gruel/src/include/gruel/gr_realtime.h,
+// and must be kept in sync with it. This is the least evil workaround
+// for allowing 3rd party code builds to work when GNU Radio is
+// installed from binary packages into the standard system directories.
+// Otherwise, they can't find #include <gruel/gr_realtime.h>, since
+// pkg-config strips -I/usr/include from the --cflags path.
+
+namespace gruel {
+
+ typedef enum {
+ RT_OK = 0,
+ RT_NOT_IMPLEMENTED,
+ RT_NO_PRIVS,
+ RT_OTHER_ERROR
+ } rt_status_t;
+
+}
+
+typedef gruel::rt_status_t gr_rt_status_t;
+gr_rt_status_t gr_enable_realtime_scheduling();
diff --git a/gnuradio-runtime/swig/gr_shared_ptr.i b/gnuradio-runtime/swig/gr_shared_ptr.i
new file mode 100644
index 0000000000..323d33ad73
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_shared_ptr.i
@@ -0,0 +1,43 @@
+//
+// shared_ptr
+//
+// An enhanced relative of scoped_ptr with reference counted copy semantics.
+// The object pointed to is deleted when the last shared_ptr pointing to it
+// is destroyed or reset.
+//
+
+//
+// This is highly hacked up version of boost::shared_ptr
+// We just need enough to get SWIG to "do the right thing" and
+// generate "Smart Pointer" code.
+//
+
+namespace boost {
+
+template<class T> class shared_ptr
+{
+public:
+
+ shared_ptr()
+ {
+ }
+
+ shared_ptr (T * p)
+ {
+ }
+
+
+ T * operator-> () // never throws
+ {
+ return px;
+ }
+
+
+private:
+
+ T * px; // contained pointer
+ int pn;
+
+}; // shared_ptr
+
+}; \ No newline at end of file
diff --git a/gnuradio-runtime/swig/gr_single_threaded_scheduler.i b/gnuradio-runtime/swig/gr_single_threaded_scheduler.i
new file mode 100644
index 0000000000..7305cc9ada
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_single_threaded_scheduler.i
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+#include <gr_runtime.h>
+
+class gr_single_threaded_scheduler;
+typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_scheduler_sptr;
+%template(gr_single_threaded_scheduler_sptr) boost::shared_ptr<gr_single_threaded_scheduler>;
+%rename(single_threaded_scheduler) gr_make_single_threaded_scheduler;
+%ignore gr_single_threaded_scheduler;
+
+gr_single_threaded_scheduler_sptr
+gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules);
+
+class gr_single_threaded_scheduler {
+ public:
+ ~gr_single_threaded_scheduler ();
+
+ // void run ();
+ void stop ();
+
+ private:
+ gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules);
+};
+
+#ifdef SWIGPYTHON
+%inline %{
+ void sts_pyrun (gr_single_threaded_scheduler_sptr s) {
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ s->run ();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+ }
+%}
+#endif
+
diff --git a/gnuradio-runtime/swig/gr_swig_block_magic.i b/gnuradio-runtime/swig/gr_swig_block_magic.i
new file mode 100644
index 0000000000..6d1af6136d
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_swig_block_magic.i
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 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.
+ */
+
+%define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME)
+%enddef
+
+%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
+%rename(BASE_NAME) PKG ## _make_ ## BASE_NAME;
+%ignore FULL_NAME;
+%enddef
+
+#ifdef SWIGPYTHON
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+%pythoncode %{
+FULL_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
+%}
+%enddef
+#endif
+
+%define GR_SWIG_BLOCK_MAGIC2(PKG, BASE_NAME)
+%template(BASE_NAME ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>;
+%pythoncode %{
+BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id())
+BASE_NAME = BASE_NAME.make;
+%}
+%enddef
+
+%define GR_SWIG_BLOCK_MAGIC_FACTORY(PKG, BASE_NAME, FACTORY)
+%template(FACTORY ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>;
+%pythoncode %{
+FACTORY ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id())
+FACTORY = BASE_NAME ## _make_ ## FACTORY;
+%}
+%enddef
diff --git a/gnuradio-runtime/swig/gr_sync_block.i b/gnuradio-runtime/swig/gr_sync_block.i
new file mode 100644
index 0000000000..d3e1bb9578
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_sync_block.i
@@ -0,0 +1,29 @@
+/* -*- 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.
+ */
+class gr_sync_block : public gr_block
+{
+ protected:
+
+ gr_sync_block (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+};
diff --git a/gnuradio-runtime/swig/gr_sync_decimator.i b/gnuradio-runtime/swig/gr_sync_decimator.i
new file mode 100644
index 0000000000..af4574b193
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_sync_decimator.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+class gr_sync_decimator : public gr_sync_block
+{
+ protected:
+
+ gr_sync_decimator (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ unsigned decimation);
+};
diff --git a/gnuradio-runtime/swig/gr_sync_interpolator.i b/gnuradio-runtime/swig/gr_sync_interpolator.i
new file mode 100644
index 0000000000..6f8b08252f
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_sync_interpolator.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+class gr_sync_interpolator : public gr_sync_block
+{
+ protected:
+
+ gr_sync_interpolator (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ unsigned interpolation);
+};
diff --git a/gnuradio-runtime/swig/gr_tagged_stream_block.i b/gnuradio-runtime/swig/gr_tagged_stream_block.i
new file mode 100644
index 0000000000..9fc803dca1
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_tagged_stream_block.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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.
+ */
+class gr_tagged_stream_block : public gr_block
+{
+ protected:
+ gr_tagged_stream_block (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ const std::string &length_tag_key);
+};
+
diff --git a/gnuradio-runtime/swig/gr_tags.i b/gnuradio-runtime/swig/gr_tags.i
new file mode 100644
index 0000000000..828d0147ce
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_tags.i
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 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 <gr_tags.h>
+%}
+
+%include <pmt_swig.i> //for pmt support
+
+%include <gr_tags.h>
+
+//gives support for a vector of tags (get tags in range)
+%include "std_vector.i"
+%template(tags_vector_t) std::vector<gr_tag_t>;
diff --git a/gnuradio-runtime/swig/gr_top_block.i b/gnuradio-runtime/swig/gr_top_block.i
new file mode 100644
index 0000000000..1612ddf8c5
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_top_block.i
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+class gr_top_block;
+typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr;
+%template(gr_top_block_sptr) boost::shared_ptr<gr_top_block>;
+
+// Hack to have a Python shim implementation of gr.top_block
+// that instantiates one of these and passes through calls
+%rename(top_block_swig) gr_make_top_block;
+gr_top_block_sptr gr_make_top_block(const std::string name)
+ throw (std::logic_error);
+
+class gr_top_block : public gr_hier_block2
+{
+private:
+ gr_top_block(const std::string &name);
+
+public:
+ ~gr_top_block();
+
+ void start(int max_noutput_items=100000000) throw (std::runtime_error);
+ void stop();
+ //void wait();
+ //void run() throw (std::runtime_error);
+ void lock();
+ void unlock() throw (std::runtime_error);
+ std::string edge_list();
+ void dump();
+
+ int max_noutput_items();
+ void set_max_noutput_items(int nmax);
+
+ gr_top_block_sptr to_top_block(); // Needed for Python type coercion
+};
+
+#ifdef SWIGPYTHON
+
+%inline %{
+void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+{
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ r->run();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+}
+
+void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+{
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ r->wait();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+}
+%}
+
+#endif
diff --git a/gnuradio-runtime/swig/runtime_block_gateway.i b/gnuradio-runtime/swig/runtime_block_gateway.i
new file mode 100644
index 0000000000..94428c0d5e
--- /dev/null
+++ b/gnuradio-runtime/swig/runtime_block_gateway.i
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011-2012 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.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// standard includes
+////////////////////////////////////////////////////////////////////////
+%include <gnuradio.i>
+%include <gr_tags.i>
+%include <gr_feval.i>
+
+////////////////////////////////////////////////////////////////////////
+// data type support
+////////////////////////////////////////////////////////////////////////
+%template(int_vector_t) std::vector<int>;
+%template(void_star_vector_t) std::vector<void *>;
+
+////////////////////////////////////////////////////////////////////////
+// block headers
+////////////////////////////////////////////////////////////////////////
+%{
+#include <runtime_block_gateway.h>
+%}
+
+////////////////////////////////////////////////////////////////////////
+// block magic
+////////////////////////////////////////////////////////////////////////
+GR_SWIG_BLOCK_MAGIC(runtime, block_gateway);
+%include <runtime_block_gateway.h>
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
new file mode 100644
index 0000000000..5b84a71c9f
--- /dev/null
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -0,0 +1,170 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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.
+ */
+
+#define GR_RUNTIME_API
+
+#ifndef SWIGIMPORTED
+%include "runtime_swig_doc.i"
+%module(directors="1") gnuradio_runtime
+#endif
+
+//%feature("autodoc", "1"); // generate python docstrings
+
+#define SW_RUNTIME
+%include "gnuradio.i" // the common stuff
+
+%{
+#include <gr_endianness.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_buffer.h>
+#include <gr_constants.h>
+#include <gr_dispatcher.h>
+#include <gr_error_handler.h>
+#include <gr_feval.h>
+#include <gr_hier_block2.h>
+#include <gr_io_signature.h>
+#include <gr_message.h>
+#include <gr_msg_handler.h>
+#include <gr_msg_queue.h>
+#include <gr_prefs.h>
+#include <gr_realtime.h>
+#include <gr_runtime_types.h>
+#include <gr_single_threaded_scheduler.h>
+#include <gr_sync_block.h>
+#include <gr_sync_decimator.h>
+#include <gr_sync_interpolator.h>
+#include <gr_tagged_stream_block.h>
+#include <gr_tags.h>
+#include <gr_top_block.h>
+%}
+
+%constant int sizeof_char = sizeof(char);
+%constant int sizeof_short = sizeof(short);
+%constant int sizeof_int = sizeof(int);
+%constant int sizeof_float = sizeof(float);
+%constant int sizeof_double = sizeof(double);
+%constant int sizeof_gr_complex = sizeof(gr_complex);
+
+%include <gr_endianness.h>
+%include <gr_basic_block.i>
+%include <gr_block.i>
+%include <gr_block_detail.i>
+%include <gr_buffer.i>
+%include <gr_constants.i>
+%include <gr_dispatcher.i>
+%include <gr_error_handler.i>
+%include <gr_feval.i>
+%include <gr_hier_block2.i>
+%include <gr_io_signature.i>
+%include <gr_message.i>
+%include <gr_msg_handler.i>
+%include <gr_msg_queue.i>
+%include <gr_prefs.i>
+%include <gr_realtime.i>
+%include <gr_single_threaded_scheduler.i>
+%include <gr_swig_block_magic.i>
+%include <gr_sync_block.i>
+%include <gr_sync_decimator.i>
+%include <gr_sync_interpolator.i>
+%include <gr_tagged_stream_block.i>
+%include <gr_tags.i>
+%include <gr_top_block.i>
+%include <runtime_block_gateway.i>
+
+#ifdef GR_CTRLPORT
+
+typedef uint32_t DisplayType;
+
+// DisplayType Plotting types
+const uint32_t DISPNULL = 0x0000;
+const uint32_t DISPTIME = 0x0001;
+const uint32_t DISPXY = 0x0002;
+const uint32_t DISPPSD = 0x0004;
+const uint32_t DISPSPEC = 0x0008;
+const uint32_t DISPRAST = 0x0010;
+
+// DisplayType Options
+const uint32_t DISPOPTCPLX = 0x0100;
+const uint32_t DISPOPTLOG = 0x0200;
+const uint32_t DISPOPTSTEM = 0x0400;
+const uint32_t DISPOPTSTRIP = 0x0800;
+const uint32_t DISPOPTSCATTER = 0x1000;
+
+enum priv_lvl_t {
+ RPC_PRIVLVL_ALL = 0,
+ RPC_PRIVLVL_MIN = 9,
+ RPC_PRIVLVL_NONE = 10
+};
+
+enum KnobType {
+ KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT,
+ KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL,
+ KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE,
+ KNOBVECSTRING, KNOBVECLONG
+};
+
+%template(StrVector) std::vector<std::string>;
+
+%{
+#include <rpcserver_booter_base.h>
+#include <rpcserver_booter_aggregator.h>
+#include <pycallback_object.h>
+%}
+
+%include <rpcserver_booter_base.h>
+%include <rpcserver_booter_aggregator.h>
+%include <pycallback_object.h>
+
+// Declare this class here but without the nested templated class
+// inside (replaces include of rpcmanager.h)
+class GR_RUNTIME_API rpcmanager : public virtual rpcmanager_base
+{
+ public:
+ rpcmanager();
+ ~rpcmanager();
+
+ static rpcserver_booter_base* get();
+
+ static void register_booter(rpcserver_booter_base* booter);
+};
+
+
+// Attach a new python callback method to Python function
+%extend pycallback_object {
+ // Set a Python function object as a callback function
+ // Note : PyObject *pyfunc is remapped with a typempap
+ void activate(PyObject *pyfunc)
+ {
+ self->set_callback(pyfunc);
+ Py_INCREF(pyfunc);
+ }
+}
+
+%template(RPC_get_string) pycallback_object<std::string>;
+%template(RPC_get_int) pycallback_object<int>;
+%template(RPC_get_float) pycallback_object<float>;
+%template(RPC_get_double) pycallback_object<double>;
+%template(RPC_get_vector_float) pycallback_object<std::vector<float> >;
+%template(RPC_get_vector_gr_complex) pycallback_object<std::vector<gr_complex> >;
+
+#endif /* GR_CTRLPORT */