summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2012-08-20 01:18:45 -0700
committerJosh Blum2012-08-26 16:03:51 -0700
commit393b21d91d8d5a7c80ea9be6a42909e4dffe385c (patch)
treeca965ad20763b06cac3eec15639f4cfff3b51ee7
parentfa25d15ed1a7b85869229055ef32166ef1d8bef2 (diff)
downloadsandhi-393b21d91d8d5a7c80ea9be6a42909e4dffe385c.tar.gz
sandhi-393b21d91d8d5a7c80ea9be6a42909e4dffe385c.tar.bz2
sandhi-393b21d91d8d5a7c80ea9be6a42909e4dffe385c.zip
runtime: lots of swig work, not over yet
-rw-r--r--include/gnuradio/block.hpp4
-rw-r--r--include/gnuradio/gr_block.h17
-rw-r--r--include/gnuradio/gr_hier_block2.h2
-rw-r--r--include/gnuradio/gr_sync_block.h7
-rw-r--r--lib/block.cpp2
-rw-r--r--lib/gr_block.cpp12
-rw-r--r--lib/gr_sync_block.cpp10
-rw-r--r--swig/gr_tags.i32
-rw-r--r--swig/runtime.i68
9 files changed, 132 insertions, 22 deletions
diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp
index 42f5f8d..28cb4f7 100644
--- a/include/gnuradio/block.hpp
+++ b/include/gnuradio/block.hpp
@@ -158,7 +158,7 @@ struct GR_RUNTIME_API Block : Element
typedef std::vector<Buffer<void *> > OutputItems;
//! The official call into the work routine (overload please)
- virtual int work(
+ virtual int Work(
const InputItems &input_items,
const OutputItems &output_items
) = 0;
@@ -166,7 +166,7 @@ struct GR_RUNTIME_API Block : Element
//! forcast requirements, can be overloaded
virtual void forecast(
int noutput_items,
- std::vector<size_t> &ninput_items_required
+ std::vector<int> &ninput_items_required
);
};
diff --git a/include/gnuradio/gr_block.h b/include/gnuradio/gr_block.h
index 92f613a..bed1ef2 100644
--- a/include/gnuradio/gr_block.h
+++ b/include/gnuradio/gr_block.h
@@ -38,7 +38,7 @@ struct GR_RUNTIME_API gr_block : gnuradio::Block
template <typename T> void set_msg_handler(T msg_handler){/*LOL*/}
//! implements work -> calls general work
- int work(
+ int Work(
const InputItems &input_items,
const OutputItems &output_items
);
@@ -63,6 +63,21 @@ struct GR_RUNTIME_API gr_block : gnuradio::Block
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
) = 0;
+
+ unsigned history(void) const
+ {
+ return gnuradio::Block::history();
+ }
+
+ void set_history(unsigned history)
+ {
+ gnuradio::Block::set_history(history);
+ }
+
+ void set_alignment(const size_t alignment);
+
+ bool is_unaligned(void);
+
};
typedef boost::shared_ptr<gr_block> gr_block_sptr;
diff --git a/include/gnuradio/gr_hier_block2.h b/include/gnuradio/gr_hier_block2.h
index 7bf1ae9..a8c7fbf 100644
--- a/include/gnuradio/gr_hier_block2.h
+++ b/include/gnuradio/gr_hier_block2.h
@@ -32,7 +32,7 @@ struct GR_RUNTIME_API gr_hier_block2 : gnuradio::HierBlock
gr_io_signature_sptr output_signature
);
- const Element &self(void) const
+ const gr_hier_block2 &self(void) const
{
return *this;
}
diff --git a/include/gnuradio/gr_sync_block.h b/include/gnuradio/gr_sync_block.h
index 2cff2f1..6e5ad96 100644
--- a/include/gnuradio/gr_sync_block.h
+++ b/include/gnuradio/gr_sync_block.h
@@ -20,9 +20,8 @@
#include <gnuradio/runtime_api.h>
#include <gr_block.h>
-struct GR_RUNTIME_API gr_sync_block : gr_block
+struct GR_RUNTIME_API gr_sync_block : public gr_block
{
-
gr_sync_block(void);
gr_sync_block(
@@ -41,10 +40,6 @@ struct GR_RUNTIME_API gr_sync_block : gr_block
return this->work(noutput_items, input_items, output_items);
}
- void set_alignment(const size_t alignment);
-
- bool is_unaligned(void);
-
/*!
* \brief just like gr_block::general_work, only this arranges to call consume_each for you
*
diff --git a/lib/block.cpp b/lib/block.cpp
index 1bd1217..ce94c76 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -202,7 +202,7 @@ static int mylround(double x)
void Block::forecast(
int noutput_items,
- std::vector<size_t> &ninput_items_required
+ std::vector<int> &ninput_items_required
){
for (size_t i = 0; i < ninput_items_required.size(); i++)
{
diff --git a/lib/gr_block.cpp b/lib/gr_block.cpp
index 2c51f75..dfc4d0b 100644
--- a/lib/gr_block.cpp
+++ b/lib/gr_block.cpp
@@ -34,7 +34,7 @@ gr_block::gr_block(
this->set_output_signature(output_signature);
}
-int gr_block::work(
+int gr_block::Work(
const InputItems &input_items,
const OutputItems &output_items
){
@@ -45,3 +45,13 @@ int gr_block::work(
(*this)->work_output_items
);
}
+
+void gr_block::set_alignment(const size_t alignment)
+{
+ //TODO
+}
+
+bool gr_block::is_unaligned(void)
+{
+ //TODO
+}
diff --git a/lib/gr_sync_block.cpp b/lib/gr_sync_block.cpp
index a6a9c2b..4cc9ae7 100644
--- a/lib/gr_sync_block.cpp
+++ b/lib/gr_sync_block.cpp
@@ -33,16 +33,6 @@ gr_sync_block::gr_sync_block(
this->set_fixed_rate(true);
}
-void gr_sync_block::set_alignment(const size_t alignment)
-{
- //TODO
-}
-
-bool gr_sync_block::is_unaligned(void)
-{
- //TODO
-}
-
gr_sync_interpolator::gr_sync_interpolator(void)
{
//NOP
diff --git a/swig/gr_tags.i b/swig/gr_tags.i
new file mode 100644
index 0000000..828d014
--- /dev/null
+++ b/swig/gr_tags.i
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%{
+#include <gr_tags.h>
+%}
+
+%include <pmt_swig.i> //for pmt support
+
+%include <gr_tags.h>
+
+//gives support for a vector of tags (get tags in range)
+%include "std_vector.i"
+%template(tags_vector_t) std::vector<gr_tag_t>;
diff --git a/swig/runtime.i b/swig/runtime.i
new file mode 100644
index 0000000..9d06cc1
--- /dev/null
+++ b/swig/runtime.i
@@ -0,0 +1,68 @@
+//
+// Copyright 2012 Josh Blum
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with io_sig program. If not, see <http://www.gnu.org/licenses/>.
+
+#define GR_CORE_API
+#define GR_RUNTIME_API
+
+%constant int sizeof_char = sizeof(char);
+%constant int sizeof_short = sizeof(short);
+%constant int sizeof_int = sizeof(int);
+%constant int sizeof_float = sizeof(float);
+%constant int sizeof_double = sizeof(double);
+%constant int sizeof_gr_complex = sizeof(gr_complex);
+
+%{
+
+#include <gnuradio/element.hpp>
+#include <gnuradio/block.hpp>
+#include <gnuradio/hier_block.hpp>
+#include <gnuradio/top_block.hpp>
+#include <gnuradio/io_signature.hpp>
+#include <gnuradio/tags.hpp>
+#include <gr_tags.h>
+#include <gr_runtime_types.h>
+#include <gr_io_signature.h>
+#include <gr_block.h>
+#include <gr_hier_block2.h>
+#include <gr_message.h>
+#include <gr_msg_handler.h>
+#include <gr_msg_queue.h>
+#include <gr_sync_block.h>
+#include <gr_sync_decimator.h>
+#include <gr_sync_interpolator.h>
+#include <gr_top_block.h>
+
+%}
+
+%include <gnuradio/element.hpp>
+%include <gnuradio/tags.hpp>
+%include <gnuradio/block.hpp>
+%include <gnuradio/hier_block.hpp>
+%include <gnuradio/top_block.hpp>
+%include <gnuradio/io_signature.hpp>
+%include <gr_tags.h>
+%include <gr_io_signature.h>
+%include <gr_block.h>
+%include <gr_hier_block2.h>
+%include <gr_swig_block_magic.i>
+%include <gr_message.h>
+%include <gr_msg_handler.h>
+%include <gr_msg_queue.h>
+%include <gr_sync_block.h>
+%include <gr_sync_decimator.h>
+%include <gr_sync_interpolator.h>
+%include <gr_top_block.h>
+