summaryrefslogtreecommitdiff
path: root/gnuradio-runtime
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-30 11:09:43 -0400
committerJohnathan Corgan <johnathan@corganlabs.com>2013-04-01 16:24:17 -0700
commit4cbe59fb5a8d33882beb1ad09e5ba9f7153bf7d6 (patch)
treee932d03d135e78f6ec209633f4cc3a28ec2625a1 /gnuradio-runtime
parentec11facb8b34bfc32986a334ee725f8286678e1b (diff)
runtime: creating swig files for typedefs/templates of vector types.
Also created simple ctrlport swig file to clean things up. Consolidated all standard vector types into gr_types.i.
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r--gnuradio-runtime/swig/gnuradio.i35
-rw-r--r--gnuradio-runtime/swig/gr_ctrlport.i97
-rw-r--r--gnuradio-runtime/swig/gr_types.i90
-rw-r--r--gnuradio-runtime/swig/pmt_swig.i23
-rw-r--r--gnuradio-runtime/swig/runtime_block_gateway.i7
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i78
6 files changed, 194 insertions, 136 deletions
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
index 52f9f12ef..4cf42cbf7 100644
--- a/gnuradio-runtime/swig/gnuradio.i
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -29,54 +29,21 @@
////////////////////////////////////////////////////////////////////////
%include <gr_extras.i>
+%include <gr_types.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
diff --git a/gnuradio-runtime/swig/gr_ctrlport.i b/gnuradio-runtime/swig/gr_ctrlport.i
new file mode 100644
index 000000000..fa3ae845d
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_ctrlport.i
@@ -0,0 +1,97 @@
+/* -*- 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.
+ */
+
+#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
+};
+
+%{
+#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 */
diff --git a/gnuradio-runtime/swig/gr_types.i b/gnuradio-runtime/swig/gr_types.i
new file mode 100644
index 000000000..e81d43f40
--- /dev/null
+++ b/gnuradio-runtime/swig/gr_types.i
@@ -0,0 +1,90 @@
+/* -*- 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.
+ */
+
+%include "std_string.i"
+%include "stdint.i"
+
+%{
+#include <boost/shared_ptr.hpp>
+#include <boost/any.hpp>
+#include <complex>
+#include <string>
+#include <stddef.h> // size_t
+#include <stdint.h>
+#include <gr_types.h>
+%}
+
+%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+
+namespace std {
+ %template() vector<unsigned char>;
+ %template() vector<signed char>;
+ %template() vector<char>;
+
+ %template() vector<unsigned short>;
+ %template() vector<short>;
+
+ %template() vector<int>;
+ %template() vector<unsigned int>;
+
+ %template() vector<long int>;
+ %template() vector<long unsigned int>;
+
+ %template() vector<float>;
+ %template() vector<double>;
+ %template() vector< complex<float> >;
+ %template() vector< complex<double> >;
+
+ %template() vector<gr_complex>;
+ %template() vector<gr_complexd>;
+
+ %template() vector< vector< unsigned char > >;
+ %template() vector< vector< char > >;
+ %template() vector< vector< short > >;
+ %template() vector< vector< int > >;
+ %template() vector< vector< long int> >;
+ %template() vector< vector< float > >;
+ %template() vector< vector< double > >;
+ %template() vector< vector< complex<float> > >;
+ %template() vector< vector< gr_complex> >;
+ %template() vector< vector< gr_complexd> >;
+
+ %template() vector<string>;
+};
+
+// Fix for Issue #529
+#ifdef SIZE_T_32
+ // On 32-bit systems, whenever we see std::vector<size_t>, replace it
+ // with vector<unsigned int>
+ %apply std::vector<unsigned int> { std::vector<size_t> };
+#else
+ // On 64-bit systems, whenever we see std::vector<size_t>, replace it
+ // with vector<long unsigned int>
+ %apply std::vector<long unsigned int> { std::vector<size_t> };
+#endif
diff --git a/gnuradio-runtime/swig/pmt_swig.i b/gnuradio-runtime/swig/pmt_swig.i
index b86b88c4d..24be053af 100644
--- a/gnuradio-runtime/swig/pmt_swig.i
+++ b/gnuradio-runtime/swig/pmt_swig.i
@@ -44,26 +44,9 @@
%include "pmt_swig_doc.i"
%include <gr_extras.i>
-%include <std_complex.i>
-%include <std_vector.i>
-%include <stl.i>
-
-namespace std {
- %template() vector<unsigned char>;
- %template() vector<uint8_t>;
- %template() vector<char>;
- %template() vector<int8_t>;
- %template() vector<short>;
- %template() vector<uint16_t>;
- %template() vector<int16_t>;
- %template() vector<int>;
- %template() vector<int32_t>;
- %template() vector<uint32_t>;
- %template() vector<float>;
- %template() vector<double>;
- %template() vector< std::complex<float> >;
- %template() vector< std::complex<double> >;
-};
+%include <gr_types.i>
+
+%template() std::vector<uint32_t>;
////////////////////////////////////////////////////////////////////////
// Language independent exception handler
diff --git a/gnuradio-runtime/swig/runtime_block_gateway.i b/gnuradio-runtime/swig/runtime_block_gateway.i
index 94428c0d5..52d4194de 100644
--- a/gnuradio-runtime/swig/runtime_block_gateway.i
+++ b/gnuradio-runtime/swig/runtime_block_gateway.i
@@ -1,3 +1,4 @@
+/* -*- c++ -*- */
/*
* Copyright 2011-2012 Free Software Foundation, Inc.
*
@@ -26,11 +27,7 @@
%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 *>;
+%template(void_start_vector_t) std::vector<void *>;
////////////////////////////////////////////////////////////////////////
// block headers
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
index 5b84a71c9..99528c153 100644
--- a/gnuradio-runtime/swig/runtime_swig.i
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -91,80 +91,4 @@
%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 */
+%include <gr_ctrlport.i>