Merged r10875:10880 from jcorgan/t161 into trunk. Implements ticket:161, allowing...
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_hier_block2_detail.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2007,2009 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_HIER_BLOCK2_DETAIL_H
23 #define INCLUDED_GR_HIER_BLOCK2_DETAIL_H
24
25 #include <gr_hier_block2.h>
26 #include <gr_flat_flowgraph.h>
27 #include <boost/utility.hpp>
28
29 class gr_hier_block2_detail : boost::noncopyable
30 {
31 public:
32   gr_hier_block2_detail(gr_hier_block2 *owner);
33   ~gr_hier_block2_detail();
34
35   void connect(gr_basic_block_sptr block);
36   void connect(gr_basic_block_sptr src, int src_port, 
37                gr_basic_block_sptr dst, int dst_port);
38   void disconnect(gr_basic_block_sptr block);
39   void disconnect(gr_basic_block_sptr, int src_port, 
40                   gr_basic_block_sptr, int dst_port);
41   void disconnect_all();
42   void lock();
43   void unlock();
44   void flatten_aux(gr_flat_flowgraph_sptr sfg) const;
45
46 private:
47   
48   // Private implementation data
49   gr_hier_block2 *d_owner;
50   gr_hier_block2_detail *d_parent_detail;
51   gr_flowgraph_sptr d_fg;
52   std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input
53   gr_endpoint_vector_t d_outputs;             // Single internal endpoint per external output
54   gr_basic_block_vector_t d_blocks;
55   
56   void connect_input(int my_port, int port, gr_basic_block_sptr block);
57   void connect_output(int my_port, int port, gr_basic_block_sptr block);
58   void disconnect_input(int my_port, int port, gr_basic_block_sptr block);
59   void disconnect_output(int my_port, int port, gr_basic_block_sptr block);
60
61   gr_endpoint_vector_t resolve_port(int port, bool is_input);
62   gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool is_input) const;
63 };
64
65 #endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */