diff options
author | jblum | 2009-03-14 05:54:43 +0000 |
---|---|---|
committer | jblum | 2009-03-14 05:54:43 +0000 |
commit | 7d0955ef7bc7a41855ca3301976c6616981fa27e (patch) | |
tree | 293c45ab5b844fad230cc7a4f48d4e454854245c /gnuradio-core/src/lib/gengen | |
parent | cdc6f1d7b55c69c28c6fb4fe99faf4397bd39ba0 (diff) | |
download | gnuradio-7d0955ef7bc7a41855ca3301976c6616981fa27e.tar.gz gnuradio-7d0955ef7bc7a41855ca3301976c6616981fa27e.tar.bz2 gnuradio-7d0955ef7bc7a41855ca3301976c6616981fa27e.zip |
Add vlen to subtract, divide, and float2complex.
Takes care of #302 and #303
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10598 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/lib/gengen')
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t | 17 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_divide_XX.h.t | 10 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_divide_XX.i.t | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t | 16 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_sub_XX.h.t | 10 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_sub_XX.i.t | 6 |
6 files changed, 35 insertions, 30 deletions
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t index fbffc2d59..9fc6d34e9 100644 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t @@ -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@ -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]; diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t index 0a1d4d8ac..1489986b9 100644 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t @@ -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: diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t index a4bc4ce67..f07481a8b 100644 --- a/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t +++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t @@ -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@) -@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); }; diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t index 178e17145..93895fed6 100644 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t @@ -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@ -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]; diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t index 8839a158a..d251e6768 100644 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t @@ -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: diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t index a4bc4ce67..f07481a8b 100644 --- a/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t +++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t @@ -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@) -@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); }; |