GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
feval.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2006,2013 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_GR_FEVAL_H
24#define INCLUDED_GR_FEVAL_H
25
26#include <gnuradio/api.h>
27#include <gnuradio/gr_complex.h>
28#include <pmt/pmt.h>
29
30namespace gr {
31
32/*!
33 * \brief base class for evaluating a function: double -> double
34 * \ingroup misc
35 *
36 * This class is designed to be subclassed in Python or C++ and is
37 * callable from both places. It uses SWIG's "director" feature to
38 * implement the magic.
39 *
40 * It's slow. Don't use it in a performance critical path.
41 *
42 * Override eval to define the behavior.
43 * Use calleval to invoke eval (this kludge is required to allow a
44 * python specific "shim" to be inserted.
45 */
47{
48protected:
49 /*!
50 * \brief override this to define the function
51 */
52 virtual double eval(double x);
53
54public:
56 virtual ~feval_dd();
57
58 virtual double calleval(double x); // invoke "eval"
59};
60
61/*!
62 * \brief base class for evaluating a function: complex -> complex
63 * \ingroup misc
64 *
65 * This class is designed to be subclassed in Python or C++ and is
66 * callable from both places. It uses SWIG's "director" feature to
67 * implement the magic.
68 *
69 * It's slow. Don't use it in a performance critical path.
70 *
71 * Override eval to define the behavior.
72 * Use calleval to invoke eval (this kludge is required to allow a
73 * python specific "shim" to be inserted.
74 */
76{
77protected:
78 /*!
79 * \brief override this to define the function
80 */
82
83public:
85 virtual ~feval_cc();
86
87 virtual gr_complex calleval(gr_complex x); // invoke "eval"
88};
89
90/*!
91 * \brief base class for evaluating a function: long -> long
92 * \ingroup misc
93 *
94 * This class is designed to be subclassed in Python or C++ and is
95 * callable from both places. It uses SWIG's "director" feature to
96 * implement the magic.
97 *
98 * It's slow. Don't use it in a performance critical path.
99 *
100 * Override eval to define the behavior.
101 * Use calleval to invoke eval (this kludge is required to allow a
102 * python specific "shim" to be inserted.
103 */
105{
106protected:
107 /*!
108 * \brief override this to define the function
109 */
110 virtual long eval(long x);
111
112public:
114 virtual ~feval_ll();
115
116 virtual long calleval(long x); // invoke "eval"
117};
118
119/*!
120 * \brief base class for evaluating a function: void -> void
121 * \ingroup misc
122 *
123 * This class is designed to be subclassed in Python or C++ and is
124 * callable from both places. It uses SWIG's "director" feature to
125 * implement the magic.
126 *
127 * It's slow. Don't use it in a performance critical path.
128 *
129 * Override eval to define the behavior.
130 * Use calleval to invoke eval (this kludge is required to allow a
131 * python specific "shim" to be inserted.
132 */
134{
135protected:
136 /*!
137 * \brief override this to define the function
138 */
139 virtual void eval();
140
141public:
142 feval() {}
143 virtual ~feval();
144
145 virtual void calleval(); // invoke "eval"
146};
147
148/*!
149 * \brief base class for evaluating a function: pmt -> void
150 * \ingroup misc
151 *
152 * This class is designed to be subclassed in Python or C++ and is
153 * callable from both places. It uses SWIG's "director" feature to
154 * implement the magic.
155 *
156 * It's slow. Don't use it in a performance critical path.
157 *
158 * Override eval to define the behavior.
159 * Use calleval to invoke eval (this kludge is required to allow a
160 * python specific "shim" to be inserted.
161 */
163{
164protected:
165 /*!
166 * \brief override this to define the function
167 */
168 virtual void eval(pmt::pmt_t x);
169
170public:
172 virtual ~feval_p();
173
174 virtual void calleval(pmt::pmt_t x); // invoke "eval"
175};
176
177/*!
178 * \brief trivial examples / test cases showing C++ calling Python code
179 */
184
185} /* namespace gr */
186
187#endif /* INCLUDED_GR_FEVAL_H */
base class for evaluating a function: complex -> complex
Definition feval.h:76
feval_cc()
Definition feval.h:84
virtual ~feval_cc()
virtual gr_complex eval(gr_complex x)
override this to define the function
virtual gr_complex calleval(gr_complex x)
base class for evaluating a function: double -> double
Definition feval.h:47
virtual ~feval_dd()
virtual double eval(double x)
override this to define the function
virtual double calleval(double x)
feval_dd()
Definition feval.h:55
base class for evaluating a function: long -> long
Definition feval.h:105
virtual long calleval(long x)
feval_ll()
Definition feval.h:113
virtual long eval(long x)
override this to define the function
virtual ~feval_ll()
base class for evaluating a function: pmt -> void
Definition feval.h:163
virtual void calleval(pmt::pmt_t x)
virtual ~feval_p()
virtual void eval(pmt::pmt_t x)
override this to define the function
feval_p()
Definition feval.h:171
base class for evaluating a function: void -> void
Definition feval.h:134
virtual void calleval()
virtual void eval()
override this to define the function
feval()
Definition feval.h:142
virtual ~feval()
#define GR_RUNTIME_API
Definition gnuradio-runtime/include/gnuradio/api.h:30
std::complex< float > gr_complex
Definition gr_complex.h:27
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
GR_RUNTIME_API void feval_example(feval *f)
GR_RUNTIME_API long feval_ll_example(feval_ll *f, long x)
GR_RUNTIME_API gr_complex feval_cc_example(feval_cc *f, gr_complex x)
GR_RUNTIME_API double feval_dd_example(feval_dd *f, double x)
trivial examples / test cases showing C++ calling Python code
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition pmt.h:96