commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9925 - gnuradio/branches/developers/nldudok1/gpgpu-wi


From: nldudok1
Subject: [Commit-gnuradio] r9925 - gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen
Date: Mon, 3 Nov 2008 16:45:20 -0700 (MST)

Author: nldudok1
Date: 2008-11-03 16:45:20 -0700 (Mon, 03 Nov 2008)
New Revision: 9925

Added:
   
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.cc.t
   
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.h.t
   
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.i.t
Log:
added missing gr_check_compare files

Added: 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.cc.t
===================================================================
--- 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.cc.t
                               (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.cc.t
       2008-11-03 23:45:20 UTC (rev 9925)
@@ -0,0 +1,95 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2008 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+
address@hidden@
address@hidden@ (float min_abs_diff, bool stop_on_difference, bool 
show_differences)
+{
+  return @SPTR_NAME@ (new @NAME@ (min_abs_diff, stop_on_difference, 
show_differences));
+}
+
address@hidden@::@NAME@ (float min_abs_diff, bool stop_on_difference, bool 
show_differences)
+  : gr_sync_block ("@BASE_NAME@",
+                  gr_make_io_signature (2, 2, sizeof (@I_TYPE@)),
+                  gr_make_io_signature (0, 1, sizeof (@O_TYPE@)))
+  , d_min_abs_diff(min_abs_diff),
+    d_do_stop_on_difference(stop_on_difference),
+    d_do_show_differences(show_differences),
+    d_num_inputs_processed(0),
+    d_num_blocks_processed(0)
+{
+}
+
+int
address@hidden@::work (int noutput_items,
+                  gr_vector_const_void_star &input_items,
+                  gr_vector_void_star &output_items)
+{
+  @O_TYPE@ *optr;
+
+  int ninputs = input_items.size ();
+  int noutputs = output_items.size ();
+  int num_inputs_processed=0;
+
+  //assert(0==noutputs || 1==noutputs);
+  if(1==noutputs)
+    optr = (@O_TYPE@ *) output_items[0];
+
+  for (int i = 0; i < noutput_items; i++){
+    bool result;
+    @I_TYPE@ input_0=((@I_TYPE@ *) input_items[0])[i];
+    @I_TYPE@ input_1=((@I_TYPE@ *) input_items[1])[i];
+#if @IS_COMPLEX@       // complex?
+    float abs_diff=abs(input_0 - input_1);
+#else
+    float abs_diff=fabs(input_0 - input_1);
+#endif
+    result   = (abs_diff <= d_min_abs_diff);
+    if(!result)
+    {
+      if(d_do_stop_on_difference)
+      {
+        fprintf(stderr,"@NAME@: failed on sample %i (global %i) 
abs_difference=%f d_min_abs_difference=%f\nnoutput_items=%i 
num_blocks_processed=%i\n", 
+                
num_inputs_processed,d_num_inputs_processed,abs_diff,d_min_abs_diff,noutput_items,d_num_blocks_processed);
+        throw std::runtime_error ("@NAME@: inputs don't match");
+      } else if(d_do_show_differences)
+      {
+        fprintf(stderr,"@NAME@: failed on sample %i (global %i) 
abs_difference=%f d_min_abs_difference=%f\nnoutput_items=%i 
num_blocks_processed=%i\n", 
+                
num_inputs_processed,d_num_inputs_processed,abs_diff,d_min_abs_diff,noutput_items,d_num_blocks_processed);
+      }
+    }
+    num_inputs_processed++;
+    d_num_inputs_processed++;
+    if(1==noutputs)
+      *optr++ = (@O_TYPE@) result;
+  }
+  d_num_blocks_processed++;
+  return noutput_items;
+}

Added: 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.h.t
===================================================================
--- 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.h.t
                                (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.h.t
        2008-11-03 23:45:20 UTC (rev 9925)
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2008 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_sync_block.h>
+#include <string>
+#include <stdexcept>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (float min_abs_diff=1.0e-7, bool 
stop_on_difference=false, bool show_differences=true);
+
+/*!
+ * \brief output = (abs(input_0 - input_1) < min_abs_diff)
+ * \ingroup math
+ *
+ * Compare two input streams.
+ * You can set the limit on how much the inputs may differ.
+ * optionally stop on first difference found.
+ * optionally show differences on stderr.
+ * The output-stream output of this block outputs a -1 for all input samples 
that match and a 0 for all input samples that don't match
+ * The use of the output-stream is not mandatory.
+ */
+class @NAME@ : public gr_sync_block
+{
+  friend @SPTR_NAME@ address@hidden@ (float min_abs_diff, bool 
stop_on_difference, bool show_differences);
+
+  @NAME@ (float min_abs_diff, bool stop_on_difference, bool show_differences);
+
+ protected:
+  float d_min_abs_diff;
+  bool d_do_stop_on_difference;
+  bool d_do_show_differences;
+  int d_num_inputs_processed;
+  int d_num_blocks_processed;
+
+ public:
+
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
+};
+
+#endif

Added: 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.i.t
===================================================================
--- 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.i.t
                                (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/gpgpu-wip/gnuradio-core/src/lib/gengen/gr_check_compare_XX.i.t
        2008-11-03 23:45:20 UTC (rev 9925)
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2008 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.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
address@hidden@ address@hidden@ (float min_abs_diff=1.0e-7, bool 
stop_on_difference=false, bool show_differences=true);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+  @NAME@ (float min_abs_diff, bool stop_on_difference, bool show_differences);
+};





reply via email to

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