howto: reorganized directory structure
[debian/gnuradio] / gr-howto-write-a-block / lib / howto_square_ff.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 #ifndef INCLUDED_HOWTO_SQUARE_FF_H
23 #define INCLUDED_HOWTO_SQUARE_FF_H
24
25 #include <gr_block.h>
26
27 class howto_square_ff;
28
29 /*
30  * We use boost::shared_ptr's instead of raw pointers for all access
31  * to gr_blocks (and many other data structures).  The shared_ptr gets
32  * us transparent reference counting, which greatly simplifies storage
33  * management issues.  This is especially helpful in our hybrid
34  * C++ / Python system.
35  *
36  * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
37  *
38  * As a convention, the _sptr suffix indicates a boost::shared_ptr
39  */
40 typedef boost::shared_ptr<howto_square_ff> howto_square_ff_sptr;
41
42 /*!
43  * \brief Return a shared_ptr to a new instance of howto_square_ff.
44  *
45  * To avoid accidental use of raw pointers, howto_square_ff's
46  * constructor is private.  howto_make_square_ff is the public
47  * interface for creating new instances.
48  */
49 howto_square_ff_sptr howto_make_square_ff ();
50
51 /*!
52  * \brief square a stream of floats.
53  * \ingroup block
54  *
55  * \sa howto_square2_ff for a version that subclasses gr_sync_block.
56  */
57 class howto_square_ff : public gr_block
58 {
59 private:
60   // The friend declaration allows howto_make_square_ff to
61   // access the private constructor.
62
63   friend howto_square_ff_sptr howto_make_square_ff ();
64
65   howto_square_ff ();   // private constructor
66
67  public:
68   ~howto_square_ff ();  // public destructor
69
70   // Where all the action really happens
71
72   int general_work (int noutput_items,
73                     gr_vector_int &ninput_items,
74                     gr_vector_const_void_star &input_items,
75                     gr_vector_void_star &output_items);
76 };
77
78 #endif /* INCLUDED_HOWTO_SQUARE_FF_H */