Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-core / src / lib / general / gr_complex_to_xxx.h
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_TO_XXX_H
24 #define INCLUDED_GR_COMPLEX_TO_XXX_H
25
26 #include <gr_sync_block.h>
27 #include <gr_complex.h>
28
29 class gr_complex_to_float;
30 class gr_complex_to_real;
31 class gr_complex_to_imag;
32 class gr_complex_to_mag;
33 class gr_complex_to_mag_squared;
34 class gr_complex_to_arg;
35
36 typedef boost::shared_ptr<gr_complex_to_float> gr_complex_to_float_sptr;
37 typedef boost::shared_ptr<gr_complex_to_real> gr_complex_to_real_sptr;
38 typedef boost::shared_ptr<gr_complex_to_imag> gr_complex_to_imag_sptr;
39 typedef boost::shared_ptr<gr_complex_to_mag> gr_complex_to_mag_sptr;
40 typedef boost::shared_ptr<gr_complex_to_mag_squared> gr_complex_to_mag_squared_sptr;
41 typedef boost::shared_ptr<gr_complex_to_arg> gr_complex_to_arg_sptr;
42
43 gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1);
44 gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1);
45 gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1);
46 gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1);
47 gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1);
48 gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1);
49
50 /*!
51  * \brief convert a stream of gr_complex to 1 or 2 streams of float
52  * \ingroup converter_blk
53  * \param vlen  vector len (default 1)
54  */
55 class gr_complex_to_float : public gr_sync_block
56 {
57   friend gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen);
58   gr_complex_to_float (unsigned int vlen);
59
60   unsigned int  d_vlen;
61
62  public:
63   virtual int work (int noutput_items,
64                     gr_vector_const_void_star &input_items,
65                     gr_vector_void_star &output_items);
66 };
67
68 /*!
69  * \brief complex in, real out (float)
70  * \ingroup converter_blk
71  * \param vlen  vector len (default 1)
72  */
73 class gr_complex_to_real : public gr_sync_block
74 {
75   friend gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen);
76   gr_complex_to_real (unsigned int vlen);
77
78   unsigned int  d_vlen;
79
80  public:
81   virtual int work (int noutput_items,
82                     gr_vector_const_void_star &input_items,
83                     gr_vector_void_star &output_items);
84 };
85
86 /*!
87  * \brief complex in, imaginary out (float)
88  * \ingroup converter_blk
89  * \param vlen  vector len (default 1)
90  */
91 class gr_complex_to_imag : public gr_sync_block
92 {
93   friend gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen);
94   gr_complex_to_imag (unsigned int vlen);
95
96   unsigned int  d_vlen;
97
98  public:
99   virtual int work (int noutput_items,
100                     gr_vector_const_void_star &input_items,
101                     gr_vector_void_star &output_items);
102 };
103
104 /*!
105  * \brief complex in, magnitude out (float)
106  * \ingroup converter_blk
107  * \param vlen  vector len (default 1)
108  */
109 class gr_complex_to_mag : public gr_sync_block
110 {
111   friend gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen);
112   gr_complex_to_mag (unsigned int vlen);
113
114   unsigned int  d_vlen;
115
116  public:
117   virtual int work (int noutput_items,
118                     gr_vector_const_void_star &input_items,
119                     gr_vector_void_star &output_items);
120 };
121
122 /*!
123  * \brief complex in, magnitude squared out (float)
124  * \ingroup converter_blk
125  * \param vlen  vector len (default 1)
126  */
127 class gr_complex_to_mag_squared : public gr_sync_block
128 {
129   friend gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen);
130   gr_complex_to_mag_squared (unsigned int vlen);
131
132   unsigned int  d_vlen;
133
134  public:
135   virtual int work (int noutput_items,
136                     gr_vector_const_void_star &input_items,
137                     gr_vector_void_star &output_items);
138 };
139
140 /*!
141  * \brief complex in, angle out (float) 
142  * \ingroup converter_blk
143  * \param vlen  vector len (default 1)
144  */
145 class gr_complex_to_arg : public gr_sync_block
146 {
147   friend gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen);
148   gr_complex_to_arg (unsigned int vlen);
149
150   unsigned int  d_vlen;
151
152  public:
153   virtual int work (int noutput_items,
154                     gr_vector_const_void_star &input_items,
155                     gr_vector_void_star &output_items);
156 };
157
158 #endif /* INCLUDED_GR_COMPLEX_TO_XXX_H */