]> git.gag.com Git - debian/gnuradio/commitdiff
Add vlen to subtract, divide, and float2complex.
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Sat, 14 Mar 2009 05:54:43 +0000 (05:54 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Sat, 14 Mar 2009 05:54:43 +0000 (05:54 +0000)
Takes care of #302 and #303

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10598 221aa14e-8319-0410-a670-987f0aec2ac5

12 files changed:
gnuradio-core/src/lib/general/gr_float_to_complex.cc
gnuradio-core/src/lib/general/gr_float_to_complex.h
gnuradio-core/src/lib/general/gr_float_to_complex.i
gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
gnuradio-core/src/lib/gengen/gr_divide_XX.h.t
gnuradio-core/src/lib/gengen/gr_divide_XX.i.t
gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
gnuradio-core/src/lib/gengen/gr_sub_XX.h.t
gnuradio-core/src/lib/gengen/gr_sub_XX.i.t
grc/data/platforms/python/blocks/gr_divide_xx.xml
grc/data/platforms/python/blocks/gr_float_to_complex.xml
grc/data/platforms/python/blocks/gr_sub_xx.xml

index 0c5c22d02c5c83fd671ee59c279685de5300422b..077a498ae8473974d6dd115777b682e1d61add2d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #include <gr_io_signature.h>
 
 gr_float_to_complex_sptr
-gr_make_float_to_complex ()
+gr_make_float_to_complex (int vlen)
 {
-  return gr_float_to_complex_sptr (new gr_float_to_complex ());
+  return gr_float_to_complex_sptr (new gr_float_to_complex (vlen));
 }
 
-gr_float_to_complex::gr_float_to_complex ()
+gr_float_to_complex::gr_float_to_complex (int vlen)
   : gr_sync_block ("gr_float_to_complex",
-                  gr_make_io_signature (1, 2, sizeof (float)),
-                  gr_make_io_signature (1, 1, sizeof (gr_complex)))
+                  gr_make_io_signature (1, 2, sizeof (float) *  vlen),
+                  gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)),
+  d_vlen (vlen)
 {
 }
 
@@ -51,12 +52,12 @@ gr_float_to_complex::work (int noutput_items,
 
   switch (input_items.size ()){
   case 1:
-    for (int j = 0; j < noutput_items; j++)
+    for (int j = 0; j < noutput_items*d_vlen; j++)
       out[j] = gr_complex (r[j], 0);
     break;
 
   case 2:
-    for (int j = 0; j < noutput_items; j++)
+    for (int j = 0; j < noutput_items*d_vlen; j++)
       out[j] = gr_complex (r[j], i[j]);
     break;
 
index 67dfa6b15d62fd543b1ac5173f9a9c13b58397f9..4a394092902c0036ca8094b345534555414ad301 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -30,7 +30,7 @@ class gr_float_to_complex;
 typedef boost::shared_ptr<gr_float_to_complex> gr_float_to_complex_sptr;
 
 gr_float_to_complex_sptr
-gr_make_float_to_complex ();
+gr_make_float_to_complex (int vlen = 1);
 
 /*!
  * \brief Convert 1 or 2 streams of float to a stream of gr_complex
@@ -39,8 +39,10 @@ gr_make_float_to_complex ();
 
 class gr_float_to_complex : public gr_sync_block
 {
-  friend gr_float_to_complex_sptr gr_make_float_to_complex ();
-  gr_float_to_complex ();
+  friend gr_float_to_complex_sptr gr_make_float_to_complex (int vlen);
+  gr_float_to_complex (int vlen);
+
+  int d_vlen;
 
  public:
   virtual int work (int noutput_items,
index 0dd0635bc959205fd633af1abf18f2ed1dd4b158..71e59a8c82a5c769abb86175178e5d29c7917df2 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -22,9 +22,9 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,float_to_complex)
 
-gr_float_to_complex_sptr gr_make_float_to_complex ();
+gr_float_to_complex_sptr gr_make_float_to_complex (int vlen = 1);
 
 class gr_float_to_complex : public gr_sync_block
 {
-  gr_float_to_complex ();
+  gr_float_to_complex (int vlen);
 };
index fbffc2d5984704ced4756053568214b957261d5c..9fc6d34e919b4f91ea7f2c84444a547de0867baa 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #include <gr_io_signature.h>
 
 @SPTR_NAME@
-gr_make_@BASE_NAME@ ()
+gr_make_@BASE_NAME@ (int vlen)
 {
-  return @SPTR_NAME@ (new @NAME@ ());
+  return @SPTR_NAME@ (new @NAME@ (vlen));
 }
 
-@NAME@::@NAME@ ()
+@NAME@::@NAME@ (int vlen)
   : gr_sync_block ("@BASE_NAME@",
-                  gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
-                  gr_make_io_signature (1,  1, sizeof (@O_TYPE@)))
+                  gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+                  gr_make_io_signature (1,  1, sizeof (@O_TYPE@)*vlen)),
+  d_vlen (vlen)
 {
 }
 
@@ -52,13 +53,13 @@ int
   int ninputs = input_items.size ();
 
   if (ninputs == 1){           // compute reciprocal
-    for (int i = 0; i < noutput_items; i++)
+    for (int i = 0; i < noutput_items*d_vlen; i++)
       *optr++ = (@O_TYPE@) ((@O_TYPE@) 1 /
                            ((@I_TYPE@ *) input_items[0])[i]);
   }
 
   else {
-    for (int i = 0; i < noutput_items; i++){
+    for (int i = 0; i < noutput_items*d_vlen; i++){
       @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
       for (int j = 1; j < ninputs; j++)
        acc /= ((@I_TYPE@ *) input_items[j])[i];
index 0a1d4d8acf076ebcc013e212453b6916b79b1a46..1489986b9fe7b2fa1e2b41f6340c3322662d88bb 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -30,7 +30,7 @@
 class @NAME@;
 typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
 
-@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1);
 
 /*!
  * \brief output = input_0 / input_1 / input_x ...)
@@ -40,9 +40,11 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
  */
 class @NAME@ : public gr_sync_block
 {
-  friend @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+  friend @SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen);
 
-  @NAME@ ();
+  @NAME@ (int vlen);
+
+  int d_vlen;
 
  public:
 
index a4bc4ce67b99fd355a4c616b2a29039ad063ed9f..f07481a8bbd005b41e0bc85b1bd95e86e9030fbf 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 
 GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
 
-@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1);
 
 class @NAME@ : public gr_sync_block
 {
  private:
-  @NAME@ ();
+  @NAME@ (int vlen);
 };
index 178e17145cefc132b3851441f73909d31dd0798d..93895fed65175c6a3a2c9fd703fca48e4f694717 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #include <gr_io_signature.h>
 
 @SPTR_NAME@
-gr_make_@BASE_NAME@ ()
+gr_make_@BASE_NAME@ (int vlen)
 {
-  return @SPTR_NAME@ (new @NAME@ ());
+  return @SPTR_NAME@ (new @NAME@ (vlen));
 }
 
-@NAME@::@NAME@ ()
+@NAME@::@NAME@ (int vlen)
   : gr_sync_block ("@BASE_NAME@",
-                  gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
-                  gr_make_io_signature (1,  1, sizeof (@O_TYPE@)))
+                  gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+                  gr_make_io_signature (1,  1, sizeof (@O_TYPE@)*vlen))
 {
 }
 
@@ -52,12 +52,12 @@ int
   int ninputs = input_items.size ();
 
   if (ninputs == 1){           // negate
-    for (int i = 0; i < noutput_items; i++)
+    for (int i = 0; i < noutput_items*d_vlen; i++)
       *optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i];
   }
 
   else {
-    for (int i = 0; i < noutput_items; i++){
+    for (int i = 0; i < noutput_items*d_vlen; i++){
       @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
       for (int j = 1; j < ninputs; j++)
        acc -= ((@I_TYPE@ *) input_items[j])[i];
index 8839a158aeb0e878f758c3bf5a6486b47e7919e9..d251e676879faecbb50e87f02d1480a51dba5331 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -30,7 +30,7 @@
 class @NAME@;
 typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
 
-@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1);
 
 /*!
  * \brief output = input_0 -  input_1 - ...)
@@ -40,9 +40,11 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
  */
 class @NAME@ : public gr_sync_block
 {
-  friend @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+  friend @SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen);
 
-  @NAME@ ();
+  @NAME@ (int vlen);
+
+  int d_vlen;
 
  public:
 
index a4bc4ce67b99fd355a4c616b2a29039ad063ed9f..f07481a8bbd005b41e0bc85b1bd95e86e9030fbf 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 
 GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
 
-@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1);
 
 class @NAME@ : public gr_sync_block
 {
  private:
-  @NAME@ ();
+  @NAME@ (int vlen);
 };
index 7f8752919eebcad9e8ad3451fa7dbb740125a00d..04667bc2ac4d3a90718386fa92ea4960eb50ebf9 100644 (file)
@@ -9,7 +9,7 @@
        <name>Divide</name>
        <key>gr_divide_xx</key>
        <import>from gnuradio import gr</import>
-       <make>gr.divide_$(type.fcn)()</make>
+       <make>gr.divide_$(type.fcn)($vlen)</make>
        <param>
                <name>IO Type</name>
                <key>type</key>
                        <opt>fcn:ss</opt>
                </option>
        </param>
+       <param>
+               <name>Vec Length</name>
+               <key>vlen</key>
+               <value>1</value>
+               <type>int</type>
+       </param>
        <param>
                <name>Num Inputs</name>
                <key>num_inputs</key>
                <value>2</value>
                <type>int</type>
        </param>
+       <check>$vlen &gt; 0</check>
        <check>$num_inputs &gt;= 2</check>
        <sink>
                <name>in</name>
                <type>$type</type>
+               <vlen>$vlen</vlen>
                <nports>$num_inputs</nports>
        </sink>
        <source>
                <name>out</name>
                <type>$type</type>
+               <vlen>$vlen</vlen>
        </source>
 </block>
index e8734fc6a4d97f4157122972b04236a36738282b..a1644efd74c1c6d1cf722205b7475552e2b27525 100644 (file)
@@ -9,18 +9,28 @@
        <name>Float To Complex</name>
        <key>gr_float_to_complex</key>
        <import>from gnuradio import gr</import>
-       <make>gr.float_to_complex()</make>
+       <make>gr.float_to_complex($vlen)</make>
+       <param>
+               <name>Vec Length</name>
+               <key>vlen</key>
+               <value>1</value>
+               <type>int</type>
+       </param>
+       <check>$vlen &gt; 0</check>
        <sink>
                <name>in</name>
                <type>float</type>
+               <vlen>$vlen</vlen>
        </sink>
        <sink>
                <name>in</name>
                <type>float</type>
+               <vlen>$vlen</vlen>
                <optional>1</optional>
        </sink>
        <source>
                <name>out</name>
                <type>complex</type>
+               <vlen>$vlen</vlen>
        </source>
 </block>
index 488e6c3648bb719bcc1ace79e7485f390039e27f..f1f4797e07d086aad7e6092aebb2e35b063437ca 100644 (file)
@@ -9,7 +9,7 @@
        <name>Subtract</name>
        <key>gr_sub_xx</key>
        <import>from gnuradio import gr</import>
-       <make>gr.sub_$(type.fcn)()</make>
+       <make>gr.sub_$(type.fcn)($vlen)</make>
        <param>
                <name>IO Type</name>
                <key>type</key>
                        <opt>fcn:ss</opt>
                </option>
        </param>
+       <param>
+               <name>Vec Length</name>
+               <key>vlen</key>
+               <value>1</value>
+               <type>int</type>
+       </param>
        <param>
                <name>Num Inputs</name>
                <key>num_inputs</key>
                <value>2</value>
                <type>int</type>
        </param>
+       <check>$vlen &gt; 0</check>
        <check>$num_inputs &gt;= 2</check>
        <sink>
                <name>in</name>
                <type>$type</type>
+               <vlen>$vlen</vlen>
                <nports>$num_inputs</nports>
        </sink>
        <source>
                <name>out</name>
                <type>$type</type>
+               <vlen>$vlen</vlen>
        </source>
 </block>