commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] gnuradio-core/src/lib/general gr_feval.cc gr_fe...


From: Michael Dickens
Subject: [Commit-gnuradio] gnuradio-core/src/lib/general gr_feval.cc gr_fe...
Date: Wed, 05 Jul 2006 17:39:12 +0000

CVSROOT:        /sources/gnuradio
Module name:    gnuradio-core
Changes by:     Michael Dickens <michaelld>     06/07/05 17:39:12

Modified files:
        src/lib/general: gr_feval.cc gr_feval.h 

Log message:
        Added float -> float functionality.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/general/gr_feval.cc?cvsroot=gnuradio&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/general/gr_feval.h?cvsroot=gnuradio&r1=1.1&r2=1.2

Patches:
Index: gr_feval.cc
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/general/gr_feval.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gr_feval.cc 8 Jun 2006 22:03:54 -0000       1.1
+++ gr_feval.cc 5 Jul 2006 17:39:12 -0000       1.2
@@ -34,6 +34,14 @@
   return 0;
 }
 
+gr_feval_ff::~gr_feval_ff(){}
+
+float 
+gr_feval_ff::eval(float x)
+{
+  return 0;
+}
+
 gr_feval_cc::~gr_feval_cc(){}
 
 gr_complex
@@ -59,6 +67,12 @@
   return f->eval(x);
 }
 
+float
+gr_feval_ff_example(gr_feval_ff *f, float x)
+{
+  return f->eval(x);
+}
+
 gr_complex
 gr_feval_cc_example(gr_feval_cc *f, gr_complex x)
 {

Index: gr_feval.h
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/general/gr_feval.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gr_feval.h  8 Jun 2006 22:03:54 -0000       1.1
+++ gr_feval.h  5 Jul 2006 17:39:12 -0000       1.2
@@ -45,6 +45,26 @@
 };
 
 /*!
+ * \brief base class for evaluating a function: float -> float
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places.  It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ */
+class gr_feval_ff
+{
+public:
+  gr_feval_ff() {}
+  virtual ~gr_feval_ff();
+
+  /*!
+   * \brief override this to define the function
+   */
+  virtual float eval(float x);
+};
+
+/*!
  * \brief base class for evaluating a function: complex -> complex
  *
  * This class is designed to be subclassed in Python or C++
@@ -88,6 +108,7 @@
  * \brief trivial examples / test cases showing C++ calling Python code
  */
 double     gr_feval_dd_example(gr_feval_dd *f, double x);
+float      gr_feval_ff_example(gr_feval_ff *f, float x);
 gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x);
 long       gr_feval_ll_example(gr_feval_ll *f, long x);
 




reply via email to

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