summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/general
diff options
context:
space:
mode:
authorjblum2009-03-14 05:54:43 +0000
committerjblum2009-03-14 05:54:43 +0000
commit7d0955ef7bc7a41855ca3301976c6616981fa27e (patch)
tree293c45ab5b844fad230cc7a4f48d4e454854245c /gnuradio-core/src/lib/general
parentcdc6f1d7b55c69c28c6fb4fe99faf4397bd39ba0 (diff)
downloadgnuradio-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/general')
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.cc17
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.i6
3 files changed, 18 insertions, 15 deletions
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
index 0c5c22d02..077a498ae 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
@@ -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 @@ 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;
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.h b/gnuradio-core/src/lib/general/gr_float_to_complex.h
index 67dfa6b15..4a3940929 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.h
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.h
@@ -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,
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.i b/gnuradio-core/src/lib/general/gr_float_to_complex.i
index 0dd0635bc..71e59a8c8 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.i
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.i
@@ -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);
};