Imported Upstream version 3.0
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_block_detail.i
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 2, 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 class gr_block_detail;
24 typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr;
25 %template(gr_block_detail_sptr) boost::shared_ptr<gr_block_detail>;
26 %rename(block_detail) gr_make_block_detail;
27 %ignore gr_block_detail;
28
29 gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs);
30
31 class gr_block_detail {
32  public:
33
34   ~gr_block_detail ();
35
36   int ninputs () const { return d_ninputs; }
37   int noutputs () const { return d_noutputs; }
38   bool sink_p () const { return d_noutputs == 0; }
39   bool source_p () const { return d_ninputs == 0; }
40
41   void set_input (unsigned int which, gr_buffer_reader_sptr reader);
42   gr_buffer_reader_sptr input (unsigned int which)
43   {
44     if (which >= d_ninputs)
45       throw std::invalid_argument ("gr_block_detail::input");
46     return d_input[which];
47   }
48
49   void set_output (unsigned int which, gr_buffer_sptr buffer);
50   gr_buffer_sptr output (unsigned int which)
51   {
52     if (which >= d_noutputs)
53       throw std::invalid_argument ("gr_block_detail::output");
54     return d_output[which];
55   }
56
57   // ----------------------------------------------------------------------------
58
59  private:
60   gr_block_detail (unsigned int ninputs, unsigned int noutputs);
61
62 };
63
64
65 %rename(block_detail_ncurrently_allocated) gr_block_detail_ncurrently_allocated;
66 long gr_block_detail_ncurrently_allocated ();