summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t15
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t9
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t6
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t22
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t9
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t7
6 files changed, 38 insertions, 30 deletions
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
index 303ac4cdd..b2a6c4ac4 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,10 +30,11 @@
#include <gr_io_signature.h>
-@NAME@::@NAME@ ()
+@NAME@::@NAME@ (int vlen)
: gr_sync_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@TYPE@)),
- gr_make_io_signature (0, 0, 0))
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen),
+ gr_make_io_signature (0, 0, 0)),
+ d_vlen(vlen)
{
}
@@ -43,7 +44,7 @@ int
gr_vector_void_star &output_items)
{
@TYPE@ *iptr = (@TYPE@ *) input_items[0];
- for (int i = 0; i < noutput_items; i++)
+ for (int i = 0; i < noutput_items * d_vlen; i++)
d_data.push_back (iptr[i]);
return noutput_items;
@@ -51,9 +52,9 @@ int
@NAME@_sptr
-gr_make_@BASE_NAME@ ()
+gr_make_@BASE_NAME@ (int vlen)
{
- return @NAME@_sptr (new @NAME@ ());
+ return @NAME@_sptr (new @NAME@ (vlen));
}
std::vector<@TYPE@>
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
index ec0ebb8bb..70711d63c 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,7 +31,7 @@ class @NAME@;
typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
@NAME@_sptr
-gr_make_@BASE_NAME@ ();
+gr_make_@BASE_NAME@ (int vlen = 1);
/*!
@@ -40,9 +40,10 @@ gr_make_@BASE_NAME@ ();
*/
class @NAME@ : public gr_sync_block {
- friend @NAME@_sptr gr_make_@BASE_NAME@ ();
+ friend @NAME@_sptr gr_make_@BASE_NAME@ (int vlen);
std::vector<@TYPE@> d_data;
- @NAME@ ();
+ int d_vlen;
+ @NAME@ (int vlen);
public:
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
index 563171123..22d6faa1a 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,11 +25,11 @@
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);
public:
void clear() {d_data.clear();}
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
index 528a7c40d..889a6f22c 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,16 +28,20 @@
#include <@NAME@.h>
#include <algorithm>
#include <gr_io_signature.h>
+#include <stdexcept>
-@NAME@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat)
+@NAME@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
: gr_sync_block ("@BASE_NAME@",
gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (1, 1, sizeof (@TYPE@))),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen)),
d_data (data),
d_repeat (repeat),
- d_offset (0)
+ d_offset (0),
+ d_vlen (vlen)
{
+ if ((data.size() % vlen) != 0)
+ throw std::invalid_argument("data length must be a multiple of vlen");
}
int
@@ -54,7 +58,7 @@ int
if (size == 0)
return -1;
- for (int i = 0; i < noutput_items; i++){
+ for (int i = 0; i < noutput_items*d_vlen; i++){
optr[i] = d_data[offset++];
if (offset >= size)
offset = 0;
@@ -68,18 +72,18 @@ int
return -1; // Done!
unsigned n = std::min ((unsigned) d_data.size () - d_offset,
- (unsigned) noutput_items);
+ (unsigned) noutput_items*d_vlen);
for (unsigned i = 0; i < n; i++)
optr[i] = d_data[d_offset + i];
d_offset += n;
- return n;
+ return n/d_vlen;
}
}
@NAME@_sptr
-gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat)
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
{
- return @NAME@_sptr (new @NAME@ (data, repeat));
+ return @NAME@_sptr (new @NAME@ (data, repeat, vlen));
}
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
index 0b8d92a9c..88d34f362 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -37,13 +37,14 @@ typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
class @NAME@ : public gr_sync_block {
friend @NAME@_sptr
- gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false);
+ gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
std::vector<@TYPE@> d_data;
bool d_repeat;
unsigned int d_offset;
+ int d_vlen;
- @NAME@ (const std::vector<@TYPE@> &data, bool repeat);
+ @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
public:
void rewind() {d_offset=0;}
@@ -53,6 +54,6 @@ class @NAME@ : public gr_sync_block {
};
@NAME@_sptr
-gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat);
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1);
#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
index 1e94ce401..a22157893 100644
--- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,11 +25,12 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
@NAME@_sptr
-gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false);
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1)
+ throw(std::invalid_argument);
class @NAME@ : public gr_sync_block {
public:
void rewind() {d_offset=0;}
private:
- @NAME@ (const std::vector<@TYPE@> &data);
+ @NAME@ (const std::vector<@TYPE@> &data, int vlen);
};