Add check_topology, delete d_diff_filters in dtor, cleanup init and use of
[debian/gnuradio] / gnuradio-core / src / lib / filter / gr_pfb_clock_sync_fff.cc
index d1d2f05dbe25e9d431f824b8b6fdd0641803ffdf..86de3b5a1c17fe2ec3e3864a9344a1839e8a148e 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2009 Free Software Foundation, Inc.
+ * Copyright 2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -93,9 +93,16 @@ gr_pfb_clock_sync_fff::~gr_pfb_clock_sync_fff ()
 {
   for(int i = 0; i < d_nfilters; i++) {
     delete d_filters[i];
+    delete d_diff_filters[i];
   }
 }
 
+bool
+gr_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs)
+{
+  return noutputs == 1 || noutputs == 4;
+}
+
 void
 gr_pfb_clock_sync_fff::set_taps (const std::vector<float> &newtaps,
                                 std::vector< std::vector<float> > &ourtaps,
@@ -219,8 +226,8 @@ gr_pfb_clock_sync_fff::general_work (int noutput_items,
   float *in = (float *) input_items[0];
   float *out = (float *) output_items[0];
 
-  float *err, *outrate, *outk;
-  if(output_items.size() > 2) {
+  float *err = 0, *outrate = 0, *outk = 0;
+  if(output_items.size() == 4) {
     err = (float *) output_items[1];
     outrate = (float*)output_items[2];
     outk = (float*)output_items[3];
@@ -269,7 +276,7 @@ gr_pfb_clock_sync_fff::general_work (int noutput_items,
     i++;
     count += (int)floor(d_sps);
 
-    if(output_items.size() > 2) {
+    if(output_items.size() == 4) {
       err[i] = error;
       outrate[i] = d_rate_f;
       outk[i] = d_k;