GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
gr_complex.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004 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_COMPLEX_H
24#define INCLUDED_GR_COMPLEX_H
25
26#include <complex>
27typedef std::complex<float> gr_complex;
28typedef std::complex<double> gr_complexd;
29
30inline bool is_complex(gr_complex x)
31{
32 (void)x;
33 return true;
34}
35inline bool is_complex(gr_complexd x)
36{
37 (void)x;
38 return true;
39}
40inline bool is_complex(float x)
41{
42 (void)x;
43 return false;
44}
45inline bool is_complex(double x)
46{
47 (void)x;
48 return false;
49}
50inline bool is_complex(int x)
51{
52 (void)x;
53 return false;
54}
55inline bool is_complex(char x)
56{
57 (void)x;
58 return false;
59}
60inline bool is_complex(short x)
61{
62 (void)x;
63 return false;
64}
65
66// this doesn't really belong here, but there are worse places for it...
67
68#define CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, delta) \
69 CPPUNIT_ASSERT_DOUBLES_EQUAL(expected.real(), actual.real(), delta); \
70 CPPUNIT_ASSERT_DOUBLES_EQUAL(expected.imag(), actual.imag(), delta);
71
72#endif /* INCLUDED_GR_COMPLEX_H */
bool is_complex(gr_complex x)
Definition: gr_complex.h:30
std::complex< double > gr_complexd
Definition: gr_complex.h:28
std::complex< float > gr_complex
Definition: gr_complex.h:27