GNU Radio 3.6.4.1 C++ API
gr_feval.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2006 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
#ifndef INCLUDED_GR_FEVAL_H
23
#define INCLUDED_GR_FEVAL_H
24
25
#include <
gr_core_api.h
>
26
#include <
gr_complex.h
>
27
#include <
gruel/pmt.h
>
28
29
/*!
30
* \brief base class for evaluating a function: double -> double
31
* \ingroup misc
32
*
33
* This class is designed to be subclassed in Python or C++
34
* and is callable from both places. It uses SWIG's
35
* "director" feature to implement the magic.
36
* It's slow. Don't use it in a performance critical path.
37
*
38
* Override eval to define the behavior.
39
* Use calleval to invoke eval (this kludge is required to allow a
40
* python specific "shim" to be inserted.
41
*/
42
class
GR_CORE_API
gr_feval_dd
43
{
44
protected
:
45
/*!
46
* \brief override this to define the function
47
*/
48
virtual
double
eval(
double
x);
49
50
public
:
51
gr_feval_dd
() {}
52
virtual
~
gr_feval_dd
();
53
54
virtual
double
calleval(
double
x);
// invoke "eval"
55
};
56
57
/*!
58
* \brief base class for evaluating a function: complex -> complex
59
* \ingroup misc
60
*
61
* This class is designed to be subclassed in Python or C++
62
* and is callable from both places. It uses SWIG's
63
* "director" feature to implement the magic.
64
* It's slow. Don't use it in a performance critical path.
65
*
66
* Override eval to define the behavior.
67
* Use calleval to invoke eval (this kludge is required to allow a
68
* python specific "shim" to be inserted.
69
*/
70
class
GR_CORE_API
gr_feval_cc
71
{
72
protected
:
73
/*!
74
* \brief override this to define the function
75
*/
76
virtual
gr_complex
eval(
gr_complex
x);
77
78
public
:
79
gr_feval_cc
() {}
80
virtual
~
gr_feval_cc
();
81
82
virtual
gr_complex
calleval(
gr_complex
x);
// invoke "eval"
83
};
84
85
/*!
86
* \brief base class for evaluating a function: long -> long
87
* \ingroup misc
88
*
89
* This class is designed to be subclassed in Python or C++
90
* and is callable from both places. It uses SWIG's
91
* "director" feature to implement the magic.
92
* It's slow. Don't use it in a performance critical path.
93
*
94
* Override eval to define the behavior.
95
* Use calleval to invoke eval (this kludge is required to allow a
96
* python specific "shim" to be inserted.
97
*/
98
class
GR_CORE_API
gr_feval_ll
99
{
100
protected
:
101
/*!
102
* \brief override this to define the function
103
*/
104
virtual
long
eval(
long
x);
105
106
public
:
107
gr_feval_ll
() {}
108
virtual
~
gr_feval_ll
();
109
110
virtual
long
calleval(
long
x);
// invoke "eval"
111
};
112
113
/*!
114
* \brief base class for evaluating a function: void -> void
115
* \ingroup misc
116
*
117
* This class is designed to be subclassed in Python or C++
118
* and is callable from both places. It uses SWIG's
119
* "director" feature to implement the magic.
120
* It's slow. Don't use it in a performance critical path.
121
*
122
* Override eval to define the behavior.
123
* Use calleval to invoke eval (this kludge is required to allow a
124
* python specific "shim" to be inserted.
125
*/
126
class
GR_CORE_API
gr_feval
127
{
128
protected
:
129
/*!
130
* \brief override this to define the function
131
*/
132
virtual
void
eval();
133
134
public
:
135
gr_feval
() {}
136
virtual
~
gr_feval
();
137
138
virtual
void
calleval();
// invoke "eval"
139
};
140
141
/*!
142
* \brief base class for evaluating a function: pmt -> void
143
* \ingroup misc
144
*
145
* This class is designed to be subclassed in Python or C++
146
* and is callable from both places. It uses SWIG's
147
* "director" feature to implement the magic.
148
* It's slow. Don't use it in a performance critical path.
149
*
150
* Override eval to define the behavior.
151
* Use calleval to invoke eval (this kludge is required to allow a
152
* python specific "shim" to be inserted.
153
*/
154
class
GR_CORE_API
gr_feval_p
155
{
156
protected
:
157
/*!
158
* \brief override this to define the function
159
*/
160
virtual
void
eval(
pmt::pmt_t
x);
161
162
public
:
163
gr_feval_p
() {}
164
virtual
~
gr_feval_p
();
165
166
virtual
void
calleval(
pmt::pmt_t
x);
// invoke "eval"
167
};
168
169
/*!
170
* \brief trivial examples / test cases showing C++ calling Python code
171
*/
172
GR_CORE_API
double
gr_feval_dd_example
(
gr_feval_dd
*f,
double
x);
173
GR_CORE_API
gr_complex
gr_feval_cc_example
(
gr_feval_cc
*f,
gr_complex
x);
174
GR_CORE_API
long
gr_feval_ll_example
(
gr_feval_ll
*f,
long
x);
175
GR_CORE_API
void
gr_feval_example
(
gr_feval
*f);
176
177
#endif
/* INCLUDED_GR_FEVAL_H */
gnuradio
gnuradio-core
src
lib
general
gr_feval.h
Generated by
1.8.1.1