X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnuradio-core%2Fsrc%2Flib%2Fgeneral%2Fgr_feval.h;h=cc4209af0330fd1d93ef95290d7d1d62091a8dfd;hb=ea29b08aeb54227e6628f655ccfdb96fe4d8c378;hp=d1d322bc98c9a7ed3971ed6be739e2eebfe0863c;hpb=09a1e803a9e6587c78d20cdf16891e5295874668;p=debian%2Fgnuradio diff --git a/gnuradio-core/src/lib/general/gr_feval.h b/gnuradio-core/src/lib/general/gr_feval.h index d1d322bc..cc4209af 100644 --- a/gnuradio-core/src/lib/general/gr_feval.h +++ b/gnuradio-core/src/lib/general/gr_feval.h @@ -26,62 +26,114 @@ /*! * \brief base class for evaluating a function: double -> double + * \ingroup misc * * 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. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. */ class gr_feval_dd { -public: - gr_feval_dd() {} - virtual ~gr_feval_dd(); - +protected: /*! * \brief override this to define the function */ virtual double eval(double x); + +public: + gr_feval_dd() {} + virtual ~gr_feval_dd(); + + virtual double calleval(double x); // invoke "eval" }; /*! * \brief base class for evaluating a function: complex -> complex + * \ingroup misc * * 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. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. */ class gr_feval_cc { -public: - gr_feval_cc() {} - virtual ~gr_feval_cc(); - +protected: /*! * \brief override this to define the function */ virtual gr_complex eval(gr_complex x); + +public: + gr_feval_cc() {} + virtual ~gr_feval_cc(); + + virtual gr_complex calleval(gr_complex x); // invoke "eval" }; /*! * \brief base class for evaluating a function: long -> long + * \ingroup misc * * 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. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. */ class gr_feval_ll { +protected: + /*! + * \brief override this to define the function + */ + virtual long eval(long x); + public: gr_feval_ll() {} virtual ~gr_feval_ll(); + virtual long calleval(long x); // invoke "eval" +}; + +/*! + * \brief base class for evaluating a function: void -> void + * \ingroup misc + * + * 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. + * + * Override eval to define the behavior. + * Use calleval to invoke eval (this kludge is required to allow a + * python specific "shim" to be inserted. + */ +class gr_feval +{ +protected: /*! * \brief override this to define the function */ - virtual long eval(long x); + virtual void eval(); + +public: + gr_feval() {} + virtual ~gr_feval(); + + virtual void calleval(); // invoke "eval" }; /*! @@ -90,6 +142,6 @@ public: double gr_feval_dd_example(gr_feval_dd *f, double 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); - +void gr_feval_example(gr_feval *f); #endif /* INCLUDED_GR_FEVAL_H */