commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10932 - gnuradio/trunk/gnuradio-core/src/lib/gengen


From: jcorgan
Subject: [Commit-gnuradio] r10932 - gnuradio/trunk/gnuradio-core/src/lib/gengen
Date: Thu, 30 Apr 2009 13:57:03 -0600 (MDT)

Author: jcorgan
Date: 2009-04-30 13:57:02 -0600 (Thu, 30 Apr 2009)
New Revision: 10932

Modified:
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t
   gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t
Log:
Adds dynamic setters/getters for moving average filters.

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t       
2009-04-30 03:53:44 UTC (rev 10931)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t       
2009-04-30 19:57:02 UTC (rev 10932)
@@ -39,9 +39,12 @@
   : gr_sync_block ("@BASE_NAME@",
                   gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
                   gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
-    d_length(length),
-    d_scale(scale),
-    d_max_iter(max_iter)
+  d_length(length),
+  d_scale(scale),
+  d_max_iter(max_iter),
+  d_new_length(length),
+  d_new_scale(scale),
+  d_updated(false)
 {
   set_history(length);
 }
@@ -50,11 +53,27 @@
 {
 }
 
+void
address@hidden@::set_length_and_scale(int length, @O_TYPE@ scale)
+{
+  d_new_length = length;
+  d_new_scale = scale;
+  d_updated = true;
+}
+
 int 
 @NAME@::work (int noutput_items,
              gr_vector_const_void_star &input_items,
              gr_vector_void_star &output_items)
 {
+  if (d_updated) {
+    d_length = d_new_length;
+    d_scale = d_new_scale;
+    set_history(d_length);
+    d_updated = false;
+    return 0; // history requirements might have changed
+  }
+
   const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
   @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
 

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t        
2009-04-30 03:53:44 UTC (rev 10931)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t        
2009-04-30 19:57:02 UTC (rev 10932)
@@ -50,12 +50,21 @@
   @O_TYPE@ d_scale;
   int d_max_iter;
 
+  int d_new_length;
+  @O_TYPE@ d_new_scale;
+  bool d_updated;
+
 public:
   address@hidden@ ();  
 
   int work (int noutput_items,
            gr_vector_const_void_star &input_items,
            gr_vector_void_star &output_items);
+
+  int length() const { return d_new_length; }
+  @O_TYPE@ scale() const { return d_new_scale; }
+
+  void set_length_and_scale(int length, @O_TYPE@ scale);
 };
 
 #endif /* @GUARD_NAME@ */

Modified: gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t        
2009-04-30 03:53:44 UTC (rev 10931)
+++ gnuradio/trunk/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t        
2009-04-30 19:57:02 UTC (rev 10932)
@@ -30,4 +30,9 @@
 {
 private:
   @NAME@ ();
+
+ public:
+  int length() const;
+  @O_TYPE@ scale() const;
+  void set_length_and_scale(int length, @O_TYPE@ scale);
 };





reply via email to

[Prev in Thread] Current Thread [Next in Thread]