commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10598 - in gnuradio/trunk: gnuradio-core/src/lib/gene


From: jblum
Subject: [Commit-gnuradio] r10598 - in gnuradio/trunk: gnuradio-core/src/lib/general gnuradio-core/src/lib/gengen grc/data/platforms/python/blocks
Date: Fri, 13 Mar 2009 23:54:44 -0600 (MDT)

Author: jblum
Date: 2009-03-13 23:54:43 -0600 (Fri, 13 Mar 2009)
New Revision: 10598

Modified:
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.cc
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.h
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.i
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t
   gnuradio/trunk/grc/data/platforms/python/blocks/gr_divide_xx.xml
   gnuradio/trunk/grc/data/platforms/python/blocks/gr_float_to_complex.xml
   gnuradio/trunk/grc/data/platforms/python/blocks/gr_sub_xx.xml
Log:
Add vlen to subtract, divide, and float2complex.
Takes care of #302 and #303



Modified: gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.cc 
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.cc 
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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
  * 
@@ -28,15 +28,16 @@
 #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 @@
 
   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;
 

Modified: gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.h  
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.h  
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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 @@
 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,9 +39,11 @@
 
 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,
                    gr_vector_const_void_star &input_items,

Modified: gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.i
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.i  
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_float_to_complex.i  
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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);
 };

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t       
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t       
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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,15 +30,16 @@
 #include <gr_io_signature.h>
 
 @SPTR_NAME@
address@hidden@ ()
address@hidden@ (int vlen)
 {
-  return @SPTR_NAME@ (new @NAME@ ());
+  return @SPTR_NAME@ (new @NAME@ (vlen));
 }
 
address@hidden@::@NAME@ ()
address@hidden@::@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 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];

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t        
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t        
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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@;
 
address@hidden@ address@hidden@ ();
address@hidden@ address@hidden@ (int vlen = 1);
 
 /*!
  * \brief output = input_0 / input_1 / input_x ...)
@@ -40,10 +40,12 @@
  */
 class @NAME@ : public gr_sync_block
 {
-  friend @SPTR_NAME@ address@hidden@ ();
+  friend @SPTR_NAME@ address@hidden@ (int vlen);
 
-  @NAME@ ();
+  @NAME@ (int vlen);
 
+  int d_vlen;
+
  public:
 
   int work (int noutput_items,

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t        
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t        
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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
  * 
@@ -24,10 +24,10 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
 
address@hidden@ address@hidden@ ();
address@hidden@ address@hidden@ (int vlen = 1);
 
 class @NAME@ : public gr_sync_block
 {
  private:
-  @NAME@ ();
+  @NAME@ (int vlen);
 };

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t  2009-03-14 
02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t  2009-03-14 
05:54:43 UTC (rev 10598)
@@ -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,15 +30,15 @@
 #include <gr_io_signature.h>
 
 @SPTR_NAME@
address@hidden@ ()
address@hidden@ (int vlen)
 {
-  return @SPTR_NAME@ (new @NAME@ ());
+  return @SPTR_NAME@ (new @NAME@ (vlen));
 }
 
address@hidden@::@NAME@ ()
address@hidden@::@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 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];

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t   2009-03-14 
02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t   2009-03-14 
05:54:43 UTC (rev 10598)
@@ -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@;
 
address@hidden@ address@hidden@ ();
address@hidden@ address@hidden@ (int vlen = 1);
 
 /*!
  * \brief output = input_0 -  input_1 - ...)
@@ -40,10 +40,12 @@
  */
 class @NAME@ : public gr_sync_block
 {
-  friend @SPTR_NAME@ address@hidden@ ();
+  friend @SPTR_NAME@ address@hidden@ (int vlen);
 
-  @NAME@ ();
+  @NAME@ (int vlen);
 
+  int d_vlen;
+
  public:
 
   int work (int noutput_items,

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t   2009-03-14 
02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t   2009-03-14 
05:54:43 UTC (rev 10598)
@@ -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
  * 
@@ -24,10 +24,10 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
 
address@hidden@ address@hidden@ ();
address@hidden@ address@hidden@ (int vlen = 1);
 
 class @NAME@ : public gr_sync_block
 {
  private:
-  @NAME@ ();
+  @NAME@ (int vlen);
 };

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/gr_divide_xx.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/gr_divide_xx.xml    
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/gr_divide_xx.xml    
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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>
@@ -36,19 +36,28 @@
                </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>

Modified: 
gnuradio/trunk/grc/data/platforms/python/blocks/gr_float_to_complex.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/gr_float_to_complex.xml     
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/gr_float_to_complex.xml     
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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>

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/gr_sub_xx.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/gr_sub_xx.xml       
2009-03-14 02:34:00 UTC (rev 10597)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/gr_sub_xx.xml       
2009-03-14 05:54:43 UTC (rev 10598)
@@ -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>
@@ -36,19 +36,28 @@
                </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>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]