summaryrefslogtreecommitdiff
path: root/gr-utils/python/modtool/templates.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/python/modtool/templates.py')
-rw-r--r--gr-utils/python/modtool/templates.py71
1 files changed, 52 insertions, 19 deletions
diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py
index 87eb9f470c..289903348d 100644
--- a/gr-utils/python/modtool/templates.py
+++ b/gr-utils/python/modtool/templates.py
@@ -57,25 +57,34 @@ namespace gr {
class ${blockname}_impl : public ${blockname}
{
- private:
+ private:
// Nothing to declare in this block.
- public:
+#if $blocktype == 'tagged_stream'
+ protected:
+ int calculate_output_stream_length(const gr_vector_int &ninput_items);
+
+#end if
+ public:
${blockname}_impl(${strip_default_values($arglist)});
~${blockname}_impl();
+ // Where all the action really happens
#if $blocktype == 'general'
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
- // Where all the action really happens
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
+#else if $blocktype == 'tagged_stream'
+ int work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
#else if $blocktype == 'hier'
#silent pass
#else
- // Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
@@ -125,6 +134,8 @@ namespace gr {
#set $decimation = ', <+decimation+>'
#else if $blocktype == 'interpolator'
#set $decimation = ', <+interpolation+>'
+#else if $blocktype == 'tagged_stream'
+#set $decimation = ', <+len_tag_key+>'
#else
#set $decimation = ''
#end if
@@ -186,6 +197,28 @@ namespace gr {
// Tell runtime system how many output items we produced.
return noutput_items;
}
+#else if $blocktype == 'tagged_stream'
+ int
+ ${blockname}_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
+ {
+ int noutput_items = /* <+set this+> */;
+ return noutput_items ;
+ }
+
+ int
+ ${blockname}_impl::work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ // Do <+signal processing+>
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+ }
#else if $blocktype == 'hier'
#silent pass
#else
@@ -230,9 +263,9 @@ namespace gr {
*/
class ${modname.upper()}_API $blockname
{
- ${blockname}(${arglist});
- ~${blockname}();
- private:
+ ${blockname}(${arglist});
+ ~${blockname}();
+ private:
};
#else
/*!
@@ -242,18 +275,18 @@ namespace gr {
*/
class ${modname.upper()}_API ${blockname} : virtual public $grblocktype
{
- public:
- typedef boost::shared_ptr<${blockname}> sptr;
-
- /*!
- * \\brief Return a shared_ptr to a new instance of ${modname}::${blockname}.
- *
- * To avoid accidental use of raw pointers, ${modname}::${blockname}'s
- * constructor is in a private implementation
- * class. ${modname}::${blockname}::make is the public interface for
- * creating new instances.
- */
- static sptr make($arglist);
+ public:
+ typedef boost::shared_ptr<${blockname}> sptr;
+
+ /*!
+ * \\brief Return a shared_ptr to a new instance of ${modname}::${blockname}.
+ *
+ * To avoid accidental use of raw pointers, ${modname}::${blockname}'s
+ * constructor is in a private implementation
+ * class. ${modname}::${blockname}::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make($arglist);
};
#end if