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